ixv_vf.h revision 315333
11539Srgrimes/****************************************************************************** 21539Srgrimes 31539Srgrimes Copyright (c) 2001-2017, Intel Corporation 41539Srgrimes All rights reserved. 51539Srgrimes 61539Srgrimes Redistribution and use in source and binary forms, with or without 71539Srgrimes modification, are permitted provided that the following conditions are met: 81539Srgrimes 91539Srgrimes 1. Redistributions of source code must retain the above copyright notice, 101539Srgrimes this list of conditions and the following disclaimer. 111539Srgrimes 121539Srgrimes 2. Redistributions in binary form must reproduce the above copyright 131539Srgrimes notice, this list of conditions and the following disclaimer in the 141539Srgrimes documentation and/or other materials provided with the distribution. 151539Srgrimes 161539Srgrimes 3. Neither the name of the Intel Corporation nor the names of its 171539Srgrimes contributors may be used to endorse or promote products derived from 181539Srgrimes this software without specific prior written permission. 191539Srgrimes 201539Srgrimes THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 211539Srgrimes AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 221539Srgrimes IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 231539Srgrimes ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 241539Srgrimes LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 251539Srgrimes CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 261539Srgrimes SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 271539Srgrimes INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 281539Srgrimes CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 291539Srgrimes ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 301539Srgrimes POSSIBILITY OF SUCH DAMAGE. 311539Srgrimes 321539Srgrimes******************************************************************************/ 331539Srgrimes/*$FreeBSD: stable/10/sys/dev/ixgbe/ixv_vf.h 315333 2017-03-15 21:20:17Z erj $*/ 341539Srgrimes 358858Srgrimes#ifndef _IXGBE_VF_H_ 361539Srgrimes#define _IXGBE_VF_H_ 371539Srgrimes 381539Srgrimes#define IXGBE_VF_IRQ_CLEAR_MASK 7 391539Srgrimes#define IXGBE_VF_MAX_TX_QUEUES 8 401539Srgrimes#define IXGBE_VF_MAX_RX_QUEUES 8 411539Srgrimes 428858Srgrimes/* DCB define */ 431539Srgrimes#define IXGBE_VF_MAX_TRAFFIC_CLASS 8 441539Srgrimes 451539Srgrimes#define IXGBE_VFCTRL 0x00000 461539Srgrimes#define IXGBE_VFSTATUS 0x00008 471539Srgrimes#define IXGBE_VFLINKS 0x00010 481539Srgrimes#define IXGBE_VFFRTIMER 0x00048 491539Srgrimes#define IXGBE_VFRXMEMWRAP 0x03190 501539Srgrimes#define IXGBE_VTEICR 0x00100 511539Srgrimes#define IXGBE_VTEICS 0x00104 521539Srgrimes#define IXGBE_VTEIMS 0x00108 531539Srgrimes#define IXGBE_VTEIMC 0x0010C 541539Srgrimes#define IXGBE_VTEIAC 0x00110 5536888Speter#define IXGBE_VTEIAM 0x00114 5636888Speter#define IXGBE_VTEITR(x) (0x00820 + (4 * (x))) 5736888Speter#define IXGBE_VTIVAR(x) (0x00120 + (4 * (x))) 5850473Speter#define IXGBE_VTIVAR_MISC 0x00140 5936888Speter#define IXGBE_VTRSCINT(x) (0x00180 + (4 * (x))) 6036888Speter/* define IXGBE_VFPBACL still says TBD in EAS */ 611539Srgrimes#define IXGBE_VFRDBAL(x) (0x01000 + (0x40 * (x))) 621539Srgrimes#define IXGBE_VFRDBAH(x) (0x01004 + (0x40 * (x))) 631539Srgrimes#define IXGBE_VFRDLEN(x) (0x01008 + (0x40 * (x))) 6484463Sbde#define IXGBE_VFRDH(x) (0x01010 + (0x40 * (x))) 65102227Smike#define IXGBE_VFRDT(x) (0x01018 + (0x40 * (x))) 66146244Sume#define IXGBE_VFRXDCTL(x) (0x01028 + (0x40 * (x))) 67146244Sume#define IXGBE_VFSRRCTL(x) (0x01014 + (0x40 * (x))) 6821055Speter#define IXGBE_VFRSCCTL(x) (0x0102C + (0x40 * (x))) 69102227Smike#define IXGBE_VFPSRTYPE 0x00300 70102227Smike#define IXGBE_VFTDBAL(x) (0x02000 + (0x40 * (x))) 71102227Smike#define IXGBE_VFTDBAH(x) (0x02004 + (0x40 * (x))) 7272510Sume#define IXGBE_VFTDLEN(x) (0x02008 + (0x40 * (x))) 7372510Sume#define IXGBE_VFTDH(x) (0x02010 + (0x40 * (x))) 74102227Smike#define IXGBE_VFTDT(x) (0x02018 + (0x40 * (x))) 75102227Smike#define IXGBE_VFTXDCTL(x) (0x02028 + (0x40 * (x))) 76102227Smike#define IXGBE_VFTDWBAL(x) (0x02038 + (0x40 * (x))) 7784463Sbde#define IXGBE_VFTDWBAH(x) (0x0203C + (0x40 * (x))) 7884463Sbde#define IXGBE_VFDCA_RXCTRL(x) (0x0100C + (0x40 * (x))) 79146244Sume#define IXGBE_VFDCA_TXCTRL(x) (0x0200c + (0x40 * (x))) 80146244Sume#define IXGBE_VFGPRC 0x0101C 81146244Sume#define IXGBE_VFGPTC 0x0201C 82146244Sume#define IXGBE_VFGORC_LSB 0x01020 83146244Sume#define IXGBE_VFGORC_MSB 0x01024 8436888Speter#define IXGBE_VFGOTC_LSB 0x02020 8536888Speter#define IXGBE_VFGOTC_MSB 0x02024 8636888Speter#define IXGBE_VFMPRC 0x01034 871539Srgrimes#define IXGBE_VFMRQC 0x3000 881539Srgrimes#define IXGBE_VFRSSRK(x) (0x3100 + ((x) * 4)) 891539Srgrimes#define IXGBE_VFRETA(x) (0x3200 + ((x) * 4)) 901539Srgrimes 911539Srgrimesstruct ixgbe_hw; 92126243Sgreen 9310132Speter#include "ixv_type.h" 941539Srgrimes 951539Srgrimes#include "ixv_mbx.h" 961539Srgrimes 971539Srgrimesstruct ixgbe_mac_operations { 981539Srgrimes s32 (*init_hw)(struct ixgbe_hw *); 9983047Sobrien s32 (*reset_hw)(struct ixgbe_hw *); 1001539Srgrimes s32 (*start_hw)(struct ixgbe_hw *); 1011539Srgrimes s32 (*clear_hw_cntrs)(struct ixgbe_hw *); 1021539Srgrimes enum ixgbe_media_type (*get_media_type)(struct ixgbe_hw *); 1031539Srgrimes u32 (*get_supported_physical_layer)(struct ixgbe_hw *); 1041539Srgrimes s32 (*get_mac_addr)(struct ixgbe_hw *, u8 *); 10513771Smpp s32 (*stop_adapter)(struct ixgbe_hw *); 1061539Srgrimes s32 (*get_bus_info)(struct ixgbe_hw *); 1071539Srgrimes s32 (*negotiate_api_version)(struct ixgbe_hw *hw, int api); 1081539Srgrimes 109146244Sume /* Link */ 110146244Sume s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool); 111146244Sume s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool); 112146244Sume s32 (*get_link_capabilities)(struct ixgbe_hw *, ixgbe_link_speed *, 113146244Sume bool *); 114146244Sume 115146244Sume /* RAR, Multicast, VLAN */ 116146244Sume s32 (*set_rar)(struct ixgbe_hw *, u32, u8 *, u32, u32); 117146244Sume s32 (*set_uc_addr)(struct ixgbe_hw *, u32, u8 *); 1181539Srgrimes s32 (*init_rx_addrs)(struct ixgbe_hw *); 11983047Sobrien s32 (*update_mc_addr_list)(struct ixgbe_hw *, u8 *, u32, 1201539Srgrimes ixgbe_mc_addr_itr, bool); 1211539Srgrimes s32 (*update_xcast_mode)(struct ixgbe_hw *, int); 1221539Srgrimes s32 (*enable_mc)(struct ixgbe_hw *); 123146244Sume s32 (*disable_mc)(struct ixgbe_hw *); 124146244Sume s32 (*clear_vfta)(struct ixgbe_hw *); 125146244Sume s32 (*set_vfta)(struct ixgbe_hw *, u32, u32, bool, bool); 126146244Sume s32 (*set_rlpml)(struct ixgbe_hw *, u16); 127146244Sume}; 128146244Sume 129146244Sumestruct ixgbe_mac_info { 1301539Srgrimes struct ixgbe_mac_operations ops; 1311539Srgrimes u8 addr[6]; 13283047Sobrien u8 perm_addr[6]; 1331539Srgrimes 1341539Srgrimes enum ixgbe_mac_type type; 1351539Srgrimes 1361539Srgrimes s32 mc_filter_type; 1371539Srgrimes 1381539Srgrimes bool get_link_status; 13983047Sobrien u32 max_tx_queues; 1401539Srgrimes u32 max_rx_queues; 1411539Srgrimes u32 max_msix_vectors; 1421539Srgrimes}; 1431539Srgrimes 1441539Srgrimesstruct ixgbe_mbx_operations { 145146244Sume void (*init_params)(struct ixgbe_hw *hw); 146146244Sume s32 (*read)(struct ixgbe_hw *, u32 *, u16, u16); 147146244Sume s32 (*write)(struct ixgbe_hw *, u32 *, u16, u16); 148146244Sume s32 (*read_posted)(struct ixgbe_hw *, u32 *, u16, u16); 149146244Sume s32 (*write_posted)(struct ixgbe_hw *, u32 *, u16, u16); 150146244Sume s32 (*check_for_msg)(struct ixgbe_hw *, u16); 151146244Sume s32 (*check_for_ack)(struct ixgbe_hw *, u16); 152146244Sume s32 (*check_for_rst)(struct ixgbe_hw *, u16); 153146244Sume}; 154146244Sume 155146244Sumestruct ixgbe_mbx_stats { 15655163Sshin u32 msgs_tx; 15755163Sshin u32 msgs_rx; 15855163Sshin 15955163Sshin u32 acks; 16055163Sshin u32 reqs; 161146244Sume u32 rsts; 162146244Sume}; 163146244Sume 164146244Sumestruct ixgbe_mbx_info { 165146244Sume struct ixgbe_mbx_operations ops; 166146244Sume struct ixgbe_mbx_stats stats; 167146244Sume u32 timeout; 16855163Sshin u32 usec_delay; 16955163Sshin u32 v2p_mailbox; 17055163Sshin u16 size; 17155163Sshin}; 17255163Sshin 1731539Srgrimesstruct ixgbe_hw { 1741539Srgrimes void *back; 175126243Sgreen 1761539Srgrimes u8 IOMEM *hw_addr; 1771539Srgrimes 17810132Speter struct ixgbe_mac_info mac; 17910132Speter struct ixgbe_mbx_info mbx; 1801539Srgrimes 18113771Smpp u16 device_id; 1821539Srgrimes u16 subsystem_vendor_id; 1831539Srgrimes u16 subsystem_device_id; 1841539Srgrimes u16 vendor_id; 1851539Srgrimes 18655163Sshin u8 revision_id; 18755163Sshin bool adapter_stopped; 18855163Sshin 189121430Sume int api_version; 190121430Sume}; 19155163Sshin 192121430Sumestruct ixgbevf_hw_stats { 19355163Sshin u64 base_vfgprc; 19455163Sshin u64 base_vfgptc; 19555163Sshin u64 base_vfgorc; 19655163Sshin u64 base_vfgotc; 19755163Sshin u64 base_vfmprc; 198121430Sume 199121430Sume u64 last_vfgprc; 20055163Sshin u64 last_vfgptc; 201121430Sume u64 last_vfgorc; 20255163Sshin u64 last_vfgotc; 20355163Sshin u64 last_vfmprc; 20455163Sshin 20555163Sshin u64 vfgprc; 20655163Sshin u64 vfgptc; 20755163Sshin u64 vfgorc; 20874393Sume u64 vfgotc; 20955163Sshin u64 vfmprc; 21055163Sshin 21155163Sshin u64 saved_reset_vfgprc; 21255163Sshin u64 saved_reset_vfgptc; 21355163Sshin u64 saved_reset_vfgorc; 21455163Sshin u64 saved_reset_vfgotc; 215140908Sume u64 saved_reset_vfmprc; 216140908Sume}; 217140908Sume 21872693Sumes32 ixgbe_init_ops_vf(struct ixgbe_hw *hw); 219140908Sumes32 ixgbe_init_hw_vf(struct ixgbe_hw *hw); 220140908Sumes32 ixgbe_start_hw_vf(struct ixgbe_hw *hw); 22155163Sshins32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw); 22255163Sshins32 ixgbe_stop_adapter_vf(struct ixgbe_hw *hw); 22355163Sshinu32 ixgbe_get_num_of_tx_queues_vf(struct ixgbe_hw *hw); 22455163Sshinu32 ixgbe_get_num_of_rx_queues_vf(struct ixgbe_hw *hw); 22555163Sshins32 ixgbe_get_mac_addr_vf(struct ixgbe_hw *hw, u8 *mac_addr); 22655163Sshins32 ixgbe_setup_mac_link_vf(struct ixgbe_hw *hw, ixgbe_link_speed speed, 22755163Sshin bool autoneg_wait_to_complete); 22855163Sshins32 ixgbe_check_mac_link_vf(struct ixgbe_hw *hw, ixgbe_link_speed *speed, 22955163Sshin bool *link_up, bool autoneg_wait_to_complete); 23055163Sshins32 ixgbe_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq, 23155163Sshin u32 enable_addr); 23255163Sshins32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr); 23355163Sshins32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list, 23455163Sshin u32 mc_addr_count, ixgbe_mc_addr_itr, 23555163Sshin bool clear); 23655163Sshins32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode); 23755163Sshins32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind, 23855163Sshin bool vlan_on, bool vlvf_bypass); 23955163Sshins32 ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size); 24055163Sshinint ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api); 24155163Sshinint ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs, 24255163Sshin unsigned int *default_tc); 243121316Sume 24455163Sshin#endif /* __IXGBE_VF_H__ */ 245121316Sume