Skip to content

Commit d39a9ff

Browse files
committed
Merge branch 'intel-next'
Aaron Brown says: ==================== Intel Wired LAN Driver Updates This series contains updates to the i40e and i40evf drivers. Vasu adds FCOE support, build options and a documentation pointer to i40e. Shannon exposes a Firmware API request used to do register writes on the driver's behalf and disables local loopback on VMDQ VSI in order to stop the VEB from echoing the VMDQ packets back at the VSI. Ashish corrects the vf_id offset for virtchnl messages in the case of multiple PFs, removes support for vf unicast promiscuos mode to disallow VFs from receiving traffic intended for another VF, updates the vfr_stat state check to handle the existing and future mechanism and adds an adapter state check to prevent re-arming the watchdog timer after i40evf_remove has been called and the timer has been deleted. Serey fixes an issue where a guest OS would panic when removing the vf driver while the device is being reset due to an attempt to clean a non initialized mac_filter_list. Akeem makes a minor comment change. Jessie changes an instance of sprintf to snprintf that was missed when the driver was converted to use snprintf everywhere. Mitch plugs a few memory leaks. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents a4f090f + 8bb1a54 commit d39a9ff

File tree

17 files changed

+2393
-33
lines changed

17 files changed

+2393
-33
lines changed

Documentation/networking/i40e.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,11 @@ Additional Configurations
6969

7070
FCoE
7171
----
72-
Fiber Channel over Ethernet (FCoE) hardware offload is not currently
73-
supported.
72+
The driver supports Fiber Channel over Ethernet (FCoE) and Data Center
73+
Bridging (DCB) functionality. Configuring DCB and FCoE is outside the scope
74+
of this driver doc. Refer to http://www.open-fcoe.org/ for FCoE project
75+
information and http://www.open-lldp.org/ or email list
76+
e1000-eedc@lists.sourceforge.net for DCB information.
7477

7578
MAC and VLAN anti-spoofing feature
7679
----------------------------------

drivers/net/ethernet/intel/i40e/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ i40e-objs := i40e_main.o \
4444
i40e_virtchnl_pf.o
4545

4646
i40e-$(CONFIG_I40E_DCB) += i40e_dcb.o i40e_dcb_nl.o
47+
i40e-$(CONFIG_FCOE:m=y) += i40e_fcoe.o

