diff options
author | Greg Rose <gregory.v.rose@intel.com> | 2010-01-08 21:25:29 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-01-10 16:34:24 -0500 |
commit | 7f870475c8f102469df44a86387a03cb23e79b90 (patch) | |
tree | 6a95f54079586ee389253722f36350e987b98a02 | |
parent | 10ca132c41ecc1b55bc22667493ab75c4f6eec0d (diff) |
ixgbe: Add SR-IOV register, structure and bit defines
This patch adds register definitions, bit definitions and structures used by
the driver to support SR-IOV features of the 82599 controller.
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ixgbe/ixgbe.h | 31 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 2 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_type.h | 53 |
3 files changed, 83 insertions, 3 deletions
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h index 8da8eb535084..ed735857695c 100644 --- a/drivers/net/ixgbe/ixgbe.h +++ b/drivers/net/ixgbe/ixgbe.h | |||
@@ -98,6 +98,23 @@ | |||
98 | 98 | ||
99 | #define IXGBE_MAX_RSC_INT_RATE 162760 | 99 | #define IXGBE_MAX_RSC_INT_RATE 162760 |
100 | 100 | ||
101 | #define IXGBE_MAX_VF_MC_ENTRIES 30 | ||
102 | #define IXGBE_MAX_VF_FUNCTIONS 64 | ||
103 | #define IXGBE_MAX_VFTA_ENTRIES 128 | ||
104 | #define MAX_EMULATION_MAC_ADDRS 16 | ||
105 | #define VMDQ_P(p) ((p) + adapter->num_vfs) | ||
106 | |||
107 | struct vf_data_storage { | ||
108 | unsigned char vf_mac_addresses[ETH_ALEN]; | ||
109 | u16 vf_mc_hashes[IXGBE_MAX_VF_MC_ENTRIES]; | ||
110 | u16 num_vf_mc_hashes; | ||
111 | u16 default_vf_vlan_id; | ||
112 | u16 vlans_enabled; | ||
113 | unsigned char em_mac_addresses[MAX_EMULATION_MAC_ADDRS * ETH_ALEN]; | ||
114 | bool clear_to_send; | ||
115 | int rar; | ||
116 | }; | ||
117 | |||
101 | /* wrapper around a pointer to a socket buffer, | 118 | /* wrapper around a pointer to a socket buffer, |
102 | * so a DMA handle can be stored along with the buffer */ | 119 | * so a DMA handle can be stored along with the buffer */ |
103 | struct ixgbe_tx_buffer { | 120 | struct ixgbe_tx_buffer { |
@@ -171,7 +188,7 @@ struct ixgbe_ring { | |||
171 | enum ixgbe_ring_f_enum { | 188 | enum ixgbe_ring_f_enum { |
172 | RING_F_NONE = 0, | 189 | RING_F_NONE = 0, |
173 | RING_F_DCB, | 190 | RING_F_DCB, |
174 | RING_F_VMDQ, | 191 | RING_F_VMDQ, /* SR-IOV uses the same ring feature */ |
175 | RING_F_RSS, | 192 | RING_F_RSS, |
176 | RING_F_FDIR, | 193 | RING_F_FDIR, |
177 | #ifdef IXGBE_FCOE | 194 | #ifdef IXGBE_FCOE |
@@ -183,7 +200,7 @@ enum ixgbe_ring_f_enum { | |||
183 | 200 | ||
184 | #define IXGBE_MAX_DCB_INDICES 8 | 201 | #define IXGBE_MAX_DCB_INDICES 8 |
185 | #define IXGBE_MAX_RSS_INDICES 16 | 202 | #define IXGBE_MAX_RSS_INDICES 16 |
186 | #define IXGBE_MAX_VMDQ_INDICES 16 | 203 | #define IXGBE_MAX_VMDQ_INDICES 64 |
187 | #define IXGBE_MAX_FDIR_INDICES 64 | 204 | #define IXGBE_MAX_FDIR_INDICES 64 |
188 | #ifdef IXGBE_FCOE | 205 | #ifdef IXGBE_FCOE |
189 | #define IXGBE_MAX_FCOE_INDICES 8 | 206 | #define IXGBE_MAX_FCOE_INDICES 8 |
@@ -288,6 +305,8 @@ struct ixgbe_adapter { | |||
288 | /* RX */ | 305 | /* RX */ |
289 | struct ixgbe_ring *rx_ring ____cacheline_aligned_in_smp; /* One per active queue */ | 306 | struct ixgbe_ring *rx_ring ____cacheline_aligned_in_smp; /* One per active queue */ |
290 | int num_rx_queues; | 307 | int num_rx_queues; |
308 | int num_rx_pools; /* == num_rx_queues in 82598 */ | ||
309 | int num_rx_queues_per_pool; /* 1 if 82598, can be many if 82599 */ | ||
291 | u64 hw_csum_rx_error; | 310 | u64 hw_csum_rx_error; |
292 | u64 hw_rx_no_dma_resources; | 311 | u64 hw_rx_no_dma_resources; |
293 | u64 non_eop_descs; | 312 | u64 non_eop_descs; |
@@ -330,6 +349,8 @@ struct ixgbe_adapter { | |||
330 | #define IXGBE_FLAG_FDIR_PERFECT_CAPABLE (u32)(1 << 27) | 349 | #define IXGBE_FLAG_FDIR_PERFECT_CAPABLE (u32)(1 << 27) |
331 | #define IXGBE_FLAG_FCOE_CAPABLE (u32)(1 << 28) | 350 | #define IXGBE_FLAG_FCOE_CAPABLE (u32)(1 << 28) |
332 | #define IXGBE_FLAG_FCOE_ENABLED (u32)(1 << 29) | 351 | #define IXGBE_FLAG_FCOE_ENABLED (u32)(1 << 29) |
352 | #define IXGBE_FLAG_SRIOV_CAPABLE (u32)(1 << 30) | ||
353 | #define IXGBE_FLAG_SRIOV_ENABLED (u32)(1 << 31) | ||
333 | 354 | ||
334 | u32 flags2; | 355 | u32 flags2; |
335 | #define IXGBE_FLAG2_RSC_CAPABLE (u32)(1) | 356 | #define IXGBE_FLAG2_RSC_CAPABLE (u32)(1) |
@@ -379,6 +400,11 @@ struct ixgbe_adapter { | |||
379 | u64 rsc_total_flush; | 400 | u64 rsc_total_flush; |
380 | u32 wol; | 401 | u32 wol; |
381 | u16 eeprom_version; | 402 | u16 eeprom_version; |
403 | |||
404 | /* SR-IOV */ | ||
405 | DECLARE_BITMAP(active_vfs, IXGBE_MAX_VF_FUNCTIONS); | ||
406 | unsigned int num_vfs; | ||
407 | struct vf_data_storage *vfinfo; | ||
382 | }; | 408 | }; |
383 | 409 | ||
384 | enum ixbge_state_t { | 410 | enum ixbge_state_t { |
@@ -440,6 +466,7 @@ extern s32 ixgbe_atr_set_flex_byte_82599(struct ixgbe_atr_input *input, | |||
440 | u16 flex_byte); | 466 | u16 flex_byte); |
441 | extern s32 ixgbe_atr_set_l4type_82599(struct ixgbe_atr_input *input, | 467 | extern s32 ixgbe_atr_set_l4type_82599(struct ixgbe_atr_input *input, |
442 | u8 l4type); | 468 | u8 l4type); |
469 | extern void ixgbe_set_rx_mode(struct net_device *netdev); | ||
443 | #ifdef IXGBE_FCOE | 470 | #ifdef IXGBE_FCOE |
444 | extern void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter); | 471 | extern void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter); |
445 | extern int ixgbe_fso(struct ixgbe_adapter *adapter, | 472 | extern int ixgbe_fso(struct ixgbe_adapter *adapter, |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index b2f11d45e225..233c3917427e 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -2409,7 +2409,7 @@ static u8 *ixgbe_addr_list_itr(struct ixgbe_hw *hw, u8 **mc_addr_ptr, u32 *vmdq) | |||
2409 | * responsible for configuring the hardware for proper unicast, multicast and | 2409 | * responsible for configuring the hardware for proper unicast, multicast and |
2410 | * promiscuous mode. | 2410 | * promiscuous mode. |
2411 | **/ | 2411 | **/ |
2412 | static void ixgbe_set_rx_mode(struct net_device *netdev) | 2412 | void ixgbe_set_rx_mode(struct net_device *netdev) |
2413 | { | 2413 | { |
2414 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 2414 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
2415 | struct ixgbe_hw *hw = &adapter->hw; | 2415 | struct ixgbe_hw *hw = &adapter->hw; |
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h index 84650c6ebe03..ec8ad182e2f5 100644 --- a/drivers/net/ixgbe/ixgbe_type.h +++ b/drivers/net/ixgbe/ixgbe_type.h | |||
@@ -277,6 +277,7 @@ | |||
277 | #define IXGBE_DTXCTL 0x07E00 | 277 | #define IXGBE_DTXCTL 0x07E00 |
278 | 278 | ||
279 | #define IXGBE_DMATXCTL 0x04A80 | 279 | #define IXGBE_DMATXCTL 0x04A80 |
280 | #define IXGBE_PFDTXGSWC 0x08220 | ||
280 | #define IXGBE_DTXMXSZRQ 0x08100 | 281 | #define IXGBE_DTXMXSZRQ 0x08100 |
281 | #define IXGBE_DTXTCPFLGL 0x04A88 | 282 | #define IXGBE_DTXTCPFLGL 0x04A88 |
282 | #define IXGBE_DTXTCPFLGH 0x04A8C | 283 | #define IXGBE_DTXTCPFLGH 0x04A8C |
@@ -287,6 +288,8 @@ | |||
287 | #define IXGBE_DMATXCTL_NS 0x2 /* No Snoop LSO hdr buffer */ | 288 | #define IXGBE_DMATXCTL_NS 0x2 /* No Snoop LSO hdr buffer */ |
288 | #define IXGBE_DMATXCTL_GDV 0x8 /* Global Double VLAN */ | 289 | #define IXGBE_DMATXCTL_GDV 0x8 /* Global Double VLAN */ |
289 | #define IXGBE_DMATXCTL_VT_SHIFT 16 /* VLAN EtherType */ | 290 | #define IXGBE_DMATXCTL_VT_SHIFT 16 /* VLAN EtherType */ |
291 | |||
292 | #define IXGBE_PFDTXGSWC_VT_LBEN 0x1 /* Local L2 VT switch enable */ | ||
290 | #define IXGBE_DCA_TXCTRL(_i) (0x07200 + ((_i) * 4)) /* 16 of these (0-15) */ | 293 | #define IXGBE_DCA_TXCTRL(_i) (0x07200 + ((_i) * 4)) /* 16 of these (0-15) */ |
291 | /* Tx DCA Control register : 128 of these (0-127) */ | 294 | /* Tx DCA Control register : 128 of these (0-127) */ |
292 | #define IXGBE_DCA_TXCTRL_82599(_i) (0x0600C + ((_i) * 0x40)) | 295 | #define IXGBE_DCA_TXCTRL_82599(_i) (0x0600C + ((_i) * 0x40)) |
@@ -497,6 +500,7 @@ | |||
497 | /* DCB registers */ | 500 | /* DCB registers */ |
498 | #define IXGBE_RTRPCS 0x02430 | 501 | #define IXGBE_RTRPCS 0x02430 |
499 | #define IXGBE_RTTDCS 0x04900 | 502 | #define IXGBE_RTTDCS 0x04900 |
503 | #define IXGBE_RTTDCS_ARBDIS 0x00000040 /* DCB arbiter disable */ | ||
500 | #define IXGBE_RTTPCS 0x0CD00 | 504 | #define IXGBE_RTTPCS 0x0CD00 |
501 | #define IXGBE_RTRUP2TC 0x03020 | 505 | #define IXGBE_RTRUP2TC 0x03020 |
502 | #define IXGBE_RTTUP2TC 0x0C800 | 506 | #define IXGBE_RTTUP2TC 0x0C800 |
@@ -730,6 +734,13 @@ | |||
730 | #define IXGBE_GCR_CMPL_TMOUT_RESEND 0x00010000 | 734 | #define IXGBE_GCR_CMPL_TMOUT_RESEND 0x00010000 |
731 | #define IXGBE_GCR_CAP_VER2 0x00040000 | 735 | #define IXGBE_GCR_CAP_VER2 0x00040000 |
732 | 736 | ||
737 | #define IXGBE_GCR_EXT_MSIX_EN 0x80000000 | ||
738 | #define IXGBE_GCR_EXT_VT_MODE_16 0x00000001 | ||
739 | #define IXGBE_GCR_EXT_VT_MODE_32 0x00000002 | ||
740 | #define IXGBE_GCR_EXT_VT_MODE_64 0x00000003 | ||
741 | #define IXGBE_GCR_EXT_SRIOV (IXGBE_GCR_EXT_MSIX_EN | \ | ||
742 | IXGBE_GCR_EXT_VT_MODE_64) | ||
743 | |||
733 | /* Time Sync Registers */ | 744 | /* Time Sync Registers */ |
734 | #define IXGBE_TSYNCRXCTL 0x05188 /* Rx Time Sync Control register - RW */ | 745 | #define IXGBE_TSYNCRXCTL 0x05188 /* Rx Time Sync Control register - RW */ |
735 | #define IXGBE_TSYNCTXCTL 0x08C00 /* Tx Time Sync Control register - RW */ | 746 | #define IXGBE_TSYNCTXCTL 0x08C00 /* Tx Time Sync Control register - RW */ |
@@ -1065,6 +1076,8 @@ | |||
1065 | /* VFRE bitmask */ | 1076 | /* VFRE bitmask */ |
1066 | #define IXGBE_VFRE_ENABLE_ALL 0xFFFFFFFF | 1077 | #define IXGBE_VFRE_ENABLE_ALL 0xFFFFFFFF |
1067 | 1078 | ||
1079 | #define IXGBE_VF_INIT_TIMEOUT 200 /* Number of retries to clear RSTI */ | ||
1080 | |||
1068 | /* RDHMPN and TDHMPN bitmasks */ | 1081 | /* RDHMPN and TDHMPN bitmasks */ |
1069 | #define IXGBE_RDHMPN_RDICADDR 0x007FF800 | 1082 | #define IXGBE_RDHMPN_RDICADDR 0x007FF800 |
1070 | #define IXGBE_RDHMPN_RDICRDREQ 0x00800000 | 1083 | #define IXGBE_RDHMPN_RDICRDREQ 0x00800000 |
@@ -1295,6 +1308,7 @@ | |||
1295 | /* VLAN pool filtering masks */ | 1308 | /* VLAN pool filtering masks */ |
1296 | #define IXGBE_VLVF_VIEN 0x80000000 /* filter is valid */ | 1309 | #define IXGBE_VLVF_VIEN 0x80000000 /* filter is valid */ |
1297 | #define IXGBE_VLVF_ENTRIES 64 | 1310 | #define IXGBE_VLVF_ENTRIES 64 |
1311 | #define IXGBE_VLVF_VLANID_MASK 0x00000FFF | ||
1298 | 1312 | ||
1299 | #define IXGBE_ETHERNET_IEEE_VLAN_TYPE 0x8100 /* 802.1q protocol */ | 1313 | #define IXGBE_ETHERNET_IEEE_VLAN_TYPE 0x8100 /* 802.1q protocol */ |
1300 | 1314 | ||
@@ -1843,6 +1857,12 @@ | |||
1843 | #define IXGBE_RX_DESC_SPECIAL_PRI_SHIFT 0x000D /* Priority in upper 3 of 16 */ | 1857 | #define IXGBE_RX_DESC_SPECIAL_PRI_SHIFT 0x000D /* Priority in upper 3 of 16 */ |
1844 | #define IXGBE_TX_DESC_SPECIAL_PRI_SHIFT IXGBE_RX_DESC_SPECIAL_PRI_SHIFT | 1858 | #define IXGBE_TX_DESC_SPECIAL_PRI_SHIFT IXGBE_RX_DESC_SPECIAL_PRI_SHIFT |
1845 | 1859 | ||
1860 | /* SR-IOV specific macros */ | ||
1861 | #define IXGBE_MBVFICR_INDEX(vf_number) (vf_number >> 4) | ||
1862 | #define IXGBE_MBVFICR(_i) (0x00710 + (_i * 4)) | ||
1863 | #define IXGBE_VFLRE(_i) (((_i & 1) ? 0x001C0 : 0x00600)) | ||
1864 | #define IXGBE_VFLREC(_i) (0x00700 + (_i * 4)) | ||
1865 | |||
1846 | /* Little Endian defines */ | 1866 | /* Little Endian defines */ |
1847 | #ifndef __le32 | 1867 | #ifndef __le32 |
1848 | #define __le32 u32 | 1868 | #define __le32 u32 |
@@ -2463,6 +2483,37 @@ struct ixgbe_phy_info { | |||
2463 | bool multispeed_fiber; | 2483 | bool multispeed_fiber; |
2464 | }; | 2484 | }; |
2465 | 2485 | ||
2486 | #include "ixgbe_mbx.h" | ||
2487 | |||
2488 | struct ixgbe_mbx_operations { | ||
2489 | s32 (*init_params)(struct ixgbe_hw *hw); | ||
2490 | s32 (*read)(struct ixgbe_hw *, u32 *, u16, u16); | ||
2491 | s32 (*write)(struct ixgbe_hw *, u32 *, u16, u16); | ||
2492 | s32 (*read_posted)(struct ixgbe_hw *, u32 *, u16, u16); | ||
2493 | s32 (*write_posted)(struct ixgbe_hw *, u32 *, u16, u16); | ||
2494 | s32 (*check_for_msg)(struct ixgbe_hw *, u16); | ||
2495 | s32 (*check_for_ack)(struct ixgbe_hw *, u16); | ||
2496 | s32 (*check_for_rst)(struct ixgbe_hw *, u16); | ||
2497 | }; | ||
2498 | |||
2499 | struct ixgbe_mbx_stats { | ||
2500 | u32 msgs_tx; | ||
2501 | u32 msgs_rx; | ||
2502 | |||
2503 | u32 acks; | ||
2504 | u32 reqs; | ||
2505 | u32 rsts; | ||
2506 | }; | ||
2507 | |||
2508 | struct ixgbe_mbx_info { | ||
2509 | struct ixgbe_mbx_operations ops; | ||
2510 | struct ixgbe_mbx_stats stats; | ||
2511 | u32 timeout; | ||
2512 | u32 usec_delay; | ||
2513 | u32 v2p_mailbox; | ||
2514 | u16 size; | ||
2515 | }; | ||
2516 | |||
2466 | struct ixgbe_hw { | 2517 | struct ixgbe_hw { |
2467 | u8 __iomem *hw_addr; | 2518 | u8 __iomem *hw_addr; |
2468 | void *back; | 2519 | void *back; |
@@ -2472,6 +2523,7 @@ struct ixgbe_hw { | |||
2472 | struct ixgbe_phy_info phy; | 2523 | struct ixgbe_phy_info phy; |
2473 | struct ixgbe_eeprom_info eeprom; | 2524 | struct ixgbe_eeprom_info eeprom; |
2474 | struct ixgbe_bus_info bus; | 2525 | struct ixgbe_bus_info bus; |
2526 | struct ixgbe_mbx_info mbx; | ||
2475 | u16 device_id; | 2527 | u16 device_id; |
2476 | u16 vendor_id; | 2528 | u16 vendor_id; |
2477 | u16 subsystem_device_id; | 2529 | u16 subsystem_device_id; |
@@ -2486,6 +2538,7 @@ struct ixgbe_info { | |||
2486 | struct ixgbe_mac_operations *mac_ops; | 2538 | struct ixgbe_mac_operations *mac_ops; |
2487 | struct ixgbe_eeprom_operations *eeprom_ops; | 2539 | struct ixgbe_eeprom_operations *eeprom_ops; |
2488 | struct ixgbe_phy_operations *phy_ops; | 2540 | struct ixgbe_phy_operations *phy_ops; |
2541 | struct ixgbe_mbx_operations *mbx_ops; | ||
2489 | }; | 2542 | }; |
2490 | 2543 | ||
2491 | 2544 | ||