Skip to content

Commit ebed1cf

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says: ==================== 100GbE Intel Wired LAN Driver Updates 2021-10-29 This series contains updates to ice and iavf drivers and virtchnl header file. Brett removes vlan_promisc argument from a function call for ice driver. In the virtchnl header file he removes an unused, reserved define and converts raw value defines to instead use the BIT macro. Marcin adds syncing of MAC addresses when creating switchdev VFs to remove error messages on link up and stops showing buffer information for port representors to remove duplicated entries being displayed for ice driver. Karen introduces a helper to go from pci_dev to iavf_adapter in the iavf driver. Przemyslaw fixes an issue where iavf was attempting to free IRQs before calling disable. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 06f1ecd + 605ca7c commit ebed1cf

File tree

9 files changed

+118
-46
lines changed

9 files changed

+118
-46
lines changed

drivers/net/ethernet/intel/iavf/iavf.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,13 +394,49 @@ struct iavf_device {
394394
extern char iavf_driver_name[];
395395
extern struct workqueue_struct *iavf_wq;
396396

397+
static inline const char *iavf_state_str(enum iavf_state_t state)
398+
{
399+
switch (state) {
400+
case __IAVF_STARTUP:
401+
return "__IAVF_STARTUP";
402+
case __IAVF_REMOVE:
403+
return "__IAVF_REMOVE";
404+
case __IAVF_INIT_VERSION_CHECK:
405+
return "__IAVF_INIT_VERSION_CHECK";
406+
case __IAVF_INIT_GET_RESOURCES:
407+
return "__IAVF_INIT_GET_RESOURCES";
408+
case __IAVF_INIT_SW:
409+
return "__IAVF_INIT_SW";
410+
case __IAVF_INIT_FAILED:
411+
return "__IAVF_INIT_FAILED";
412+
case __IAVF_RESETTING:
413+
return "__IAVF_RESETTING";
414+
case __IAVF_COMM_FAILED:
415+
return "__IAVF_COMM_FAILED";
416+
case __IAVF_DOWN:
417+
return "__IAVF_DOWN";
418+
case __IAVF_DOWN_PENDING:
419+
return "__IAVF_DOWN_PENDING";
420+
case __IAVF_TESTING:
421+
return "__IAVF_TESTING";
422+
case __IAVF_RUNNING:
423+
return "__IAVF_RUNNING";
424+
default:
425+
return "__IAVF_UNKNOWN_STATE";
426+
}
427+
}
428+
397429
static inline void iavf_change_state(struct iavf_adapter *adapter,
398430
enum iavf_state_t state)
399431
{
400432
if (adapter->state != state) {
401433
adapter->last_state = adapter->state;
402434
adapter->state = state;
403435
}
436+
dev_dbg(&adapter->pdev->dev,
437+
"state transition from:%s to:%s\n",
438+
iavf_state_str(adapter->last_state),
439+
iavf_state_str(adapter->state));
404440
}
405441

406442
int iavf_up(struct iavf_adapter *adapter);

drivers/net/ethernet/intel/iavf/iavf_main.c

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ MODULE_LICENSE("GPL v2");
5151
static const struct net_device_ops iavf_netdev_ops;
5252
struct workqueue_struct *iavf_wq;
5353

54+
/**
55+
* iavf_pdev_to_adapter - go from pci_dev to adapter
56+
* @pdev: pci_dev pointer
57+
*/
58+
static struct iavf_adapter *iavf_pdev_to_adapter(struct pci_dev *pdev)
59+
{
60+
return netdev_priv(pci_get_drvdata(pdev));
61+
}
62+
5463
/**
5564
* iavf_allocate_dma_mem_d - OS specific memory alloc for shared code
5665
* @hw: pointer to the HW structure
@@ -3271,6 +3280,13 @@ static int iavf_open(struct net_device *netdev)
32713280
goto err_unlock;
32723281
}
32733282

3283+
if (adapter->state == __IAVF_RUNNING &&
3284+
!test_bit(__IAVF_VSI_DOWN, adapter->vsi.state)) {
3285+
dev_dbg(&adapter->pdev->dev, "VF is already open.\n");
3286+
err = 0;
3287+
goto err_unlock;
3288+
}
3289+
32743290
/* allocate transmit descriptors */
32753291
err = iavf_setup_all_tx_resources(adapter);
32763292
if (err)
@@ -3681,8 +3697,8 @@ int iavf_process_config(struct iavf_adapter *adapter)
36813697
**/
36823698
static void iavf_shutdown(struct pci_dev *pdev)
36833699
{
3684-
struct net_device *netdev = pci_get_drvdata(pdev);
3685-
struct iavf_adapter *adapter = netdev_priv(netdev);
3700+
struct iavf_adapter *adapter = iavf_pdev_to_adapter(pdev);
3701+
struct net_device *netdev = adapter->netdev;
36863702

36873703
netif_device_detach(netdev);
36883704

@@ -3866,10 +3882,11 @@ static int __maybe_unused iavf_suspend(struct device *dev_d)
38663882
static int __maybe_unused iavf_resume(struct device *dev_d)
38673883
{
38683884
struct pci_dev *pdev = to_pci_dev(dev_d);
3869-
struct net_device *netdev = pci_get_drvdata(pdev);
3870-
struct iavf_adapter *adapter = netdev_priv(netdev);
3885+
struct iavf_adapter *adapter;
38713886
u32 err;
38723887

3888+
adapter = iavf_pdev_to_adapter(pdev);
3889+
38733890
pci_set_master(pdev);
38743891

38753892
rtnl_lock();
@@ -3888,7 +3905,7 @@ static int __maybe_unused iavf_resume(struct device *dev_d)
38883905

38893906
queue_work(iavf_wq, &adapter->reset_task);
38903907

3891-
netif_device_attach(netdev);
3908+
netif_device_attach(adapter->netdev);
38923909

38933910
return err;
38943911
}
@@ -3904,8 +3921,9 @@ static int __maybe_unused iavf_resume(struct device *dev_d)
39043921
**/
39053922
static void iavf_remove(struct pci_dev *pdev)
39063923
{
3907-
struct net_device *netdev = pci_get_drvdata(pdev);
3908-
struct iavf_adapter *adapter = netdev_priv(netdev);
3924+
struct iavf_adapter *adapter = iavf_pdev_to_adapter(pdev);
3925+
enum iavf_state_t prev_state = adapter->last_state;
3926+
struct net_device *netdev = adapter->netdev;
39093927
struct iavf_fdir_fltr *fdir, *fdirtmp;
39103928
struct iavf_vlan_filter *vlf, *vlftmp;
39113929
struct iavf_adv_rss *rss, *rsstmp;
@@ -3943,10 +3961,22 @@ static void iavf_remove(struct pci_dev *pdev)
39433961
iavf_change_state(adapter, __IAVF_REMOVE);
39443962
adapter->aq_required = 0;
39453963
adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED;
3964+
39463965
iavf_free_all_tx_resources(adapter);
39473966
iavf_free_all_rx_resources(adapter);
39483967
iavf_misc_irq_disable(adapter);
39493968
iavf_free_misc_irq(adapter);
3969+
3970+
/* In case we enter iavf_remove from erroneous state, free traffic irqs
3971+
* here, so as to not cause a kernel crash, when calling
3972+
* iavf_reset_interrupt_capability.
3973+
*/
3974+
if ((adapter->last_state == __IAVF_RESETTING &&
3975+
prev_state != __IAVF_DOWN) ||
3976+
(adapter->last_state == __IAVF_RUNNING &&
3977+
!(netdev->flags & IFF_UP)))
3978+
iavf_free_traffic_irqs(adapter);
3979+
39503980
iavf_reset_interrupt_capability(adapter);
39513981
iavf_free_q_vectors(adapter);
39523982

drivers/net/ethernet/intel/ice/ice_eswitch.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
static int ice_eswitch_setup_env(struct ice_pf *pf)
2020
{
2121
struct ice_vsi *uplink_vsi = pf->switchdev.uplink_vsi;
22+
struct net_device *uplink_netdev = uplink_vsi->netdev;
2223
struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi;
2324
struct ice_port_info *pi = pf->hw.port_info;
2425
bool rule_added = false;
@@ -27,6 +28,11 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)
2728

2829
ice_remove_vsi_fltr(&pf->hw, uplink_vsi->idx);
2930

31+
netif_addr_lock_bh(uplink_netdev);
32+
__dev_uc_unsync(uplink_netdev, NULL);
33+
__dev_mc_unsync(uplink_netdev, NULL);
34+
netif_addr_unlock_bh(uplink_netdev);
35+
3036
if (ice_vsi_add_vlan(uplink_vsi, 0, ICE_FWD_TO_VSI))
3137
goto err_def_rx;
3238

drivers/net/ethernet/intel/ice/ice_ethtool.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,19 @@ __ice_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo,
189189
snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
190190
"%x.%02x 0x%x %d.%d.%d", nvm->major, nvm->minor,
191191
nvm->eetrack, orom->major, orom->build, orom->patch);
192-
193-
strscpy(drvinfo->bus_info, pci_name(pf->pdev),
194-
sizeof(drvinfo->bus_info));
195192
}
196193

197194
static void
198195
ice_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
199196
{
200197
struct ice_netdev_priv *np = netdev_priv(netdev);
198+
struct ice_pf *pf = np->vsi->back;
201199

202200
__ice_get_drvinfo(netdev, drvinfo, np->vsi);
203201

202+
strscpy(drvinfo->bus_info, pci_name(pf->pdev),
203+
sizeof(drvinfo->bus_info));
204+
204205
drvinfo->n_priv_flags = ICE_PRIV_FLAG_ARRAY_SIZE;
205206
}
206207

drivers/net/ethernet/intel/ice/ice_lib.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2284,11 +2284,10 @@ bool ice_vsi_is_vlan_pruning_ena(struct ice_vsi *vsi)
22842284
* ice_cfg_vlan_pruning - enable or disable VLAN pruning on the VSI
22852285
* @vsi: VSI to enable or disable VLAN pruning on
22862286
* @ena: set to true to enable VLAN pruning and false to disable it
2287-
* @vlan_promisc: enable valid security flags if not in VLAN promiscuous mode
22882287
*
22892288
* returns 0 if VSI is updated, negative otherwise
22902289
*/
2291-
int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena, bool vlan_promisc)
2290+
int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena)
22922291
{
22932292
struct ice_vsi_ctx *ctxt;
22942293
struct ice_pf *pf;
@@ -2316,9 +2315,7 @@ int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena, bool vlan_promisc)
23162315
else
23172316
ctxt->info.sw_flags2 &= ~ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;
23182317

