diff options
author | Vasu Dev <vasu.dev@intel.com> | 2014-08-01 16:27:03 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-08-02 22:41:13 -0400 |
commit | 38e004388692f049908636a7944f6cd57d28bd77 (patch) | |
tree | a37df738d55ea58e2b32fced378491f31b1052e4 | |
parent | a1a693698d00b48d2d56fc1c887ab86375934a06 (diff) |
i40e: Adds FCoE related code to i40e core driver
Adds FCoE specific code to existing i40e core driver to:-
1. have separate FCoE VSI with additional FCoE queues pairs.
2. have FCoE related hash defines.
3. have additional FCoE related stats code.
4. export and then re-use existing functions required by FCoE build.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Tested-by: Jack Morgan<jack.morgan@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e.h | 62 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_common.c | 27 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 19 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 35 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_fcoe.c | 9 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_main.c | 268 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_osdep.h | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_prototype.h | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_txrx.c | 37 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_txrx.h | 9 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_type.h | 138 |
11 files changed, 599 insertions, 11 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index 29cd81ae29f4..801da392a20e 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h | |||
@@ -54,6 +54,9 @@ | |||
54 | #include <linux/ptp_clock_kernel.h> | 54 | #include <linux/ptp_clock_kernel.h> |
55 | #include "i40e_type.h" | 55 | #include "i40e_type.h" |
56 | #include "i40e_prototype.h" | 56 | #include "i40e_prototype.h" |
57 | #ifdef I40E_FCOE | ||
58 | #include "i40e_fcoe.h" | ||
59 | #endif | ||
57 | #include "i40e_virtchnl.h" | 60 | #include "i40e_virtchnl.h" |
58 | #include "i40e_virtchnl_pf.h" | 61 | #include "i40e_virtchnl_pf.h" |
59 | #include "i40e_txrx.h" | 62 | #include "i40e_txrx.h" |
@@ -79,6 +82,10 @@ | |||
79 | #define I40E_MAX_QUEUES_PER_TC 64 /* should be a power of 2 */ | 82 | #define I40E_MAX_QUEUES_PER_TC 64 /* should be a power of 2 */ |
80 | #define I40E_FDIR_RING 0 | 83 | #define I40E_FDIR_RING 0 |
81 | #define I40E_FDIR_RING_COUNT 32 | 84 | #define I40E_FDIR_RING_COUNT 32 |
85 | #ifdef I40E_FCOE | ||
86 | #define I40E_DEFAULT_FCOE 8 /* default number of QPs for FCoE */ | ||
87 | #define I40E_MINIMUM_FCOE 1 /* minimum number of QPs for FCoE */ | ||
88 | #endif /* I40E_FCOE */ | ||
82 | #define I40E_MAX_AQ_BUF_SIZE 4096 | 89 | #define I40E_MAX_AQ_BUF_SIZE 4096 |
83 | #define I40E_AQ_LEN 32 | 90 | #define I40E_AQ_LEN 32 |
84 | #define I40E_AQ_WORK_LIMIT 16 | 91 | #define I40E_AQ_WORK_LIMIT 16 |
@@ -225,6 +232,10 @@ struct i40e_pf { | |||
225 | u16 num_vmdq_msix; /* num queue vectors per vmdq pool */ | 232 | u16 num_vmdq_msix; /* num queue vectors per vmdq pool */ |
226 | u16 num_req_vfs; /* num vfs requested for this vf */ | 233 | u16 num_req_vfs; /* num vfs requested for this vf */ |
227 | u16 num_vf_qps; /* num queue pairs per vf */ | 234 | u16 num_vf_qps; /* num queue pairs per vf */ |
235 | #ifdef I40E_FCOE | ||
236 | u16 num_fcoe_qps; /* num fcoe queues this pf has set up */ | ||
237 | u16 num_fcoe_msix; /* num queue vectors per fcoe pool */ | ||
238 | #endif /* I40E_FCOE */ | ||
228 | u16 num_lan_qps; /* num lan queues this pf has set up */ | 239 | u16 num_lan_qps; /* num lan queues this pf has set up */ |
229 | u16 num_lan_msix; /* num queue vectors for the base pf vsi */ | 240 | u16 num_lan_msix; /* num queue vectors for the base pf vsi */ |
230 | int queues_left; /* queues left unclaimed */ | 241 | int queues_left; /* queues left unclaimed */ |
@@ -265,6 +276,9 @@ struct i40e_pf { | |||
265 | #define I40E_FLAG_VMDQ_ENABLED (u64)(1 << 7) | 276 | #define I40E_FLAG_VMDQ_ENABLED (u64)(1 << 7) |
266 | #define I40E_FLAG_FDIR_REQUIRES_REINIT (u64)(1 << 8) | 277 | #define I40E_FLAG_FDIR_REQUIRES_REINIT (u64)(1 << 8) |
267 | #define I40E_FLAG_NEED_LINK_UPDATE (u64)(1 << 9) | 278 | #define I40E_FLAG_NEED_LINK_UPDATE (u64)(1 << 9) |
279 | #ifdef I40E_FCOE | ||
280 | #define I40E_FLAG_FCOE_ENABLED (u64)(1 << 11) | ||
281 | #endif /* I40E_FCOE */ | ||
268 | #define I40E_FLAG_IN_NETPOLL (u64)(1 << 12) | 282 | #define I40E_FLAG_IN_NETPOLL (u64)(1 << 12) |
269 | #define I40E_FLAG_16BYTE_RX_DESC_ENABLED (u64)(1 << 13) | 283 | #define I40E_FLAG_16BYTE_RX_DESC_ENABLED (u64)(1 << 13) |
270 | #define I40E_FLAG_CLEAN_ADMINQ (u64)(1 << 14) | 284 | #define I40E_FLAG_CLEAN_ADMINQ (u64)(1 << 14) |
@@ -286,6 +300,10 @@ struct i40e_pf { | |||
286 | /* tracks features that get auto disabled by errors */ | 300 | /* tracks features that get auto disabled by errors */ |
287 | u64 auto_disable_flags; | 301 | u64 auto_disable_flags; |
288 | 302 | ||
303 | #ifdef I40E_FCOE | ||
304 | struct i40e_fcoe fcoe; | ||
305 | |||
306 | #endif /* I40E_FCOE */ | ||
289 | bool stat_offsets_loaded; | 307 | bool stat_offsets_loaded; |
290 | struct i40e_hw_port_stats stats; | 308 | struct i40e_hw_port_stats stats; |
291 | struct i40e_hw_port_stats stats_offsets; | 309 | struct i40e_hw_port_stats stats_offsets; |
@@ -408,6 +426,11 @@ struct i40e_vsi { | |||
408 | struct rtnl_link_stats64 net_stats_offsets; | 426 | struct rtnl_link_stats64 net_stats_offsets; |
409 | struct i40e_eth_stats eth_stats; | 427 | struct i40e_eth_stats eth_stats; |
410 | struct i40e_eth_stats eth_stats_offsets; | 428 | struct i40e_eth_stats eth_stats_offsets; |
429 | #ifdef I40E_FCOE | ||
430 | struct i40e_fcoe_stats fcoe_stats; | ||
431 | struct i40e_fcoe_stats fcoe_stats_offsets; | ||
432 | bool fcoe_stat_offsets_loaded; | ||
433 | #endif | ||
411 | u32 tx_restart; | 434 | u32 tx_restart; |
412 | u32 tx_busy; | 435 | u32 tx_busy; |
413 | u32 rx_buf_failed; | 436 | u32 rx_buf_failed; |
@@ -598,6 +621,11 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type, | |||
598 | int i40e_vsi_release(struct i40e_vsi *vsi); | 621 | int i40e_vsi_release(struct i40e_vsi *vsi); |
599 | struct i40e_vsi *i40e_vsi_lookup(struct i40e_pf *pf, enum i40e_vsi_type type, | 622 | struct i40e_vsi *i40e_vsi_lookup(struct i40e_pf *pf, enum i40e_vsi_type type, |
600 | struct i40e_vsi *start_vsi); | 623 | struct i40e_vsi *start_vsi); |
624 | #ifdef I40E_FCOE | ||
625 | void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi, | ||
626 | struct i40e_vsi_context *ctxt, | ||
627 | u8 enabled_tc, bool is_add); | ||
628 | #endif | ||
601 | int i40e_vsi_control_rings(struct i40e_vsi *vsi, bool enable); | 629 | int i40e_vsi_control_rings(struct i40e_vsi *vsi, bool enable); |
602 | int i40e_reconfig_rss_queues(struct i40e_pf *pf, int queue_count); | 630 | int i40e_reconfig_rss_queues(struct i40e_pf *pf, int queue_count); |
603 | struct i40e_veb *i40e_veb_setup(struct i40e_pf *pf, u16 flags, u16 uplink_seid, | 631 | struct i40e_veb *i40e_veb_setup(struct i40e_pf *pf, u16 flags, u16 uplink_seid, |
@@ -624,7 +652,21 @@ void i40e_irq_dynamic_enable(struct i40e_vsi *vsi, int vector); | |||
624 | void i40e_irq_dynamic_disable(struct i40e_vsi *vsi, int vector); | 652 | void i40e_irq_dynamic_disable(struct i40e_vsi *vsi, int vector); |
625 | void i40e_irq_dynamic_disable_icr0(struct i40e_pf *pf); | 653 | void i40e_irq_dynamic_disable_icr0(struct i40e_pf *pf); |
626 | void i40e_irq_dynamic_enable_icr0(struct i40e_pf *pf); | 654 | void i40e_irq_dynamic_enable_icr0(struct i40e_pf *pf); |
655 | #ifdef I40E_FCOE | ||
656 | struct rtnl_link_stats64 *i40e_get_netdev_stats_struct( | ||
657 | struct net_device *netdev, | ||
658 | struct rtnl_link_stats64 *storage); | ||
659 | int i40e_set_mac(struct net_device *netdev, void *p); | ||
660 | void i40e_set_rx_mode(struct net_device *netdev); | ||
661 | #endif | ||
627 | int i40e_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); | 662 | int i40e_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); |
663 | #ifdef I40E_FCOE | ||
664 | void i40e_tx_timeout(struct net_device *netdev); | ||
665 | int i40e_vlan_rx_add_vid(struct net_device *netdev, | ||
666 | __always_unused __be16 proto, u16 vid); | ||
667 | int i40e_vlan_rx_kill_vid(struct net_device *netdev, | ||
668 | __always_unused __be16 proto, u16 vid); | ||
669 | #endif | ||
628 | int i40e_vsi_open(struct i40e_vsi *vsi); | 670 | int i40e_vsi_open(struct i40e_vsi *vsi); |
629 | void i40e_vlan_stripping_disable(struct i40e_vsi *vsi); | 671 | void i40e_vlan_stripping_disable(struct i40e_vsi *vsi); |
630 | int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid); | 672 | int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid); |
@@ -634,6 +676,26 @@ struct i40e_mac_filter *i40e_put_mac_in_vlan(struct i40e_vsi *vsi, u8 *macaddr, | |||
634 | bool i40e_is_vsi_in_vlan(struct i40e_vsi *vsi); | 676 | bool i40e_is_vsi_in_vlan(struct i40e_vsi *vsi); |
635 | struct i40e_mac_filter *i40e_find_mac(struct i40e_vsi *vsi, u8 *macaddr, | 677 | struct i40e_mac_filter *i40e_find_mac(struct i40e_vsi *vsi, u8 *macaddr, |
636 | bool is_vf, bool is_netdev); | 678 | bool is_vf, bool is_netdev); |
679 | #ifdef I40E_FCOE | ||
680 | int i40e_open(struct net_device *netdev); | ||
681 | int i40e_close(struct net_device *netdev); | ||
682 | int i40e_setup_tc(struct net_device *netdev, u8 tc); | ||
683 | void i40e_netpoll(struct net_device *netdev); | ||
684 | int i40e_fcoe_enable(struct net_device *netdev); | ||
685 | int i40e_fcoe_disable(struct net_device *netdev); | ||
686 | int i40e_fcoe_vsi_init(struct i40e_vsi *vsi, struct i40e_vsi_context *ctxt); | ||
687 | u8 i40e_get_fcoe_tc_map(struct i40e_pf *pf); | ||
688 | void i40e_fcoe_config_netdev(struct net_device *netdev, struct i40e_vsi *vsi); | ||
689 | void i40e_fcoe_vsi_setup(struct i40e_pf *pf); | ||
690 | int i40e_init_pf_fcoe(struct i40e_pf *pf); | ||
691 | int i40e_fcoe_setup_ddp_resources(struct i40e_vsi *vsi); | ||
692 | void i40e_fcoe_free_ddp_resources(struct i40e_vsi *vsi); | ||
693 | int i40e_fcoe_handle_offload(struct i40e_ring *rx_ring, | ||
694 | union i40e_rx_desc *rx_desc, | ||
695 | struct sk_buff *skb); | ||
696 | void i40e_fcoe_handle_status(struct i40e_ring *rx_ring, | ||
697 | union i40e_rx_desc *rx_desc, u8 prog_id); | ||
698 | #endif /* I40E_FCOE */ | ||
637 | void i40e_vlan_stripping_enable(struct i40e_vsi *vsi); | 699 | void i40e_vlan_stripping_enable(struct i40e_vsi *vsi); |
638 | #ifdef CONFIG_I40E_DCB | 700 | #ifdef CONFIG_I40E_DCB |
639 | void i40e_dcbnl_flush_apps(struct i40e_pf *pf, | 701 | void i40e_dcbnl_flush_apps(struct i40e_pf *pf, |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c index f4e502a305ff..a010584d8962 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_common.c +++ b/drivers/net/ethernet/intel/i40e/i40e_common.c | |||
@@ -709,6 +709,33 @@ void i40e_pre_tx_queue_cfg(struct i40e_hw *hw, u32 queue, bool enable) | |||
709 | 709 | ||
710 | wr32(hw, I40E_GLLAN_TXPRE_QDIS(reg_block), reg_val); | 710 | wr32(hw, I40E_GLLAN_TXPRE_QDIS(reg_block), reg_val); |
711 | } | 711 | } |
712 | #ifdef I40E_FCOE | ||
713 | |||
714 | /** | ||
715 | * i40e_get_san_mac_addr - get SAN MAC address | ||
716 | * @hw: pointer to the HW structure | ||
717 | * @mac_addr: pointer to SAN MAC address | ||
718 | * | ||
719 | * Reads the adapter's SAN MAC address from NVM | ||
720 | **/ | ||
721 | i40e_status i40e_get_san_mac_addr(struct i40e_hw *hw, u8 *mac_addr) | ||
722 | { | ||
723 | struct i40e_aqc_mac_address_read_data addrs; | ||
724 | i40e_status status; | ||
725 | u16 flags = 0; | ||
726 | |||
727 | status = i40e_aq_mac_address_read(hw, &flags, &addrs, NULL); | ||
728 | if (status) | ||
729 | return status; | ||
730 | |||
731 | if (flags & I40E_AQC_SAN_ADDR_VALID) | ||
732 | memcpy(mac_addr, &addrs.pf_san_mac, sizeof(addrs.pf_san_mac)); | ||
733 | else | ||
734 | status = I40E_ERR_INVALID_MAC_ADDR; | ||
735 | |||
736 | return status; | ||
737 | } | ||
738 | #endif | ||
712 | 739 | ||
713 | /** | 740 | /** |
714 | * i40e_get_media_type - Gets media type | 741 | * i40e_get_media_type - Gets media type |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c index 9eaed04618a3..5a0cabeb35ed 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c +++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c | |||
@@ -697,6 +697,25 @@ static void i40e_dbg_dump_vsi_seid(struct i40e_pf *pf, int seid) | |||
697 | vsi->bw_ets_limit_credits[i], | 697 | vsi->bw_ets_limit_credits[i], |
698 | vsi->bw_ets_max_quanta[i]); | 698 | vsi->bw_ets_max_quanta[i]); |
699 | } | 699 | } |
700 | #ifdef I40E_FCOE | ||
701 | if (vsi->type == I40E_VSI_FCOE) { | ||
702 | dev_info(&pf->pdev->dev, | ||
703 | " fcoe_stats: rx_packets = %llu, rx_dwords = %llu, rx_dropped = %llu\n", | ||
704 | vsi->fcoe_stats.rx_fcoe_packets, | ||
705 | vsi->fcoe_stats.rx_fcoe_dwords, | ||
706 | vsi->fcoe_stats.rx_fcoe_dropped); | ||
707 | dev_info(&pf->pdev->dev, | ||
708 | " fcoe_stats: tx_packets = %llu, tx_dwords = %llu\n", | ||
709 | vsi->fcoe_stats.tx_fcoe_packets, | ||
710 | vsi->fcoe_stats.tx_fcoe_dwords); | ||
711 | dev_info(&pf->pdev->dev, | ||
712 | " fcoe_stats: bad_crc = %llu, last_error = %llu\n", | ||
713 | vsi->fcoe_stats.fcoe_bad_fccrc, | ||
714 | vsi->fcoe_stats.fcoe_last_error); | ||
715 | dev_info(&pf->pdev->dev, " fcoe_stats: ddp_count = %llu\n", | ||
716 | vsi->fcoe_stats.fcoe_ddp_count); | ||
717 | } | ||
718 | #endif | ||
700 | } | 719 | } |
701 | 720 | ||
702 | /** | 721 | /** |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index 9c93ff28d4aa..681a9e81ff51 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c | |||
@@ -155,6 +155,19 @@ static struct i40e_stats i40e_gstrings_stats[] = { | |||
155 | I40E_PF_STAT("rx_lpi_count", stats.rx_lpi_count), | 155 | I40E_PF_STAT("rx_lpi_count", stats.rx_lpi_count), |
156 | }; | 156 | }; |
157 | 157 | ||
158 | #ifdef I40E_FCOE | ||
159 | static const struct i40e_stats i40e_gstrings_fcoe_stats[] = { | ||
160 | I40E_VSI_STAT("fcoe_bad_fccrc", fcoe_stats.fcoe_bad_fccrc), | ||
161 | I40E_VSI_STAT("rx_fcoe_dropped", fcoe_stats.rx_fcoe_dropped), | ||
162 | I40E_VSI_STAT("rx_fcoe_packets", fcoe_stats.rx_fcoe_packets), | ||
163 | I40E_VSI_STAT("rx_fcoe_dwords", fcoe_stats.rx_fcoe_dwords), | ||
164 | I40E_VSI_STAT("fcoe_ddp_count", fcoe_stats.fcoe_ddp_count), | ||
165 | I40E_VSI_STAT("fcoe_last_error", fcoe_stats.fcoe_last_error), | ||
166 | I40E_VSI_STAT("tx_fcoe_packets", fcoe_stats.tx_fcoe_packets), | ||
167 | I40E_VSI_STAT("tx_fcoe_dwords", fcoe_stats.tx_fcoe_dwords), | ||
168 | }; | ||
169 | |||
170 | #endif /* I40E_FCOE */ | ||
158 | #define I40E_QUEUE_STATS_LEN(n) \ | 171 | #define I40E_QUEUE_STATS_LEN(n) \ |
159 | (((struct i40e_netdev_priv *)netdev_priv((n)))->vsi->num_queue_pairs \ | 172 | (((struct i40e_netdev_priv *)netdev_priv((n)))->vsi->num_queue_pairs \ |
160 | * 2 /* Tx and Rx together */ \ | 173 | * 2 /* Tx and Rx together */ \ |
@@ -162,9 +175,17 @@ static struct i40e_stats i40e_gstrings_stats[] = { | |||
162 | #define I40E_GLOBAL_STATS_LEN ARRAY_SIZE(i40e_gstrings_stats) | 175 | #define I40E_GLOBAL_STATS_LEN ARRAY_SIZE(i40e_gstrings_stats) |
163 | #define I40E_NETDEV_STATS_LEN ARRAY_SIZE(i40e_gstrings_net_stats) | 176 | #define I40E_NETDEV_STATS_LEN ARRAY_SIZE(i40e_gstrings_net_stats) |
164 | #define I40E_MISC_STATS_LEN ARRAY_SIZE(i40e_gstrings_misc_stats) | 177 | #define I40E_MISC_STATS_LEN ARRAY_SIZE(i40e_gstrings_misc_stats) |
178 | #ifdef I40E_FCOE | ||
179 | #define I40E_FCOE_STATS_LEN ARRAY_SIZE(i40e_gstrings_fcoe_stats) | ||
180 | #define I40E_VSI_STATS_LEN(n) (I40E_NETDEV_STATS_LEN + \ | ||
181 | I40E_FCOE_STATS_LEN + \ | ||
182 | I40E_MISC_STATS_LEN + \ | ||
183 | I40E_QUEUE_STATS_LEN((n))) | ||
184 | #else | ||
165 | #define I40E_VSI_STATS_LEN(n) (I40E_NETDEV_STATS_LEN + \ | 185 | #define I40E_VSI_STATS_LEN(n) (I40E_NETDEV_STATS_LEN + \ |
166 | I40E_MISC_STATS_LEN + \ | 186 | I40E_MISC_STATS_LEN + \ |
167 | I40E_QUEUE_STATS_LEN((n))) | 187 | I40E_QUEUE_STATS_LEN((n))) |
188 | #endif /* I40E_FCOE */ | ||
168 | #define I40E_PFC_STATS_LEN ( \ | 189 | #define I40E_PFC_STATS_LEN ( \ |
169 | (FIELD_SIZEOF(struct i40e_pf, stats.priority_xoff_rx) + \ | 190 | (FIELD_SIZEOF(struct i40e_pf, stats.priority_xoff_rx) + \ |
170 | FIELD_SIZEOF(struct i40e_pf, stats.priority_xon_rx) + \ | 191 | FIELD_SIZEOF(struct i40e_pf, stats.priority_xon_rx) + \ |
@@ -1112,6 +1133,13 @@ static void i40e_get_ethtool_stats(struct net_device *netdev, | |||
1112 | data[i++] = (i40e_gstrings_misc_stats[j].sizeof_stat == | 1133 | data[i++] = (i40e_gstrings_misc_stats[j].sizeof_stat == |
1113 | sizeof(u64)) ? *(u64 *)p : *(u32 *)p; | 1134 | sizeof(u64)) ? *(u64 *)p : *(u32 *)p; |
1114 | } | 1135 | } |
1136 | #ifdef I40E_FCOE | ||
1137 | for (j = 0; j < I40E_FCOE_STATS_LEN; j++) { | ||
1138 | p = (char *)vsi + i40e_gstrings_fcoe_stats[j].stat_offset; | ||
1139 | data[i++] = (i40e_gstrings_fcoe_stats[j].sizeof_stat == | ||
1140 | sizeof(u64)) ? *(u64 *)p : *(u32 *)p; | ||
1141 | } | ||
1142 | #endif | ||
1115 | rcu_read_lock(); | 1143 | rcu_read_lock(); |
1116 | for (j = 0; j < vsi->num_queue_pairs; j++) { | 1144 | for (j = 0; j < vsi->num_queue_pairs; j++) { |
1117 | tx_ring = ACCESS_ONCE(vsi->tx_rings[j]); | 1145 | tx_ring = ACCESS_ONCE(vsi->tx_rings[j]); |
@@ -1193,6 +1221,13 @@ static void i40e_get_strings(struct net_device *netdev, u32 stringset, | |||
1193 | i40e_gstrings_misc_stats[i].stat_string); | 1221 | i40e_gstrings_misc_stats[i].stat_string); |
1194 | p += ETH_GSTRING_LEN; | 1222 | p += ETH_GSTRING_LEN; |
1195 | } | 1223 | } |
1224 | #ifdef I40E_FCOE | ||
1225 | for (i = 0; i < I40E_FCOE_STATS_LEN; i++) { | ||
1226 | snprintf(p, ETH_GSTRING_LEN, "%s", | ||
1227 | i40e_gstrings_fcoe_stats[i].stat_string); | ||
1228 | p += ETH_GSTRING_LEN; | ||
1229 | } | ||
1230 | #endif | ||
1196 | for (i = 0; i < vsi->num_queue_pairs; i++) { | 1231 | for (i = 0; i < vsi->num_queue_pairs; i++) { |
1197 | snprintf(p, ETH_GSTRING_LEN, "tx-%u.tx_packets", i); | 1232 | snprintf(p, ETH_GSTRING_LEN, "tx-%u.tx_packets", i); |
1198 | p += ETH_GSTRING_LEN; | 1233 | p += ETH_GSTRING_LEN; |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_fcoe.c b/drivers/net/ethernet/intel/i40e/i40e_fcoe.c index 8574eeefefc7..6938fc1ad877 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_fcoe.c +++ b/drivers/net/ethernet/intel/i40e/i40e_fcoe.c | |||
@@ -1363,8 +1363,6 @@ static netdev_tx_t i40e_fcoe_xmit_frame(struct sk_buff *skb, | |||
1363 | struct i40e_vsi *vsi = np->vsi; | 1363 | struct i40e_vsi *vsi = np->vsi; |
1364 | struct i40e_ring *tx_ring = vsi->tx_rings[skb->queue_mapping]; | 1364 | struct i40e_ring *tx_ring = vsi->tx_rings[skb->queue_mapping]; |
1365 | struct i40e_tx_buffer *first; | 1365 | struct i40e_tx_buffer *first; |
1366 | __be16 protocol = skb->protocol; | ||
1367 | |||
1368 | u32 tx_flags = 0; | 1366 | u32 tx_flags = 0; |
1369 | u8 hdr_len = 0; | 1367 | u8 hdr_len = 0; |
1370 | u8 sof = 0; | 1368 | u8 sof = 0; |
@@ -1384,13 +1382,8 @@ static netdev_tx_t i40e_fcoe_xmit_frame(struct sk_buff *skb, | |||
1384 | /* record the location of the first descriptor for this packet */ | 1382 | /* record the location of the first descriptor for this packet */ |
1385 | first = &tx_ring->tx_bi[tx_ring->next_to_use]; | 1383 | first = &tx_ring->tx_bi[tx_ring->next_to_use]; |
1386 | 1384 | ||
1387 | if (protocol == htons(ETH_P_8021Q)) { | ||
1388 | struct vlan_ethhdr *veth = (struct vlan_ethhdr *)eth_hdr(skb); | ||
1389 | |||
1390 | protocol = veth->h_vlan_encapsulated_proto; | ||
1391 | } | ||
1392 | /* FIP is a regular L2 traffic w/o offload */ | 1385 | /* FIP is a regular L2 traffic w/o offload */ |
1393 | if (protocol == htons(ETH_P_FIP)) | 1386 | if (skb->protocol == htons(ETH_P_FIP)) |
1394 | goto out_send; | 1387 | goto out_send; |
1395 | 1388 | ||
1396 | /* check sof and eof, only supports FC Class 2 or 3 */ | 1389 | /* check sof and eof, only supports FC Class 2 or 3 */ |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 821fcc1adb85..6ac8487f9a51 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
@@ -269,7 +269,11 @@ static void i40e_service_event_schedule(struct i40e_pf *pf) | |||
269 | * device is munged, not just the one netdev port, so go for the full | 269 | * device is munged, not just the one netdev port, so go for the full |
270 | * reset. | 270 | * reset. |
271 | **/ | 271 | **/ |
272 | #ifdef I40E_FCOE | ||
273 | void i40e_tx_timeout(struct net_device *netdev) | ||
274 | #else | ||
272 | static void i40e_tx_timeout(struct net_device *netdev) | 275 | static void i40e_tx_timeout(struct net_device *netdev) |
276 | #endif | ||
273 | { | 277 | { |
274 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 278 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
275 | struct i40e_vsi *vsi = np->vsi; | 279 | struct i40e_vsi *vsi = np->vsi; |
@@ -349,9 +353,15 @@ struct rtnl_link_stats64 *i40e_get_vsi_stats_struct(struct i40e_vsi *vsi) | |||
349 | * Returns the address of the device statistics structure. | 353 | * Returns the address of the device statistics structure. |
350 | * The statistics are actually updated from the service task. | 354 | * The statistics are actually updated from the service task. |
351 | **/ | 355 | **/ |
356 | #ifdef I40E_FCOE | ||
357 | struct rtnl_link_stats64 *i40e_get_netdev_stats_struct( | ||
358 | struct net_device *netdev, | ||
359 | struct rtnl_link_stats64 *stats) | ||
360 | #else | ||
352 | static struct rtnl_link_stats64 *i40e_get_netdev_stats_struct( | 361 | static struct rtnl_link_stats64 *i40e_get_netdev_stats_struct( |
353 | struct net_device *netdev, | 362 | struct net_device *netdev, |
354 | struct rtnl_link_stats64 *stats) | 363 | struct rtnl_link_stats64 *stats) |
364 | #endif | ||
355 | { | 365 | { |
356 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 366 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
357 | struct i40e_ring *tx_ring, *rx_ring; | 367 | struct i40e_ring *tx_ring, *rx_ring; |
@@ -636,6 +646,55 @@ static void i40e_update_veb_stats(struct i40e_veb *veb) | |||
636 | veb->stat_offsets_loaded = true; | 646 | veb->stat_offsets_loaded = true; |
637 | } | 647 | } |
638 | 648 | ||
649 | #ifdef I40E_FCOE | ||
650 | /** | ||
651 | * i40e_update_fcoe_stats - Update FCoE-specific ethernet statistics counters. | ||
652 | * @vsi: the VSI that is capable of doing FCoE | ||
653 | **/ | ||
654 | static void i40e_update_fcoe_stats(struct i40e_vsi *vsi) | ||
655 | { | ||
656 | struct i40e_pf *pf = vsi->back; | ||
657 | struct i40e_hw *hw = &pf->hw; | ||
658 | struct i40e_fcoe_stats *ofs; | ||
659 | struct i40e_fcoe_stats *fs; /* device's eth stats */ | ||
660 | int idx; | ||
661 | |||
662 | if (vsi->type != I40E_VSI_FCOE) | ||
663 | return; | ||
664 | |||
665 | idx = (pf->pf_seid - I40E_BASE_PF_SEID) + I40E_FCOE_PF_STAT_OFFSET; | ||
666 | fs = &vsi->fcoe_stats; | ||
667 | ofs = &vsi->fcoe_stats_offsets; | ||
668 | |||
669 | i40e_stat_update32(hw, I40E_GL_FCOEPRC(idx), | ||
670 | vsi->fcoe_stat_offsets_loaded, | ||
671 | &ofs->rx_fcoe_packets, &fs->rx_fcoe_packets); | ||
672 | i40e_stat_update48(hw, I40E_GL_FCOEDWRCH(idx), I40E_GL_FCOEDWRCL(idx), | ||
673 | vsi->fcoe_stat_offsets_loaded, | ||
674 | &ofs->rx_fcoe_dwords, &fs->rx_fcoe_dwords); | ||
675 | i40e_stat_update32(hw, I40E_GL_FCOERPDC(idx), | ||
676 | vsi->fcoe_stat_offsets_loaded, | ||
677 | &ofs->rx_fcoe_dropped, &fs->rx_fcoe_dropped); | ||
678 | i40e_stat_update32(hw, I40E_GL_FCOEPTC(idx), | ||
679 | vsi->fcoe_stat_offsets_loaded, | ||
680 | &ofs->tx_fcoe_packets, &fs->tx_fcoe_packets); | ||
681 | i40e_stat_update48(hw, I40E_GL_FCOEDWTCH(idx), I40E_GL_FCOEDWTCL(idx), | ||
682 | vsi->fcoe_stat_offsets_loaded, | ||
683 | &ofs->tx_fcoe_dwords, &fs->tx_fcoe_dwords); | ||
684 | i40e_stat_update32(hw, I40E_GL_FCOECRC(idx), | ||
685 | vsi->fcoe_stat_offsets_loaded, | ||
686 | &ofs->fcoe_bad_fccrc, &fs->fcoe_bad_fccrc); | ||
687 | i40e_stat_update32(hw, I40E_GL_FCOELAST(idx), | ||
688 | vsi->fcoe_stat_offsets_loaded, | ||
689 | &ofs->fcoe_last_error, &fs->fcoe_last_error); | ||
690 | i40e_stat_update32(hw, I40E_GL_FCOEDDPC(idx), | ||
691 | vsi->fcoe_stat_offsets_loaded, | ||
692 | &ofs->fcoe_ddp_count, &fs->fcoe_ddp_count); | ||
693 | |||
694 | vsi->fcoe_stat_offsets_loaded = true; | ||
695 | } | ||
696 | |||
697 | #endif | ||
639 | /** | 698 | /** |
640 | * i40e_update_link_xoff_rx - Update XOFF received in link flow control mode | 699 | * i40e_update_link_xoff_rx - Update XOFF received in link flow control mode |
641 | * @pf: the corresponding PF | 700 | * @pf: the corresponding PF |
@@ -1064,6 +1123,9 @@ void i40e_update_stats(struct i40e_vsi *vsi) | |||
1064 | i40e_update_pf_stats(pf); | 1123 | i40e_update_pf_stats(pf); |
1065 | 1124 | ||
1066 | i40e_update_vsi_stats(vsi); | 1125 | i40e_update_vsi_stats(vsi); |
1126 | #ifdef I40E_FCOE | ||
1127 | i40e_update_fcoe_stats(vsi); | ||
1128 | #endif | ||
1067 | } | 1129 | } |
1068 | 1130 | ||
1069 | /** | 1131 | /** |
@@ -1315,7 +1377,11 @@ void i40e_del_filter(struct i40e_vsi *vsi, | |||
1315 | * | 1377 | * |
1316 | * Returns 0 on success, negative on failure | 1378 | * Returns 0 on success, negative on failure |
1317 | **/ | 1379 | **/ |
1380 | #ifdef I40E_FCOE | ||
1381 | int i40e_set_mac(struct net_device *netdev, void *p) | ||
1382 | #else | ||
1318 | static int i40e_set_mac(struct net_device *netdev, void *p) | 1383 | static int i40e_set_mac(struct net_device *netdev, void *p) |
1384 | #endif | ||
1319 | { | 1385 | { |
1320 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 1386 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
1321 | struct i40e_vsi *vsi = np->vsi; | 1387 | struct i40e_vsi *vsi = np->vsi; |
@@ -1376,10 +1442,17 @@ static int i40e_set_mac(struct net_device *netdev, void *p) | |||
1376 | * | 1442 | * |
1377 | * Setup VSI queue mapping for enabled traffic classes. | 1443 | * Setup VSI queue mapping for enabled traffic classes. |
1378 | **/ | 1444 | **/ |
1445 | #ifdef I40E_FCOE | ||
1446 | void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi, | ||
1447 | struct i40e_vsi_context *ctxt, | ||
1448 | u8 enabled_tc, | ||
1449 | bool is_add) | ||
1450 | #else | ||
1379 | static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi, | 1451 | static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi, |
1380 | struct i40e_vsi_context *ctxt, | 1452 | struct i40e_vsi_context *ctxt, |
1381 | u8 enabled_tc, | 1453 | u8 enabled_tc, |
1382 | bool is_add) | 1454 | bool is_add) |
1455 | #endif | ||
1383 | { | 1456 | { |
1384 | struct i40e_pf *pf = vsi->back; | 1457 | struct i40e_pf *pf = vsi->back; |
1385 | u16 sections = 0; | 1458 | u16 sections = 0; |
@@ -1425,6 +1498,11 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi, | |||
1425 | case I40E_VSI_MAIN: | 1498 | case I40E_VSI_MAIN: |
1426 | qcount = min_t(int, pf->rss_size, num_tc_qps); | 1499 | qcount = min_t(int, pf->rss_size, num_tc_qps); |
1427 | break; | 1500 | break; |
1501 | #ifdef I40E_FCOE | ||
1502 | case I40E_VSI_FCOE: | ||
1503 | qcount = num_tc_qps; | ||
1504 | break; | ||
1505 | #endif | ||
1428 | case I40E_VSI_FDIR: | 1506 | case I40E_VSI_FDIR: |
1429 | case I40E_VSI_SRIOV: | 1507 | case I40E_VSI_SRIOV: |
1430 | case I40E_VSI_VMDQ2: | 1508 | case I40E_VSI_VMDQ2: |
@@ -1491,7 +1569,11 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi, | |||
1491 | * i40e_set_rx_mode - NDO callback to set the netdev filters | 1569 | * i40e_set_rx_mode - NDO callback to set the netdev filters |
1492 | * @netdev: network interface device structure | 1570 | * @netdev: network interface device structure |
1493 | **/ | 1571 | **/ |
1572 | #ifdef I40E_FCOE | ||
1573 | void i40e_set_rx_mode(struct net_device *netdev) | ||
1574 | #else | ||
1494 | static void i40e_set_rx_mode(struct net_device *netdev) | 1575 | static void i40e_set_rx_mode(struct net_device *netdev) |
1576 | #endif | ||
1495 | { | 1577 | { |
1496 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 1578 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
1497 | struct i40e_mac_filter *f, *ftmp; | 1579 | struct i40e_mac_filter *f, *ftmp; |
@@ -2069,8 +2151,13 @@ int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid) | |||
2069 | * | 2151 | * |
2070 | * net_device_ops implementation for adding vlan ids | 2152 | * net_device_ops implementation for adding vlan ids |
2071 | **/ | 2153 | **/ |
2154 | #ifdef I40E_FCOE | ||
2155 | int i40e_vlan_rx_add_vid(struct net_device *netdev, | ||
2156 | __always_unused __be16 proto, u16 vid) | ||
2157 | #else | ||
2072 | static int i40e_vlan_rx_add_vid(struct net_device *netdev, | 2158 | static int i40e_vlan_rx_add_vid(struct net_device *netdev, |
2073 | __always_unused __be16 proto, u16 vid) | 2159 | __always_unused __be16 proto, u16 vid) |
2160 | #endif | ||
2074 | { | 2161 | { |
2075 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 2162 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
2076 | struct i40e_vsi *vsi = np->vsi; | 2163 | struct i40e_vsi *vsi = np->vsi; |
@@ -2103,8 +2190,13 @@ static int i40e_vlan_rx_add_vid(struct net_device *netdev, | |||
2103 | * | 2190 | * |
2104 | * net_device_ops implementation for removing vlan ids | 2191 | * net_device_ops implementation for removing vlan ids |
2105 | **/ | 2192 | **/ |
2193 | #ifdef I40E_FCOE | ||
2194 | int i40e_vlan_rx_kill_vid(struct net_device *netdev, | ||
2195 | __always_unused __be16 proto, u16 vid) | ||
2196 | #else | ||
2106 | static int i40e_vlan_rx_kill_vid(struct net_device *netdev, | 2197 | static int i40e_vlan_rx_kill_vid(struct net_device *netdev, |
2107 | __always_unused __be16 proto, u16 vid) | 2198 | __always_unused __be16 proto, u16 vid) |
2199 | #endif | ||
2108 | { | 2200 | { |
2109 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 2201 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
2110 | struct i40e_vsi *vsi = np->vsi; | 2202 | struct i40e_vsi *vsi = np->vsi; |
@@ -2236,6 +2328,9 @@ static int i40e_vsi_setup_rx_resources(struct i40e_vsi *vsi) | |||
2236 | 2328 | ||
2237 | for (i = 0; i < vsi->num_queue_pairs && !err; i++) | 2329 | for (i = 0; i < vsi->num_queue_pairs && !err; i++) |
2238 | err = i40e_setup_rx_descriptors(vsi->rx_rings[i]); | 2330 | err = i40e_setup_rx_descriptors(vsi->rx_rings[i]); |
2331 | #ifdef I40E_FCOE | ||
2332 | i40e_fcoe_setup_ddp_resources(vsi); | ||
2333 | #endif | ||
2239 | return err; | 2334 | return err; |
2240 | } | 2335 | } |
2241 | 2336 | ||
@@ -2255,6 +2350,9 @@ static void i40e_vsi_free_rx_resources(struct i40e_vsi *vsi) | |||
2255 | for (i = 0; i < vsi->num_queue_pairs; i++) | 2350 | for (i = 0; i < vsi->num_queue_pairs; i++) |
2256 | if (vsi->rx_rings[i] && vsi->rx_rings[i]->desc) | 2351 | if (vsi->rx_rings[i] && vsi->rx_rings[i]->desc) |
2257 | i40e_free_rx_resources(vsi->rx_rings[i]); | 2352 | i40e_free_rx_resources(vsi->rx_rings[i]); |
2353 | #ifdef I40E_FCOE | ||
2354 | i40e_fcoe_free_ddp_resources(vsi); | ||
2355 | #endif | ||
2258 | } | 2356 | } |
2259 | 2357 | ||
2260 | /** | 2358 | /** |
@@ -2296,6 +2394,9 @@ static int i40e_configure_tx_ring(struct i40e_ring *ring) | |||
2296 | tx_ctx.qlen = ring->count; | 2394 | tx_ctx.qlen = ring->count; |
2297 | tx_ctx.fd_ena = !!(vsi->back->flags & (I40E_FLAG_FD_SB_ENABLED | | 2395 | tx_ctx.fd_ena = !!(vsi->back->flags & (I40E_FLAG_FD_SB_ENABLED | |
2298 | I40E_FLAG_FD_ATR_ENABLED)); | 2396 | I40E_FLAG_FD_ATR_ENABLED)); |
2397 | #ifdef I40E_FCOE | ||
2398 | tx_ctx.fc_ena = (vsi->type == I40E_VSI_FCOE); | ||
2399 | #endif | ||
2299 | tx_ctx.timesync_ena = !!(vsi->back->flags & I40E_FLAG_PTP); | 2400 | tx_ctx.timesync_ena = !!(vsi->back->flags & I40E_FLAG_PTP); |
2300 | /* FDIR VSI tx ring can still use RS bit and writebacks */ | 2401 | /* FDIR VSI tx ring can still use RS bit and writebacks */ |
2301 | if (vsi->type != I40E_VSI_FDIR) | 2402 | if (vsi->type != I40E_VSI_FDIR) |
@@ -2408,6 +2509,9 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring) | |||
2408 | rx_ctx.crcstrip = 1; | 2509 | rx_ctx.crcstrip = 1; |
2409 | rx_ctx.l2tsel = 1; | 2510 | rx_ctx.l2tsel = 1; |
2410 | rx_ctx.showiv = 1; | 2511 | rx_ctx.showiv = 1; |
2512 | #ifdef I40E_FCOE | ||
2513 | rx_ctx.fc_ena = (vsi->type == I40E_VSI_FCOE); | ||
2514 | #endif | ||
2411 | /* set the prefena field to 1 because the manual says to */ | 2515 | /* set the prefena field to 1 because the manual says to */ |
2412 | rx_ctx.prefena = 1; | 2516 | rx_ctx.prefena = 1; |
2413 | 2517 | ||
@@ -2492,6 +2596,17 @@ static int i40e_vsi_configure_rx(struct i40e_vsi *vsi) | |||
2492 | break; | 2596 | break; |
2493 | } | 2597 | } |
2494 | 2598 | ||
2599 | #ifdef I40E_FCOE | ||
2600 | /* setup rx buffer for FCoE */ | ||
2601 | if ((vsi->type == I40E_VSI_FCOE) && | ||
2602 | (vsi->back->flags & I40E_FLAG_FCOE_ENABLED)) { | ||
2603 | vsi->rx_hdr_len = 0; | ||
2604 | vsi->rx_buf_len = I40E_RXBUFFER_3072; | ||
2605 | vsi->max_frame = I40E_RXBUFFER_3072; | ||
2606 | vsi->dtype = I40E_RX_DTYPE_NO_SPLIT; | ||
2607 | } | ||
2608 | |||
2609 | #endif /* I40E_FCOE */ | ||
2495 | /* round up for the chip's needs */ | 2610 | /* round up for the chip's needs */ |
2496 | vsi->rx_hdr_len = ALIGN(vsi->rx_hdr_len, | 2611 | vsi->rx_hdr_len = ALIGN(vsi->rx_hdr_len, |
2497 | (1 << I40E_RXQ_CTX_HBUFF_SHIFT)); | 2612 | (1 << I40E_RXQ_CTX_HBUFF_SHIFT)); |
@@ -3252,7 +3367,11 @@ static int i40e_vsi_request_irq(struct i40e_vsi *vsi, char *basename) | |||
3252 | * This is used by netconsole to send skbs without having to re-enable | 3367 | * This is used by netconsole to send skbs without having to re-enable |
3253 | * interrupts. It's not called while the normal interrupt routine is executing. | 3368 | * interrupts. It's not called while the normal interrupt routine is executing. |
3254 | **/ | 3369 | **/ |
3370 | #ifdef I40E_FCOE | ||
3371 | void i40e_netpoll(struct net_device *netdev) | ||
3372 | #else | ||
3255 | static void i40e_netpoll(struct net_device *netdev) | 3373 | static void i40e_netpoll(struct net_device *netdev) |
3374 | #endif | ||
3256 | { | 3375 | { |
3257 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 3376 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
3258 | struct i40e_vsi *vsi = np->vsi; | 3377 | struct i40e_vsi *vsi = np->vsi; |
@@ -4202,12 +4321,20 @@ static void i40e_dcb_reconfigure(struct i40e_pf *pf) | |||
4202 | continue; | 4321 | continue; |
4203 | 4322 | ||
4204 | /* - Enable all TCs for the LAN VSI | 4323 | /* - Enable all TCs for the LAN VSI |
4324 | #ifdef I40E_FCOE | ||
4325 | * - For FCoE VSI only enable the TC configured | ||
4326 | * as per the APP TLV | ||
4327 | #endif | ||
4205 | * - For all others keep them at TC0 for now | 4328 | * - For all others keep them at TC0 for now |
4206 | */ | 4329 | */ |
4207 | if (v == pf->lan_vsi) | 4330 | if (v == pf->lan_vsi) |
4208 | tc_map = i40e_pf_get_tc_map(pf); | 4331 | tc_map = i40e_pf_get_tc_map(pf); |
4209 | else | 4332 | else |
4210 | tc_map = i40e_pf_get_default_tc(pf); | 4333 | tc_map = i40e_pf_get_default_tc(pf); |
4334 | #ifdef I40E_FCOE | ||
4335 | if (pf->vsi[v]->type == I40E_VSI_FCOE) | ||
4336 | tc_map = i40e_get_fcoe_tc_map(pf); | ||
4337 | #endif /* #ifdef I40E_FCOE */ | ||
4211 | 4338 | ||
4212 | ret = i40e_vsi_config_tc(pf->vsi[v], tc_map); | 4339 | ret = i40e_vsi_config_tc(pf->vsi[v], tc_map); |
4213 | if (ret) { | 4340 | if (ret) { |
@@ -4434,7 +4561,11 @@ void i40e_down(struct i40e_vsi *vsi) | |||
4434 | * @netdev: net device to configure | 4561 | * @netdev: net device to configure |
4435 | * @tc: number of traffic classes to enable | 4562 | * @tc: number of traffic classes to enable |
4436 | **/ | 4563 | **/ |
4564 | #ifdef I40E_FCOE | ||
4565 | int i40e_setup_tc(struct net_device *netdev, u8 tc) | ||
4566 | #else | ||
4437 | static int i40e_setup_tc(struct net_device *netdev, u8 tc) | 4567 | static int i40e_setup_tc(struct net_device *netdev, u8 tc) |
4568 | #endif | ||
4438 | { | 4569 | { |
4439 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 4570 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
4440 | struct i40e_vsi *vsi = np->vsi; | 4571 | struct i40e_vsi *vsi = np->vsi; |
@@ -4499,7 +4630,11 @@ exit: | |||
4499 | * | 4630 | * |
4500 | * Returns 0 on success, negative value on failure | 4631 | * Returns 0 on success, negative value on failure |
4501 | **/ | 4632 | **/ |
4633 | #ifdef I40E_FCOE | ||
4634 | int i40e_open(struct net_device *netdev) | ||
4635 | #else | ||
4502 | static int i40e_open(struct net_device *netdev) | 4636 | static int i40e_open(struct net_device *netdev) |
4637 | #endif | ||
4503 | { | 4638 | { |
4504 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 4639 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
4505 | struct i40e_vsi *vsi = np->vsi; | 4640 | struct i40e_vsi *vsi = np->vsi; |
@@ -4635,7 +4770,11 @@ static void i40e_fdir_filter_exit(struct i40e_pf *pf) | |||
4635 | * | 4770 | * |
4636 | * Returns 0, this is not allowed to fail | 4771 | * Returns 0, this is not allowed to fail |
4637 | **/ | 4772 | **/ |
4773 | #ifdef I40E_FCOE | ||
4774 | int i40e_close(struct net_device *netdev) | ||
4775 | #else | ||
4638 | static int i40e_close(struct net_device *netdev) | 4776 | static int i40e_close(struct net_device *netdev) |
4777 | #endif | ||
4639 | { | 4778 | { |
4640 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 4779 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
4641 | struct i40e_vsi *vsi = np->vsi; | 4780 | struct i40e_vsi *vsi = np->vsi; |
@@ -5050,6 +5189,9 @@ static void i40e_vsi_link_event(struct i40e_vsi *vsi, bool link_up) | |||
5050 | 5189 | ||
5051 | switch (vsi->type) { | 5190 | switch (vsi->type) { |
5052 | case I40E_VSI_MAIN: | 5191 | case I40E_VSI_MAIN: |
5192 | #ifdef I40E_FCOE | ||
5193 | case I40E_VSI_FCOE: | ||
5194 | #endif | ||
5053 | if (!vsi->netdev || !vsi->netdev_registered) | 5195 | if (!vsi->netdev || !vsi->netdev_registered) |
5054 | break; | 5196 | break; |
5055 | 5197 | ||
@@ -5768,7 +5910,12 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit) | |||
5768 | goto end_core_reset; | 5910 | goto end_core_reset; |
5769 | } | 5911 | } |
5770 | #endif /* CONFIG_I40E_DCB */ | 5912 | #endif /* CONFIG_I40E_DCB */ |
5913 | #ifdef I40E_FCOE | ||
5914 | ret = i40e_init_pf_fcoe(pf); | ||
5915 | if (ret) | ||
5916 | dev_info(&pf->pdev->dev, "init_pf_fcoe failed: %d\n", ret); | ||
5771 | 5917 | ||
5918 | #endif | ||
5772 | /* do basic switch setup */ | 5919 | /* do basic switch setup */ |
5773 | ret = i40e_setup_pf_switch(pf, reinit); | 5920 | ret = i40e_setup_pf_switch(pf, reinit); |
5774 | if (ret) | 5921 | if (ret) |
@@ -6107,6 +6254,15 @@ static int i40e_set_num_rings_in_vsi(struct i40e_vsi *vsi) | |||
6107 | I40E_REQ_DESCRIPTOR_MULTIPLE); | 6254 | I40E_REQ_DESCRIPTOR_MULTIPLE); |
6108 | break; | 6255 | break; |
6109 | 6256 | ||
6257 | #ifdef I40E_FCOE | ||
6258 | case I40E_VSI_FCOE: | ||
6259 | vsi->alloc_queue_pairs = pf->num_fcoe_qps; | ||
6260 | vsi->num_desc = ALIGN(I40E_DEFAULT_NUM_DESCRIPTORS, | ||
6261 | I40E_REQ_DESCRIPTOR_MULTIPLE); | ||
6262 | vsi->num_q_vectors = pf->num_fcoe_msix; | ||
6263 | break; | ||
6264 | |||
6265 | #endif /* I40E_FCOE */ | ||
6110 | default: | 6266 | default: |
6111 | WARN_ON(1); | 6267 | WARN_ON(1); |
6112 | return -ENODATA; | 6268 | return -ENODATA; |
@@ -6418,6 +6574,9 @@ static int i40e_init_msix(struct i40e_pf *pf) | |||
6418 | * is governed by number of cpus in the system. | 6574 | * is governed by number of cpus in the system. |
6419 | * - assumes symmetric Tx/Rx pairing | 6575 | * - assumes symmetric Tx/Rx pairing |
6420 | * - The number of VMDq pairs | 6576 | * - The number of VMDq pairs |
6577 | #ifdef I40E_FCOE | ||
6578 | * - The number of FCOE qps. | ||
6579 | #endif | ||
6421 | * Once we count this up, try the request. | 6580 | * Once we count this up, try the request. |
6422 | * | 6581 | * |
6423 | * If we can't get what we want, we'll simplify to nearly nothing | 6582 | * If we can't get what we want, we'll simplify to nearly nothing |
@@ -6430,6 +6589,13 @@ static int i40e_init_msix(struct i40e_pf *pf) | |||
6430 | if (pf->flags & I40E_FLAG_FD_SB_ENABLED) | 6589 | if (pf->flags & I40E_FLAG_FD_SB_ENABLED) |
6431 | v_budget++; | 6590 | v_budget++; |
6432 | 6591 | ||
6592 | #ifdef I40E_FCOE | ||
6593 | if (pf->flags & I40E_FLAG_FCOE_ENABLED) { | ||
6594 | pf->num_fcoe_msix = pf->num_fcoe_qps; | ||
6595 | v_budget += pf->num_fcoe_msix; | ||
6596 | } | ||
6597 | |||
6598 | #endif | ||
6433 | /* Scale down if necessary, and the rings will share vectors */ | 6599 | /* Scale down if necessary, and the rings will share vectors */ |
6434 | v_budget = min_t(int, v_budget, hw->func_caps.num_msix_vectors); | 6600 | v_budget = min_t(int, v_budget, hw->func_caps.num_msix_vectors); |
6435 | 6601 | ||
@@ -6448,6 +6614,10 @@ static int i40e_init_msix(struct i40e_pf *pf) | |||
6448 | * of these features based on the policy and at the end disable | 6614 | * of these features based on the policy and at the end disable |
6449 | * the features that did not get any vectors. | 6615 | * the features that did not get any vectors. |
6450 | */ | 6616 | */ |
6617 | #ifdef I40E_FCOE | ||
6618 | pf->num_fcoe_qps = 0; | ||
6619 | pf->num_fcoe_msix = 0; | ||
6620 | #endif | ||
6451 | pf->num_vmdq_msix = 0; | 6621 | pf->num_vmdq_msix = 0; |
6452 | } | 6622 | } |
6453 | 6623 | ||
@@ -6478,9 +6648,24 @@ static int i40e_init_msix(struct i40e_pf *pf) | |||
6478 | pf->num_lan_msix = 1; | 6648 | pf->num_lan_msix = 1; |
6479 | break; | 6649 | break; |
6480 | case 3: | 6650 | case 3: |
6651 | #ifdef I40E_FCOE | ||
6652 | /* give one vector to FCoE */ | ||
6653 | if (pf->flags & I40E_FLAG_FCOE_ENABLED) { | ||
6654 | pf->num_lan_msix = 1; | ||
6655 | pf->num_fcoe_msix = 1; | ||
6656 | } | ||
6657 | #else | ||
6481 | pf->num_lan_msix = 2; | 6658 | pf->num_lan_msix = 2; |
6659 | #endif | ||
6482 | break; | 6660 | break; |
6483 | default: | 6661 | default: |
6662 | #ifdef I40E_FCOE | ||
6663 | /* give one vector to FCoE */ | ||
6664 | if (pf->flags & I40E_FLAG_FCOE_ENABLED) { | ||
6665 | pf->num_fcoe_msix = 1; | ||
6666 | vec--; | ||
6667 | } | ||
6668 | #endif | ||
6484 | pf->num_lan_msix = min_t(int, (vec / 2), | 6669 | pf->num_lan_msix = min_t(int, (vec / 2), |
6485 | pf->num_lan_qps); | 6670 | pf->num_lan_qps); |
6486 | pf->num_vmdq_vsis = min_t(int, (vec - pf->num_lan_msix), | 6671 | pf->num_vmdq_vsis = min_t(int, (vec - pf->num_lan_msix), |
@@ -6494,6 +6679,13 @@ static int i40e_init_msix(struct i40e_pf *pf) | |||
6494 | dev_info(&pf->pdev->dev, "VMDq disabled, not enough MSI-X vectors\n"); | 6679 | dev_info(&pf->pdev->dev, "VMDq disabled, not enough MSI-X vectors\n"); |
6495 | pf->flags &= ~I40E_FLAG_VMDQ_ENABLED; | 6680 | pf->flags &= ~I40E_FLAG_VMDQ_ENABLED; |
6496 | } | 6681 | } |
6682 | #ifdef I40E_FCOE | ||
6683 | |||
6684 | if ((pf->flags & I40E_FLAG_FCOE_ENABLED) && (pf->num_fcoe_msix == 0)) { | ||
6685 | dev_info(&pf->pdev->dev, "FCOE disabled, not enough MSI-X vectors\n"); | ||
6686 | pf->flags &= ~I40E_FLAG_FCOE_ENABLED; | ||
6687 | } | ||
6688 | #endif | ||
6497 | return err; | 6689 | return err; |
6498 | } | 6690 | } |
6499 | 6691 | ||
@@ -6577,6 +6769,9 @@ static void i40e_init_interrupt_scheme(struct i40e_pf *pf) | |||
6577 | err = i40e_init_msix(pf); | 6769 | err = i40e_init_msix(pf); |
6578 | if (err) { | 6770 | if (err) { |
6579 | pf->flags &= ~(I40E_FLAG_MSIX_ENABLED | | 6771 | pf->flags &= ~(I40E_FLAG_MSIX_ENABLED | |
6772 | #ifdef I40E_FCOE | ||
6773 | I40E_FLAG_FCOE_ENABLED | | ||
6774 | #endif | ||
6580 | I40E_FLAG_RSS_ENABLED | | 6775 | I40E_FLAG_RSS_ENABLED | |
6581 | I40E_FLAG_DCB_CAPABLE | | 6776 | I40E_FLAG_DCB_CAPABLE | |
6582 | I40E_FLAG_SRIOV_ENABLED | | 6777 | I40E_FLAG_SRIOV_ENABLED | |
@@ -6814,6 +7009,12 @@ static int i40e_sw_init(struct i40e_pf *pf) | |||
6814 | pf->num_vmdq_qps = I40E_DEFAULT_QUEUES_PER_VMDQ; | 7009 | pf->num_vmdq_qps = I40E_DEFAULT_QUEUES_PER_VMDQ; |
6815 | } | 7010 | } |
6816 | 7011 | ||
7012 | #ifdef I40E_FCOE | ||
7013 | err = i40e_init_pf_fcoe(pf); | ||
7014 | if (err) | ||
7015 | dev_info(&pf->pdev->dev, "init_pf_fcoe failed: %d\n", err); | ||
7016 | |||
7017 | #endif /* I40E_FCOE */ | ||
6817 | #ifdef CONFIG_PCI_IOV | 7018 | #ifdef CONFIG_PCI_IOV |
6818 | if (pf->hw.func_caps.num_vfs) { | 7019 | if (pf->hw.func_caps.num_vfs) { |
6819 | pf->num_vf_qps = I40E_DEFAULT_QUEUES_PER_VF; | 7020 | pf->num_vf_qps = I40E_DEFAULT_QUEUES_PER_VF; |
@@ -7141,6 +7342,10 @@ static const struct net_device_ops i40e_netdev_ops = { | |||
7141 | .ndo_poll_controller = i40e_netpoll, | 7342 | .ndo_poll_controller = i40e_netpoll, |
7142 | #endif | 7343 | #endif |
7143 | .ndo_setup_tc = i40e_setup_tc, | 7344 | .ndo_setup_tc = i40e_setup_tc, |
7345 | #ifdef I40E_FCOE | ||
7346 | .ndo_fcoe_enable = i40e_fcoe_enable, | ||
7347 | .ndo_fcoe_disable = i40e_fcoe_disable, | ||
7348 | #endif | ||
7144 | .ndo_set_features = i40e_set_features, | 7349 | .ndo_set_features = i40e_set_features, |
7145 | .ndo_set_vf_mac = i40e_ndo_set_vf_mac, | 7350 | .ndo_set_vf_mac = i40e_ndo_set_vf_mac, |
7146 | .ndo_set_vf_vlan = i40e_ndo_set_vf_port_vlan, | 7351 | .ndo_set_vf_vlan = i40e_ndo_set_vf_port_vlan, |
@@ -7249,6 +7454,9 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) | |||
7249 | netdev->netdev_ops = &i40e_netdev_ops; | 7454 | netdev->netdev_ops = &i40e_netdev_ops; |
7250 | netdev->watchdog_timeo = 5 * HZ; | 7455 | netdev->watchdog_timeo = 5 * HZ; |
7251 | i40e_set_ethtool_ops(netdev); | 7456 | i40e_set_ethtool_ops(netdev); |
7457 | #ifdef I40E_FCOE | ||
7458 | i40e_fcoe_config_netdev(netdev, vsi); | ||
7459 | #endif | ||
7252 | 7460 | ||
7253 | return 0; | 7461 | return 0; |
7254 | } | 7462 | } |
@@ -7402,6 +7610,16 @@ static int i40e_add_vsi(struct i40e_vsi *vsi) | |||
7402 | i40e_vsi_setup_queue_map(vsi, &ctxt, enabled_tc, true); | 7610 | i40e_vsi_setup_queue_map(vsi, &ctxt, enabled_tc, true); |
7403 | break; | 7611 | break; |
7404 | 7612 | ||
7613 | #ifdef I40E_FCOE | ||
7614 | case I40E_VSI_FCOE: | ||
7615 | ret = i40e_fcoe_vsi_init(vsi, &ctxt); | ||
7616 | if (ret) { | ||
7617 | dev_info(&pf->pdev->dev, "failed to initialize FCoE VSI\n"); | ||
7618 | return ret; | ||
7619 | } | ||
7620 | break; | ||
7621 | |||
7622 | #endif /* I40E_FCOE */ | ||
7405 | default: | 7623 | default: |
7406 | return -ENODEV; | 7624 | return -ENODEV; |
7407 | } | 7625 | } |
@@ -7760,6 +7978,7 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type, | |||
7760 | /* setup the netdev if needed */ | 7978 | /* setup the netdev if needed */ |
7761 | case I40E_VSI_MAIN: | 7979 | case I40E_VSI_MAIN: |
7762 | case I40E_VSI_VMDQ2: | 7980 | case I40E_VSI_VMDQ2: |
7981 | case I40E_VSI_FCOE: | ||
7763 | ret = i40e_config_netdev(vsi); | 7982 | ret = i40e_config_netdev(vsi); |
7764 | if (ret) | 7983 | if (ret) |
7765 | goto err_netdev; | 7984 | goto err_netdev; |
@@ -8378,6 +8597,9 @@ static void i40e_determine_queue_usage(struct i40e_pf *pf) | |||
8378 | int queues_left; | 8597 | int queues_left; |
8379 | 8598 | ||
8380 | pf->num_lan_qps = 0; | 8599 | pf->num_lan_qps = 0; |
8600 | #ifdef I40E_FCOE | ||
8601 | pf->num_fcoe_qps = 0; | ||
8602 | #endif | ||
8381 | 8603 | ||
8382 | /* Find the max queues to be put into basic use. We'll always be | 8604 | /* Find the max queues to be put into basic use. We'll always be |
8383 | * using TC0, whether or not DCB is running, and TC0 will get the | 8605 | * using TC0, whether or not DCB is running, and TC0 will get the |
@@ -8393,6 +8615,9 @@ static void i40e_determine_queue_usage(struct i40e_pf *pf) | |||
8393 | 8615 | ||
8394 | /* make sure all the fancies are disabled */ | 8616 | /* make sure all the fancies are disabled */ |
8395 | pf->flags &= ~(I40E_FLAG_RSS_ENABLED | | 8617 | pf->flags &= ~(I40E_FLAG_RSS_ENABLED | |
8618 | #ifdef I40E_FCOE | ||
8619 | I40E_FLAG_FCOE_ENABLED | | ||
8620 | #endif | ||
8396 | I40E_FLAG_FD_SB_ENABLED | | 8621 | I40E_FLAG_FD_SB_ENABLED | |
8397 | I40E_FLAG_FD_ATR_ENABLED | | 8622 | I40E_FLAG_FD_ATR_ENABLED | |
8398 | I40E_FLAG_DCB_CAPABLE | | 8623 | I40E_FLAG_DCB_CAPABLE | |
@@ -8407,6 +8632,9 @@ static void i40e_determine_queue_usage(struct i40e_pf *pf) | |||
8407 | queues_left -= pf->num_lan_qps; | 8632 | queues_left -= pf->num_lan_qps; |
8408 | 8633 | ||
8409 | pf->flags &= ~(I40E_FLAG_RSS_ENABLED | | 8634 | pf->flags &= ~(I40E_FLAG_RSS_ENABLED | |
8635 | #ifdef I40E_FCOE | ||
8636 | I40E_FLAG_FCOE_ENABLED | | ||
8637 | #endif | ||
8410 | I40E_FLAG_FD_SB_ENABLED | | 8638 | I40E_FLAG_FD_SB_ENABLED | |
8411 | I40E_FLAG_FD_ATR_ENABLED | | 8639 | I40E_FLAG_FD_ATR_ENABLED | |
8412 | I40E_FLAG_DCB_ENABLED | | 8640 | I40E_FLAG_DCB_ENABLED | |
@@ -8422,6 +8650,22 @@ static void i40e_determine_queue_usage(struct i40e_pf *pf) | |||
8422 | queues_left -= pf->num_lan_qps; | 8650 | queues_left -= pf->num_lan_qps; |
8423 | } | 8651 | } |
8424 | 8652 | ||
8653 | #ifdef I40E_FCOE | ||
8654 | if (pf->flags & I40E_FLAG_FCOE_ENABLED) { | ||
8655 | if (I40E_DEFAULT_FCOE <= queues_left) { | ||
8656 | pf->num_fcoe_qps = I40E_DEFAULT_FCOE; | ||
8657 | } else if (I40E_MINIMUM_FCOE <= queues_left) { | ||
8658 | pf->num_fcoe_qps = I40E_MINIMUM_FCOE; | ||
8659 | } else { | ||
8660 | pf->num_fcoe_qps = 0; | ||
8661 | pf->flags &= ~I40E_FLAG_FCOE_ENABLED; | ||
8662 | dev_info(&pf->pdev->dev, "not enough queues for FCoE. FCoE feature will be disabled\n"); | ||
8663 | } | ||
8664 | |||
8665 | queues_left -= pf->num_fcoe_qps; | ||
8666 | } | ||
8667 | |||
8668 | #endif | ||
8425 | if (pf->flags & I40E_FLAG_FD_SB_ENABLED) { | 8669 | if (pf->flags & I40E_FLAG_FD_SB_ENABLED) { |
8426 | if (queues_left > 1) { | 8670 | if (queues_left > 1) { |
8427 | queues_left -= 1; /* save 1 queue for FD */ | 8671 | queues_left -= 1; /* save 1 queue for FD */ |
@@ -8446,6 +8690,9 @@ static void i40e_determine_queue_usage(struct i40e_pf *pf) | |||
8446 | } | 8690 | } |
8447 | 8691 | ||
8448 | pf->queues_left = queues_left; | 8692 | pf->queues_left = queues_left; |
8693 | #ifdef I40E_FCOE | ||
8694 | dev_info(&pf->pdev->dev, "fcoe queues = %d\n", pf->num_fcoe_qps); | ||
8695 | #endif | ||
8449 | } | 8696 | } |
8450 | 8697 | ||
8451 | /** | 8698 | /** |
@@ -8512,6 +8759,10 @@ static void i40e_print_features(struct i40e_pf *pf) | |||
8512 | buf += sprintf(buf, "DCB "); | 8759 | buf += sprintf(buf, "DCB "); |
8513 | if (pf->flags & I40E_FLAG_PTP) | 8760 | if (pf->flags & I40E_FLAG_PTP) |
8514 | buf += sprintf(buf, "PTP "); | 8761 | buf += sprintf(buf, "PTP "); |
8762 | #ifdef I40E_FCOE | ||
8763 | if (pf->flags & I40E_FLAG_FCOE_ENABLED) | ||
8764 | buf += sprintf(buf, "FCOE "); | ||
8765 | #endif | ||
8515 | 8766 | ||
8516 | BUG_ON(buf > (string + INFO_STRING_LEN)); | 8767 | BUG_ON(buf > (string + INFO_STRING_LEN)); |
8517 | dev_info(&pf->pdev->dev, "%s\n", string); | 8768 | dev_info(&pf->pdev->dev, "%s\n", string); |
@@ -8699,6 +8950,18 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
8699 | i40e_get_port_mac_addr(hw, hw->mac.port_addr); | 8950 | i40e_get_port_mac_addr(hw, hw->mac.port_addr); |
8700 | if (is_valid_ether_addr(hw->mac.port_addr)) | 8951 | if (is_valid_ether_addr(hw->mac.port_addr)) |
8701 | pf->flags |= I40E_FLAG_PORT_ID_VALID; | 8952 | pf->flags |= I40E_FLAG_PORT_ID_VALID; |
8953 | #ifdef I40E_FCOE | ||
8954 | err = i40e_get_san_mac_addr(hw, hw->mac.san_addr); | ||
8955 | if (err) | ||
8956 | dev_info(&pdev->dev, | ||
8957 | "(non-fatal) SAN MAC retrieval failed: %d\n", err); | ||
8958 | if (!is_valid_ether_addr(hw->mac.san_addr)) { | ||
8959 | dev_warn(&pdev->dev, "invalid SAN MAC address %pM, falling back to LAN MAC\n", | ||
8960 | hw->mac.san_addr); | ||
8961 | ether_addr_copy(hw->mac.san_addr, hw->mac.addr); | ||
8962 | } | ||
8963 | dev_info(&pf->pdev->dev, "SAN MAC: %pM\n", hw->mac.san_addr); | ||
8964 | #endif /* I40E_FCOE */ | ||
8702 | 8965 | ||
8703 | pci_set_drvdata(pdev, pf); | 8966 | pci_set_drvdata(pdev, pf); |
8704 | pci_save_state(pdev); | 8967 | pci_save_state(pdev); |
@@ -8815,6 +9078,11 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
8815 | mod_timer(&pf->service_timer, | 9078 | mod_timer(&pf->service_timer, |
8816 | round_jiffies(jiffies + pf->service_timer_period)); | 9079 | round_jiffies(jiffies + pf->service_timer_period)); |
8817 | 9080 | ||
9081 | #ifdef I40E_FCOE | ||
9082 | /* create FCoE interface */ | ||
9083 | i40e_fcoe_vsi_setup(pf); | ||
9084 | |||
9085 | #endif | ||
8818 | /* Get the negotiated link width and speed from PCI config space */ | 9086 | /* Get the negotiated link width and speed from PCI config space */ |
8819 | pcie_capability_read_word(pf->pdev, PCI_EXP_LNKSTA, &link_status); | 9087 | pcie_capability_read_word(pf->pdev, PCI_EXP_LNKSTA, &link_status); |
8820 | 9088 | ||
diff --git a/drivers/net/ethernet/intel/i40e/i40e_osdep.h b/drivers/net/ethernet/intel/i40e/i40e_osdep.h index ecd0f0b663c9..045b5c4b98b3 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_osdep.h +++ b/drivers/net/ethernet/intel/i40e/i40e_osdep.h | |||
@@ -78,4 +78,7 @@ do { \ | |||
78 | } while (0) | 78 | } while (0) |
79 | 79 | ||
80 | typedef enum i40e_status_code i40e_status; | 80 | typedef enum i40e_status_code i40e_status; |
81 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) | ||
82 | #define I40E_FCOE | ||
83 | #endif /* CONFIG_FCOE or CONFIG_FCOE_MODULE */ | ||
81 | #endif /* _I40E_OSDEP_H_ */ | 84 | #endif /* _I40E_OSDEP_H_ */ |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_prototype.h b/drivers/net/ethernet/intel/i40e/i40e_prototype.h index a91d7e1a5b5b..8cd4390a2842 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_prototype.h +++ b/drivers/net/ethernet/intel/i40e/i40e_prototype.h | |||
@@ -237,6 +237,9 @@ i40e_status i40e_get_mac_addr(struct i40e_hw *hw, u8 *mac_addr); | |||
237 | i40e_status i40e_get_port_mac_addr(struct i40e_hw *hw, u8 *mac_addr); | 237 | i40e_status i40e_get_port_mac_addr(struct i40e_hw *hw, u8 *mac_addr); |
238 | i40e_status i40e_validate_mac_addr(u8 *mac_addr); | 238 | i40e_status i40e_validate_mac_addr(u8 *mac_addr); |
239 | void i40e_pre_tx_queue_cfg(struct i40e_hw *hw, u32 queue, bool enable); | 239 | void i40e_pre_tx_queue_cfg(struct i40e_hw *hw, u32 queue, bool enable); |
240 | #ifdef I40E_FCOE | ||
241 | i40e_status i40e_get_san_mac_addr(struct i40e_hw *hw, u8 *mac_addr); | ||
242 | #endif | ||
240 | /* prototype for functions used for NVM access */ | 243 | /* prototype for functions used for NVM access */ |
241 | i40e_status i40e_init_nvm(struct i40e_hw *hw); | 244 | i40e_status i40e_init_nvm(struct i40e_hw *hw); |
242 | i40e_status i40e_acquire_nvm(struct i40e_hw *hw, | 245 | i40e_status i40e_acquire_nvm(struct i40e_hw *hw, |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index d26d6836689d..a51aa37b7b5a 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c | |||
@@ -896,6 +896,11 @@ static void i40e_clean_programming_status(struct i40e_ring *rx_ring, | |||
896 | 896 | ||
897 | if (id == I40E_RX_PROG_STATUS_DESC_FD_FILTER_STATUS) | 897 | if (id == I40E_RX_PROG_STATUS_DESC_FD_FILTER_STATUS) |
898 | i40e_fd_handle_status(rx_ring, rx_desc, id); | 898 | i40e_fd_handle_status(rx_ring, rx_desc, id); |
899 | #ifdef I40E_FCOE | ||
900 | else if ((id == I40E_RX_PROG_STATUS_DESC_FCOE_CTXT_PROG_STATUS) || | ||
901 | (id == I40E_RX_PROG_STATUS_DESC_FCOE_CTXT_INVL_STATUS)) | ||
902 | i40e_fcoe_handle_status(rx_ring, rx_desc, id); | ||
903 | #endif | ||
899 | } | 904 | } |
900 | 905 | ||
901 | /** | 906 | /** |
@@ -1489,6 +1494,12 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) | |||
1489 | vlan_tag = rx_status & (1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT) | 1494 | vlan_tag = rx_status & (1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT) |
1490 | ? le16_to_cpu(rx_desc->wb.qword0.lo_dword.l2tag1) | 1495 | ? le16_to_cpu(rx_desc->wb.qword0.lo_dword.l2tag1) |
1491 | : 0; | 1496 | : 0; |
1497 | #ifdef I40E_FCOE | ||
1498 | if (!i40e_fcoe_handle_offload(rx_ring, rx_desc, skb)) { | ||
1499 | dev_kfree_skb_any(skb); | ||
1500 | goto next_desc; | ||
1501 | } | ||
1502 | #endif | ||
1492 | i40e_receive_skb(rx_ring, skb, vlan_tag); | 1503 | i40e_receive_skb(rx_ring, skb, vlan_tag); |
1493 | 1504 | ||
1494 | rx_ring->netdev->last_rx = jiffies; | 1505 | rx_ring->netdev->last_rx = jiffies; |
@@ -1719,9 +1730,15 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb, | |||
1719 | * Returns error code indicate the frame should be dropped upon error and the | 1730 | * Returns error code indicate the frame should be dropped upon error and the |
1720 | * otherwise returns 0 to indicate the flags has been set properly. | 1731 | * otherwise returns 0 to indicate the flags has been set properly. |
1721 | **/ | 1732 | **/ |
1733 | #ifdef I40E_FCOE | ||
1734 | int i40e_tx_prepare_vlan_flags(struct sk_buff *skb, | ||
1735 | struct i40e_ring *tx_ring, | ||
1736 | u32 *flags) | ||
1737 | #else | ||
1722 | static int i40e_tx_prepare_vlan_flags(struct sk_buff *skb, | 1738 | static int i40e_tx_prepare_vlan_flags(struct sk_buff *skb, |
1723 | struct i40e_ring *tx_ring, | 1739 | struct i40e_ring *tx_ring, |
1724 | u32 *flags) | 1740 | u32 *flags) |
1741 | #endif | ||
1725 | { | 1742 | { |
1726 | __be16 protocol = skb->protocol; | 1743 | __be16 protocol = skb->protocol; |
1727 | u32 tx_flags = 0; | 1744 | u32 tx_flags = 0; |
@@ -1743,9 +1760,8 @@ static int i40e_tx_prepare_vlan_flags(struct sk_buff *skb, | |||
1743 | } | 1760 | } |
1744 | 1761 | ||
1745 | /* Insert 802.1p priority into VLAN header */ | 1762 | /* Insert 802.1p priority into VLAN header */ |
1746 | if ((tx_ring->vsi->back->flags & I40E_FLAG_DCB_ENABLED) && | 1763 | if ((tx_flags & (I40E_TX_FLAGS_HW_VLAN | I40E_TX_FLAGS_SW_VLAN)) || |
1747 | ((tx_flags & (I40E_TX_FLAGS_HW_VLAN | I40E_TX_FLAGS_SW_VLAN)) || | 1764 | (skb->priority != TC_PRIO_CONTROL)) { |
1748 | (skb->priority != TC_PRIO_CONTROL))) { | ||
1749 | tx_flags &= ~I40E_TX_FLAGS_VLAN_PRIO_MASK; | 1765 | tx_flags &= ~I40E_TX_FLAGS_VLAN_PRIO_MASK; |
1750 | tx_flags |= (skb->priority & 0x7) << | 1766 | tx_flags |= (skb->priority & 0x7) << |
1751 | I40E_TX_FLAGS_VLAN_PRIO_SHIFT; | 1767 | I40E_TX_FLAGS_VLAN_PRIO_SHIFT; |
@@ -2018,9 +2034,15 @@ static void i40e_create_tx_ctx(struct i40e_ring *tx_ring, | |||
2018 | * @td_cmd: the command field in the descriptor | 2034 | * @td_cmd: the command field in the descriptor |
2019 | * @td_offset: offset for checksum or crc | 2035 | * @td_offset: offset for checksum or crc |
2020 | **/ | 2036 | **/ |
2037 | #ifdef I40E_FCOE | ||
2038 | void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb, | ||
2039 | struct i40e_tx_buffer *first, u32 tx_flags, | ||
2040 | const u8 hdr_len, u32 td_cmd, u32 td_offset) | ||
2041 | #else | ||
2021 | static void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb, | 2042 | static void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb, |
2022 | struct i40e_tx_buffer *first, u32 tx_flags, | 2043 | struct i40e_tx_buffer *first, u32 tx_flags, |
2023 | const u8 hdr_len, u32 td_cmd, u32 td_offset) | 2044 | const u8 hdr_len, u32 td_cmd, u32 td_offset) |
2045 | #endif | ||
2024 | { | 2046 | { |
2025 | unsigned int data_len = skb->data_len; | 2047 | unsigned int data_len = skb->data_len; |
2026 | unsigned int size = skb_headlen(skb); | 2048 | unsigned int size = skb_headlen(skb); |
@@ -2197,7 +2219,11 @@ static inline int __i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size) | |||
2197 | * | 2219 | * |
2198 | * Returns 0 if stop is not needed | 2220 | * Returns 0 if stop is not needed |
2199 | **/ | 2221 | **/ |
2222 | #ifdef I40E_FCOE | ||
2223 | int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size) | ||
2224 | #else | ||
2200 | static int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size) | 2225 | static int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size) |
2226 | #endif | ||
2201 | { | 2227 | { |
2202 | if (likely(I40E_DESC_UNUSED(tx_ring) >= size)) | 2228 | if (likely(I40E_DESC_UNUSED(tx_ring) >= size)) |
2203 | return 0; | 2229 | return 0; |
@@ -2213,8 +2239,13 @@ static int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size) | |||
2213 | * there is not enough descriptors available in this ring since we need at least | 2239 | * there is not enough descriptors available in this ring since we need at least |
2214 | * one descriptor. | 2240 | * one descriptor. |
2215 | **/ | 2241 | **/ |
2242 | #ifdef I40E_FCOE | ||
2243 | int i40e_xmit_descriptor_count(struct sk_buff *skb, | ||
2244 | struct i40e_ring *tx_ring) | ||
2245 | #else | ||
2216 | static int i40e_xmit_descriptor_count(struct sk_buff *skb, | 2246 | static int i40e_xmit_descriptor_count(struct sk_buff *skb, |
2217 | struct i40e_ring *tx_ring) | 2247 | struct i40e_ring *tx_ring) |
2248 | #endif | ||
2218 | { | 2249 | { |
2219 | unsigned int f; | 2250 | unsigned int f; |
2220 | int count = 0; | 2251 | int count = 0; |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h index c1c356984b17..73f4fa425697 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h | |||
@@ -290,4 +290,13 @@ int i40e_setup_rx_descriptors(struct i40e_ring *rx_ring); | |||
290 | void i40e_free_tx_resources(struct i40e_ring *tx_ring); | 290 | void i40e_free_tx_resources(struct i40e_ring *tx_ring); |
291 | void i40e_free_rx_resources(struct i40e_ring *rx_ring); | 291 | void i40e_free_rx_resources(struct i40e_ring *rx_ring); |
292 | int i40e_napi_poll(struct napi_struct *napi, int budget); | 292 | int i40e_napi_poll(struct napi_struct *napi, int budget); |
293 | #ifdef I40E_FCOE | ||
294 | void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb, | ||
295 | struct i40e_tx_buffer *first, u32 tx_flags, | ||
296 | const u8 hdr_len, u32 td_cmd, u32 td_offset); | ||
297 | int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size); | ||
298 | int i40e_xmit_descriptor_count(struct sk_buff *skb, struct i40e_ring *tx_ring); | ||
299 | int i40e_tx_prepare_vlan_flags(struct sk_buff *skb, | ||
300 | struct i40e_ring *tx_ring, u32 *flags); | ||
301 | #endif | ||
293 | #endif /* _I40E_TXRX_H_ */ | 302 | #endif /* _I40E_TXRX_H_ */ |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h index 8bb9049191cb..ce04d9093db6 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_type.h +++ b/drivers/net/ethernet/intel/i40e/i40e_type.h | |||
@@ -1051,6 +1051,25 @@ struct i40e_eth_stats { | |||
1051 | u64 tx_errors; /* tepc */ | 1051 | u64 tx_errors; /* tepc */ |
1052 | }; | 1052 | }; |
1053 | 1053 | ||
1054 | #ifdef I40E_FCOE | ||
1055 | /* Statistics collected per function for FCoE */ | ||
1056 | struct i40e_fcoe_stats { | ||
1057 | u64 rx_fcoe_packets; /* fcoeprc */ | ||
1058 | u64 rx_fcoe_dwords; /* focedwrc */ | ||
1059 | u64 rx_fcoe_dropped; /* fcoerpdc */ | ||
1060 | u64 tx_fcoe_packets; /* fcoeptc */ | ||
1061 | u64 tx_fcoe_dwords; /* focedwtc */ | ||
1062 | u64 fcoe_bad_fccrc; /* fcoecrc */ | ||
1063 | u64 fcoe_last_error; /* fcoelast */ | ||
1064 | u64 fcoe_ddp_count; /* fcoeddpc */ | ||
1065 | }; | ||
1066 | |||
1067 | /* offset to per function FCoE statistics block */ | ||
1068 | #define I40E_FCOE_VF_STAT_OFFSET 0 | ||
1069 | #define I40E_FCOE_PF_STAT_OFFSET 128 | ||
1070 | #define I40E_FCOE_STAT_MAX (I40E_FCOE_PF_STAT_OFFSET + I40E_MAX_PF) | ||
1071 | |||
1072 | #endif | ||
1054 | /* Statistics collected by the MAC */ | 1073 | /* Statistics collected by the MAC */ |
1055 | struct i40e_hw_port_stats { | 1074 | struct i40e_hw_port_stats { |
1056 | /* eth stats collected by the port */ | 1075 | /* eth stats collected by the port */ |
@@ -1131,6 +1150,125 @@ struct i40e_hw_port_stats { | |||
1131 | 1150 | ||
1132 | #define I40E_SRRD_SRCTL_ATTEMPTS 100000 | 1151 | #define I40E_SRRD_SRCTL_ATTEMPTS 100000 |
1133 | 1152 | ||
1153 | #ifdef I40E_FCOE | ||
1154 | /* FCoE Tx context descriptor - Use the i40e_tx_context_desc struct */ | ||
1155 | |||
1156 | enum i40E_fcoe_tx_ctx_desc_cmd_bits { | ||
1157 | I40E_FCOE_TX_CTX_DESC_OPCODE_SINGLE_SEND = 0x00, /* 4 BITS */ | ||
1158 | I40E_FCOE_TX_CTX_DESC_OPCODE_TSO_FC_CLASS2 = 0x01, /* 4 BITS */ | ||
1159 | I40E_FCOE_TX_CTX_DESC_OPCODE_TSO_FC_CLASS3 = 0x05, /* 4 BITS */ | ||
1160 | I40E_FCOE_TX_CTX_DESC_OPCODE_ETSO_FC_CLASS2 = 0x02, /* 4 BITS */ | ||
1161 | I40E_FCOE_TX_CTX_DESC_OPCODE_ETSO_FC_CLASS3 = 0x06, /* 4 BITS */ | ||
1162 | I40E_FCOE_TX_CTX_DESC_OPCODE_DWO_FC_CLASS2 = 0x03, /* 4 BITS */ | ||
1163 | I40E_FCOE_TX_CTX_DESC_OPCODE_DWO_FC_CLASS3 = 0x07, /* 4 BITS */ | ||
1164 | I40E_FCOE_TX_CTX_DESC_OPCODE_DDP_CTX_INVL = 0x08, /* 4 BITS */ | ||
1165 | I40E_FCOE_TX_CTX_DESC_OPCODE_DWO_CTX_INVL = 0x09, /* 4 BITS */ | ||
1166 | I40E_FCOE_TX_CTX_DESC_RELOFF = 0x10, | ||
1167 | I40E_FCOE_TX_CTX_DESC_CLRSEQ = 0x20, | ||
1168 | I40E_FCOE_TX_CTX_DESC_DIFENA = 0x40, | ||
1169 | I40E_FCOE_TX_CTX_DESC_IL2TAG2 = 0x80 | ||
1170 | }; | ||
1171 | |||
1172 | /* FCoE DDP Context descriptor */ | ||
1173 | struct i40e_fcoe_ddp_context_desc { | ||
1174 | __le64 rsvd; | ||
1175 | __le64 type_cmd_foff_lsize; | ||
1176 | }; | ||
1177 | |||
1178 | #define I40E_FCOE_DDP_CTX_QW1_DTYPE_SHIFT 0 | ||
1179 | #define I40E_FCOE_DDP_CTX_QW1_DTYPE_MASK (0xFULL << \ | ||
1180 | I40E_FCOE_DDP_CTX_QW1_DTYPE_SHIFT) | ||
1181 | |||
1182 | #define I40E_FCOE_DDP_CTX_QW1_CMD_SHIFT 4 | ||
1183 | #define I40E_FCOE_DDP_CTX_QW1_CMD_MASK (0xFULL << \ | ||
1184 | I40E_FCOE_DDP_CTX_QW1_CMD_SHIFT) | ||
1185 | |||
1186 | enum i40e_fcoe_ddp_ctx_desc_cmd_bits { | ||
1187 | I40E_FCOE_DDP_CTX_DESC_BSIZE_512B = 0x00, /* 2 BITS */ | ||
1188 | I40E_FCOE_DDP_CTX_DESC_BSIZE_4K = 0x01, /* 2 BITS */ | ||
1189 | I40E_FCOE_DDP_CTX_DESC_BSIZE_8K = 0x02, /* 2 BITS */ | ||
1190 | I40E_FCOE_DDP_CTX_DESC_BSIZE_16K = 0x03, /* 2 BITS */ | ||
1191 | I40E_FCOE_DDP_CTX_DESC_DIFENA = 0x04, /* 1 BIT */ | ||
1192 | I40E_FCOE_DDP_CTX_DESC_LASTSEQH = 0x08, /* 1 BIT */ | ||
1193 | }; | ||
1194 | |||
1195 | #define I40E_FCOE_DDP_CTX_QW1_FOFF_SHIFT 16 | ||
1196 | #define I40E_FCOE_DDP_CTX_QW1_FOFF_MASK (0x3FFFULL << \ | ||
1197 | I40E_FCOE_DDP_CTX_QW1_FOFF_SHIFT) | ||
1198 | |||
1199 | #define I40E_FCOE_DDP_CTX_QW1_LSIZE_SHIFT 32 | ||
1200 | #define I40E_FCOE_DDP_CTX_QW1_LSIZE_MASK (0x3FFFULL << \ | ||
1201 | I40E_FCOE_DDP_CTX_QW1_LSIZE_SHIFT) | ||
1202 | |||
1203 | /* FCoE DDP/DWO Queue Context descriptor */ | ||
1204 | struct i40e_fcoe_queue_context_desc { | ||
1205 | __le64 dmaindx_fbase; /* 0:11 DMAINDX, 12:63 FBASE */ | ||
1206 | __le64 flen_tph; /* 0:12 FLEN, 13:15 TPH */ | ||
1207 | }; | ||
1208 | |||
1209 | #define I40E_FCOE_QUEUE_CTX_QW0_DMAINDX_SHIFT 0 | ||
1210 | #define I40E_FCOE_QUEUE_CTX_QW0_DMAINDX_MASK (0xFFFULL << \ | ||
1211 | I40E_FCOE_QUEUE_CTX_QW0_DMAINDX_SHIFT) | ||
1212 | |||
1213 | #define I40E_FCOE_QUEUE_CTX_QW0_FBASE_SHIFT 12 | ||
1214 | #define I40E_FCOE_QUEUE_CTX_QW0_FBASE_MASK (0xFFFFFFFFFFFFFULL << \ | ||
1215 | I40E_FCOE_QUEUE_CTX_QW0_FBASE_SHIFT) | ||
1216 | |||
1217 | #define I40E_FCOE_QUEUE_CTX_QW1_FLEN_SHIFT 0 | ||
1218 | #define I40E_FCOE_QUEUE_CTX_QW1_FLEN_MASK (0x1FFFULL << \ | ||
1219 | I40E_FCOE_QUEUE_CTX_QW1_FLEN_SHIFT) | ||
1220 | |||
1221 | #define I40E_FCOE_QUEUE_CTX_QW1_TPH_SHIFT 13 | ||
1222 | #define I40E_FCOE_QUEUE_CTX_QW1_TPH_MASK (0x7ULL << \ | ||
1223 | I40E_FCOE_QUEUE_CTX_QW1_FLEN_SHIFT) | ||
1224 | |||
1225 | enum i40e_fcoe_queue_ctx_desc_tph_bits { | ||
1226 | I40E_FCOE_QUEUE_CTX_DESC_TPHRDESC = 0x1, | ||
1227 | I40E_FCOE_QUEUE_CTX_DESC_TPHDATA = 0x2 | ||
1228 | }; | ||
1229 | |||
1230 | #define I40E_FCOE_QUEUE_CTX_QW1_RECIPE_SHIFT 30 | ||
1231 | #define I40E_FCOE_QUEUE_CTX_QW1_RECIPE_MASK (0x3ULL << \ | ||
1232 | I40E_FCOE_QUEUE_CTX_QW1_RECIPE_SHIFT) | ||
1233 | |||
1234 | /* FCoE DDP/DWO Filter Context descriptor */ | ||
1235 | struct i40e_fcoe_filter_context_desc { | ||
1236 | __le32 param; | ||
1237 | __le16 seqn; | ||
1238 | |||
1239 | /* 48:51(0:3) RSVD, 52:63(4:15) DMAINDX */ | ||
1240 | __le16 rsvd_dmaindx; | ||
1241 | |||
1242 | /* 0:7 FLAGS, 8:52 RSVD, 53:63 LANQ */ | ||
1243 | __le64 flags_rsvd_lanq; | ||
1244 | }; | ||
1245 | |||
1246 | #define I40E_FCOE_FILTER_CTX_QW0_DMAINDX_SHIFT 4 | ||
1247 | #define I40E_FCOE_FILTER_CTX_QW0_DMAINDX_MASK (0xFFF << \ | ||
1248 | I40E_FCOE_FILTER_CTX_QW0_DMAINDX_SHIFT) | ||
1249 | |||
1250 | enum i40e_fcoe_filter_ctx_desc_flags_bits { | ||
1251 | I40E_FCOE_FILTER_CTX_DESC_CTYP_DDP = 0x00, | ||
1252 | I40E_FCOE_FILTER_CTX_DESC_CTYP_DWO = 0x01, | ||
1253 | I40E_FCOE_FILTER_CTX_DESC_ENODE_INIT = 0x00, | ||
1254 | I40E_FCOE_FILTER_CTX_DESC_ENODE_RSP = 0x02, | ||
1255 | I40E_FCOE_FILTER_CTX_DESC_FC_CLASS2 = 0x00, | ||
1256 | I40E_FCOE_FILTER_CTX_DESC_FC_CLASS3 = 0x04 | ||
1257 | }; | ||
1258 | |||
1259 | #define I40E_FCOE_FILTER_CTX_QW1_FLAGS_SHIFT 0 | ||
1260 | #define I40E_FCOE_FILTER_CTX_QW1_FLAGS_MASK (0xFFULL << \ | ||
1261 | I40E_FCOE_FILTER_CTX_QW1_FLAGS_SHIFT) | ||
1262 | |||
1263 | #define I40E_FCOE_FILTER_CTX_QW1_PCTYPE_SHIFT 8 | ||
1264 | #define I40E_FCOE_FILTER_CTX_QW1_PCTYPE_MASK (0x3FULL << \ | ||
1265 | I40E_FCOE_FILTER_CTX_QW1_PCTYPE_SHIFT) | ||
1266 | |||
1267 | #define I40E_FCOE_FILTER_CTX_QW1_LANQINDX_SHIFT 53 | ||
1268 | #define I40E_FCOE_FILTER_CTX_QW1_LANQINDX_MASK (0x7FFULL << \ | ||
1269 | I40E_FCOE_FILTER_CTX_QW1_LANQINDX_SHIFT) | ||
1270 | |||
1271 | #endif /* I40E_FCOE */ | ||
1134 | enum i40e_switch_element_types { | 1272 | enum i40e_switch_element_types { |
1135 | I40E_SWITCH_ELEMENT_TYPE_MAC = 1, | 1273 | I40E_SWITCH_ELEMENT_TYPE_MAC = 1, |
1136 | I40E_SWITCH_ELEMENT_TYPE_PF = 2, | 1274 | I40E_SWITCH_ELEMENT_TYPE_PF = 2, |