drivers/net/ethernet/intel/i40e/i40e.h

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@
5454
#include <linux/ptp_clock_kernel.h>
5555
#include "i40e_type.h"
5656
#include "i40e_prototype.h"
57+
#ifdef I40E_FCOE
58+
#include "i40e_fcoe.h"
59+
#endif
5760
#include "i40e_virtchnl.h"
5861
#include "i40e_virtchnl_pf.h"
5962
#include "i40e_txrx.h"
@@ -79,6 +82,10 @@
7982
#define I40E_MAX_QUEUES_PER_TC 64 /* should be a power of 2 */
8083
#define I40E_FDIR_RING 0
8184
#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 */
8289
#define I40E_MAX_AQ_BUF_SIZE 4096
8390
#define I40E_AQ_LEN 32
8491
#define I40E_AQ_WORK_LIMIT 16
@@ -225,6 +232,10 @@ struct i40e_pf {
225232
u16 num_vmdq_msix; /* num queue vectors per vmdq pool */
226233
u16 num_req_vfs; /* num vfs requested for this vf */
227234
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 */
228239
u16 num_lan_qps; /* num lan queues this pf has set up */
229240
u16 num_lan_msix; /* num queue vectors for the base pf vsi */
230241
int queues_left; /* queues left unclaimed */
@@ -265,6 +276,9 @@ struct i40e_pf {
265276
#define I40E_FLAG_VMDQ_ENABLED (u64)(1 << 7)
266277
#define I40E_FLAG_FDIR_REQUIRES_REINIT (u64)(1 << 8)
267278
#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 */
268282
#define I40E_FLAG_IN_NETPOLL (u64)(1 << 12)
269283
#define I40E_FLAG_16BYTE_RX_DESC_ENABLED (u64)(1 << 13)
270284
#define I40E_FLAG_CLEAN_ADMINQ (u64)(1 << 14)
@@ -286,6 +300,10 @@ struct i40e_pf {
286300
/* tracks features that get auto disabled by errors */
287301
u64 auto_disable_flags;
288302

303+
#ifdef I40E_FCOE
304+
struct i40e_fcoe fcoe;
305+
306+
#endif /* I40E_FCOE */
289307
bool stat_offsets_loaded;
290308
struct i40e_hw_port_stats stats;
291309
struct i40e_hw_port_stats stats_offsets;
@@ -408,6 +426,11 @@ struct i40e_vsi {
408426
struct rtnl_link_stats64 net_stats_offsets;
409427
struct i40e_eth_stats eth_stats;
410428
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
411434
u32 tx_restart;
412435
u32 tx_busy;
413436
u32 rx_buf_failed;
@@ -598,6 +621,11 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type,
598621
int i40e_vsi_release(struct i40e_vsi *vsi);
599622
struct i40e_vsi *i40e_vsi_lookup(struct i40e_pf *pf, enum i40e_vsi_type type,
600623
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
601629
int i40e_vsi_control_rings(struct i40e_vsi *vsi, bool enable);
602630
int i40e_reconfig_rss_queues(struct i40e_pf *pf, int queue_count);
603631
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);
624652
void i40e_irq_dynamic_disable(struct i40e_vsi *vsi, int vector);
625653
void i40e_irq_dynamic_disable_icr0(struct i40e_pf *pf);
626654
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
627662
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
628670
int i40e_vsi_open(struct i40e_vsi *vsi);
629671
void i40e_vlan_stripping_disable(struct i40e_vsi *vsi);
630672
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,
634676
bool i40e_is_vsi_in_vlan(struct i40e_vsi *vsi);
635677
struct i40e_mac_filter *i40e_find_mac(struct i40e_vsi *vsi, u8 *macaddr,
636678
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 */
637699
void i40e_vlan_stripping_enable(struct i40e_vsi *vsi);
638700
#ifdef CONFIG_I40E_DCB
639701
void i40e_dcbnl_flush_apps(struct i40e_pf *pf,

drivers/net/ethernet/intel/i40e/i40e_common.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,33 @@ void i40e_pre_tx_queue_cfg(struct i40e_hw *hw, u32 queue, bool enable)
709709

710710
wr32(hw, I40E_GLLAN_TXPRE_QDIS(reg_block), reg_val);
711711
}
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
712739

713740
/**
714741
* i40e_get_media_type - Gets media type
@@ -1974,6 +2001,35 @@ i40e_status i40e_aq_send_msg_to_vf(struct i40e_hw *hw, u16 vfid,
19742001
return status;
19752002
}
19762003

2004+
/**
2005+
* i40e_aq_debug_write_register
2006+
* @hw: pointer to the hw struct
2007+
* @reg_addr: register address
2008+
* @reg_val: register value
2009+
* @cmd_details: pointer to command details structure or NULL
2010+
*
2011+
* Write to a register using the admin queue commands
2012+
**/
2013+
i40e_status i40e_aq_debug_write_register(struct i40e_hw *hw,
2014+
u32 reg_addr, u64 reg_val,
2015+
struct i40e_asq_cmd_details *cmd_details)
2016+
{
2017+
struct i40e_aq_desc desc;
2018+
struct i40e_aqc_debug_reg_read_write *cmd =
2019+
(struct i40e_aqc_debug_reg_read_write *)&desc.params.raw;
2020+
i40e_status status;
2021+
2022+
i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_debug_write_reg);
2023+
2024+
cmd->address = cpu_to_le32(reg_addr);
2025+
cmd->value_high = cpu_to_le32((u32)(reg_val >> 32));
2026+
cmd->value_low = cpu_to_le32((u32)(reg_val & 0xFFFFFFFF));
2027+
2028+
status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
2029+
2030+
return status;
2031+
}
2032+
19772033
/**
19782034
* i40e_aq_set_hmc_resource_profile
19792035
* @hw: pointer to the hw struct

drivers/net/ethernet/intel/i40e/i40e_debugfs.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,25 @@ static void i40e_dbg_dump_vsi_seid(struct i40e_pf *pf, int seid)
697697
vsi->bw_ets_limit_credits[i],
698698
vsi->bw_ets_max_quanta[i]);
699699
}
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
700719
}
701720

702721
/**

drivers/net/ethernet/intel/i40e/i40e_ethtool.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,37 @@ static struct i40e_stats i40e_gstrings_stats[] = {
155155
I40E_PF_STAT("rx_lpi_count", stats.rx_lpi_count),
156156
};
157157

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 */
158171
#define I40E_QUEUE_STATS_LEN(n) \
159172
(((struct i40e_netdev_priv *)netdev_priv((n)))->vsi->num_queue_pairs \
160173
* 2 /* Tx and Rx together */ \
161174
* (sizeof(struct i40e_queue_stats) / sizeof(u64)))
162175
#define I40E_GLOBAL_STATS_LEN ARRAY_SIZE(i40e_gstrings_stats)
163176
#define I40E_NETDEV_STATS_LEN ARRAY_SIZE(i40e_gstrings_net_stats)
164177
#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
165185
#define I40E_VSI_STATS_LEN(n) (I40E_NETDEV_STATS_LEN + \
166186
I40E_MISC_STATS_LEN + \
167187
I40E_QUEUE_STATS_LEN((n)))
188+
#endif /* I40E_FCOE */
168189
#define I40E_PFC_STATS_LEN ( \
169190
(FIELD_SIZEOF(struct i40e_pf, stats.priority_xoff_rx) + \
170191
FIELD_SIZEOF(struct i40e_pf, stats.priority_xon_rx) + \
@@ -1112,6 +1133,13 @@ static void i40e_get_ethtool_stats(struct net_device *netdev,
11121133
data[i++] = (i40e_gstrings_misc_stats[j].sizeof_stat ==
11131134
sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
11141135
}
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
11151143
rcu_read_lock();
11161144
for (j = 0; j < vsi->num_queue_pairs; j++) {
11171145
tx_ring = ACCESS_ONCE(vsi->tx_rings[j]);
@@ -1193,6 +1221,13 @@ static void i40e_get_strings(struct net_device *netdev, u32 stringset,
11931221
i40e_gstrings_misc_stats[i].stat_string);
11941222
p += ETH_GSTRING_LEN;
11951223
}
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
11961231
for (i = 0; i < vsi->num_queue_pairs; i++) {
11971232
snprintf(p, ETH_GSTRING_LEN, "tx-%u.tx_packets", i);
11981233
p += ETH_GSTRING_LEN;

0 commit comments

Comments
 (0)