2319-
if (!vlan_promisc)
2320-
ctxt->info.valid_sections =
2321-
cpu_to_le16(ICE_AQ_VSI_PROP_SW_VALID);
2318+
ctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_SW_VALID);
23222319

23232320
status = ice_update_vsi(&pf->hw, vsi->idx, ctxt, NULL);
23242321
if (status) {

drivers/net/ethernet/intel/ice/ice_lib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi);
4545

4646
bool ice_vsi_is_vlan_pruning_ena(struct ice_vsi *vsi);
4747

48-
int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena, bool vlan_promisc);
48+
int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena);
4949

5050
void ice_cfg_sw_lldp(struct ice_vsi *vsi, bool tx, bool create);
5151

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)
396396
~IFF_PROMISC;
397397
goto out_promisc;
398398
}
399-
ice_cfg_vlan_pruning(vsi, false, false);
399+
ice_cfg_vlan_pruning(vsi, false);
400400
}
401401
} else {
402402
/* Clear Rx filter to remove traffic from wire */
@@ -410,7 +410,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)
410410
goto out_promisc;
411411
}
412412
if (vsi->num_vlan > 1)
413-
ice_cfg_vlan_pruning(vsi, true, false);
413+
ice_cfg_vlan_pruning(vsi, true);
414414
}
415415
}
416416
}
@@ -3387,7 +3387,7 @@ ice_vlan_rx_add_vid(struct net_device *netdev, __always_unused __be16 proto,
33873387

33883388
/* Enable VLAN pruning when a VLAN other than 0 is added */
33893389
if (!ice_vsi_is_vlan_pruning_ena(vsi)) {
3390-
ret = ice_cfg_vlan_pruning(vsi, true, false);
3390+
ret = ice_cfg_vlan_pruning(vsi, true);
33913391
if (ret)
33923392
return ret;
33933393
}
@@ -3431,7 +3431,7 @@ ice_vlan_rx_kill_vid(struct net_device *netdev, __always_unused __be16 proto,
34313431

34323432
/* Disable pruning when VLAN 0 is the only VLAN rule */
34333433
if (vsi->num_vlan == 1 && ice_vsi_is_vlan_pruning_ena(vsi))
3434-
ret = ice_cfg_vlan_pruning(vsi, false, false);
3434+
ret = ice_cfg_vlan_pruning(vsi, false);
34353435

34363436
set_bit(ICE_VSI_VLAN_FLTR_CHANGED, vsi->state);
34373437
return ret;
@@ -5616,10 +5616,10 @@ ice_set_features(struct net_device *netdev, netdev_features_t features)
56165616

56175617
if ((features & NETIF_F_HW_VLAN_CTAG_FILTER) &&
56185618
!(netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
5619-
ret = ice_cfg_vlan_pruning(vsi, true, false);
5619+
ret = ice_cfg_vlan_pruning(vsi, true);
56205620
else if (!(features & NETIF_F_HW_VLAN_CTAG_FILTER) &&
56215621
(netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
5622-
ret = ice_cfg_vlan_pruning(vsi, false, false);
5622+
ret = ice_cfg_vlan_pruning(vsi, false);
56235623

56245624
if ((features & NETIF_F_NTUPLE) &&
56255625
!(netdev->features & NETIF_F_NTUPLE)) {

drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3072,7 +3072,10 @@ static int ice_vc_cfg_promiscuous_mode_msg(struct ice_vf *vf, u8 *msg)
30723072
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
30733073
}
30743074

3075-
ret = ice_cfg_vlan_pruning(vsi, true, !rm_promisc);
3075+
if (rm_promisc)
3076+
ret = ice_cfg_vlan_pruning(vsi, true);
3077+
else
3078+
ret = ice_cfg_vlan_pruning(vsi, false);
30763079
if (ret) {
30773080
dev_err(dev, "Failed to configure VLAN pruning in promiscuous mode\n");
30783081
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
@@ -4277,7 +4280,7 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v)
42774280
/* Enable VLAN pruning when non-zero VLAN is added */
42784281
if (!vlan_promisc && vid &&
42794282
!ice_vsi_is_vlan_pruning_ena(vsi)) {
4280-
status = ice_cfg_vlan_pruning(vsi, true, false);
4283+
status = ice_cfg_vlan_pruning(vsi, true);
42814284
if (status) {
42824285
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
42834286
dev_err(dev, "Enable VLAN pruning on VLAN ID: %d failed error-%d\n",
@@ -4331,7 +4334,7 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v)
43314334
/* Disable VLAN pruning when only VLAN 0 is left */
43324335
if (vsi->num_vlan == 1 &&
43334336
ice_vsi_is_vlan_pruning_ena(vsi))
4334-
ice_cfg_vlan_pruning(vsi, false, false);
4337+
ice_cfg_vlan_pruning(vsi, false);
43354338

43364339
/* Disable Unicast/Multicast VLAN promiscuous mode */
43374340
if (vlan_promisc) {

include/linux/avf/virtchnl.h

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -238,27 +238,26 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
238238
* VIRTCHNL_VF_OFFLOAD_L2 flag is inclusive of base mode L2 offloads including
239239
* TX/RX Checksum offloading and TSO for non-tunnelled packets.
240240
*/
241-
#define VIRTCHNL_VF_OFFLOAD_L2 0x00000001
242-
#define VIRTCHNL_VF_OFFLOAD_IWARP 0x00000002
243-
#define VIRTCHNL_VF_OFFLOAD_RSVD 0x00000004
244-
#define VIRTCHNL_VF_OFFLOAD_RSS_AQ 0x00000008
245-
#define VIRTCHNL_VF_OFFLOAD_RSS_REG 0x00000010
246-
#define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR 0x00000020
247-
#define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES 0x00000040
248-
#define VIRTCHNL_VF_OFFLOAD_VLAN 0x00010000
249-
#define VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000
250-
#define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000
251-
#define VIRTCHNL_VF_OFFLOAD_RSS_PF 0X00080000
252-
#define VIRTCHNL_VF_OFFLOAD_ENCAP 0X00100000
253-
#define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00200000
254-
#define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM 0X00400000
255-
#define VIRTCHNL_VF_OFFLOAD_ADQ 0X00800000
256-
#define VIRTCHNL_VF_OFFLOAD_USO 0X02000000
257-
#define VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF 0X08000000
258-
#define VIRTCHNL_VF_OFFLOAD_FDIR_PF 0X10000000
259-
260-
/* Define below the capability flags that are not offloads */
261-
#define VIRTCHNL_VF_CAP_ADV_LINK_SPEED 0x00000080
241+
#define VIRTCHNL_VF_OFFLOAD_L2 BIT(0)
242+
#define VIRTCHNL_VF_OFFLOAD_IWARP BIT(1)
243+
#define VIRTCHNL_VF_OFFLOAD_RSS_AQ BIT(3)
244+
#define VIRTCHNL_VF_OFFLOAD_RSS_REG BIT(4)
245+
#define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR BIT(5)
246+
#define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES BIT(6)
247+
/* used to negotiate communicating link speeds in Mbps */
248+
#define VIRTCHNL_VF_CAP_ADV_LINK_SPEED BIT(7)
249+
#define VIRTCHNL_VF_OFFLOAD_VLAN BIT(16)
250+
#define VIRTCHNL_VF_OFFLOAD_RX_POLLING BIT(17)
251+
#define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 BIT(18)
252+
#define VIRTCHNL_VF_OFFLOAD_RSS_PF BIT(19)
253+
#define VIRTCHNL_VF_OFFLOAD_ENCAP BIT(20)
254+
#define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM BIT(21)
255+
#define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM BIT(22)
256+
#define VIRTCHNL_VF_OFFLOAD_ADQ BIT(23)
257+
#define VIRTCHNL_VF_OFFLOAD_USO BIT(25)
258+
#define VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF BIT(27)
259+
#define VIRTCHNL_VF_OFFLOAD_FDIR_PF BIT(28)
260+
262261
#define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
263262
VIRTCHNL_VF_OFFLOAD_VLAN | \
264263
VIRTCHNL_VF_OFFLOAD_RSS_PF)

0 commit comments

Comments
 (0)