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 <davem@davemloft.net>
This commit is contained in:
David S. Miller 2021-11-01 13:05:20 +00:00
Родитель 06f1ecd433 605ca7c5c6
Коммит ebed1cf5b8
9 изменённых файлов: 117 добавлений и 45 удалений

Просмотреть файл

@ -394,6 +394,38 @@ struct iavf_device {
extern char iavf_driver_name[]; extern char iavf_driver_name[];
extern struct workqueue_struct *iavf_wq; extern struct workqueue_struct *iavf_wq;
static inline const char *iavf_state_str(enum iavf_state_t state)
{
switch (state) {
case __IAVF_STARTUP:
return "__IAVF_STARTUP";
case __IAVF_REMOVE:
return "__IAVF_REMOVE";
case __IAVF_INIT_VERSION_CHECK:
return "__IAVF_INIT_VERSION_CHECK";
case __IAVF_INIT_GET_RESOURCES:
return "__IAVF_INIT_GET_RESOURCES";
case __IAVF_INIT_SW:
return "__IAVF_INIT_SW";
case __IAVF_INIT_FAILED:
return "__IAVF_INIT_FAILED";
case __IAVF_RESETTING:
return "__IAVF_RESETTING";
case __IAVF_COMM_FAILED:
return "__IAVF_COMM_FAILED";
case __IAVF_DOWN:
return "__IAVF_DOWN";
case __IAVF_DOWN_PENDING:
return "__IAVF_DOWN_PENDING";
case __IAVF_TESTING:
return "__IAVF_TESTING";
case __IAVF_RUNNING:
return "__IAVF_RUNNING";
default:
return "__IAVF_UNKNOWN_STATE";
}
}
static inline void iavf_change_state(struct iavf_adapter *adapter, static inline void iavf_change_state(struct iavf_adapter *adapter,
enum iavf_state_t state) enum iavf_state_t state)
{ {
@ -401,6 +433,10 @@ static inline void iavf_change_state(struct iavf_adapter *adapter,
adapter->last_state = adapter->state; adapter->last_state = adapter->state;
adapter->state = state; adapter->state = state;
} }
dev_dbg(&adapter->pdev->dev,
"state transition from:%s to:%s\n",
iavf_state_str(adapter->last_state),
iavf_state_str(adapter->state));
} }
int iavf_up(struct iavf_adapter *adapter); int iavf_up(struct iavf_adapter *adapter);

Просмотреть файл

@ -51,6 +51,15 @@ MODULE_LICENSE("GPL v2");
static const struct net_device_ops iavf_netdev_ops; static const struct net_device_ops iavf_netdev_ops;
struct workqueue_struct *iavf_wq; struct workqueue_struct *iavf_wq;
/**
* iavf_pdev_to_adapter - go from pci_dev to adapter
* @pdev: pci_dev pointer
*/
static struct iavf_adapter *iavf_pdev_to_adapter(struct pci_dev *pdev)
{
return netdev_priv(pci_get_drvdata(pdev));
}
/** /**
* iavf_allocate_dma_mem_d - OS specific memory alloc for shared code * iavf_allocate_dma_mem_d - OS specific memory alloc for shared code
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
@ -3271,6 +3280,13 @@ static int iavf_open(struct net_device *netdev)
goto err_unlock; goto err_unlock;
} }
if (adapter->state == __IAVF_RUNNING &&
!test_bit(__IAVF_VSI_DOWN, adapter->vsi.state)) {
dev_dbg(&adapter->pdev->dev, "VF is already open.\n");
err = 0;
goto err_unlock;
}
/* allocate transmit descriptors */ /* allocate transmit descriptors */
err = iavf_setup_all_tx_resources(adapter); err = iavf_setup_all_tx_resources(adapter);
if (err) if (err)
@ -3681,8 +3697,8 @@ int iavf_process_config(struct iavf_adapter *adapter)
**/ **/
static void iavf_shutdown(struct pci_dev *pdev) static void iavf_shutdown(struct pci_dev *pdev)
{ {
struct net_device *netdev = pci_get_drvdata(pdev); struct iavf_adapter *adapter = iavf_pdev_to_adapter(pdev);
struct iavf_adapter *adapter = netdev_priv(netdev); struct net_device *netdev = adapter->netdev;
netif_device_detach(netdev); netif_device_detach(netdev);
@ -3866,10 +3882,11 @@ static int __maybe_unused iavf_suspend(struct device *dev_d)
static int __maybe_unused iavf_resume(struct device *dev_d) static int __maybe_unused iavf_resume(struct device *dev_d)
{ {
struct pci_dev *pdev = to_pci_dev(dev_d); struct pci_dev *pdev = to_pci_dev(dev_d);
struct net_device *netdev = pci_get_drvdata(pdev); struct iavf_adapter *adapter;
struct iavf_adapter *adapter = netdev_priv(netdev);
u32 err; u32 err;
adapter = iavf_pdev_to_adapter(pdev);
pci_set_master(pdev); pci_set_master(pdev);
rtnl_lock(); rtnl_lock();
@ -3888,7 +3905,7 @@ static int __maybe_unused iavf_resume(struct device *dev_d)
queue_work(iavf_wq, &adapter->reset_task); queue_work(iavf_wq, &adapter->reset_task);
netif_device_attach(netdev); netif_device_attach(adapter->netdev);
return err; return err;
} }
@ -3904,8 +3921,9 @@ static int __maybe_unused iavf_resume(struct device *dev_d)
**/ **/
static void iavf_remove(struct pci_dev *pdev) static void iavf_remove(struct pci_dev *pdev)
{ {
struct net_device *netdev = pci_get_drvdata(pdev); struct iavf_adapter *adapter = iavf_pdev_to_adapter(pdev);
struct iavf_adapter *adapter = netdev_priv(netdev); enum iavf_state_t prev_state = adapter->last_state;
struct net_device *netdev = adapter->netdev;
struct iavf_fdir_fltr *fdir, *fdirtmp; struct iavf_fdir_fltr *fdir, *fdirtmp;
struct iavf_vlan_filter *vlf, *vlftmp; struct iavf_vlan_filter *vlf, *vlftmp;
struct iavf_adv_rss *rss, *rsstmp; struct iavf_adv_rss *rss, *rsstmp;
@ -3943,10 +3961,22 @@ static void iavf_remove(struct pci_dev *pdev)
iavf_change_state(adapter, __IAVF_REMOVE); iavf_change_state(adapter, __IAVF_REMOVE);
adapter->aq_required = 0; adapter->aq_required = 0;
adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED;
iavf_free_all_tx_resources(adapter); iavf_free_all_tx_resources(adapter);
iavf_free_all_rx_resources(adapter); iavf_free_all_rx_resources(adapter);
iavf_misc_irq_disable(adapter); iavf_misc_irq_disable(adapter);
iavf_free_misc_irq(adapter); iavf_free_misc_irq(adapter);
/* In case we enter iavf_remove from erroneous state, free traffic irqs
* here, so as to not cause a kernel crash, when calling
* iavf_reset_interrupt_capability.
*/
if ((adapter->last_state == __IAVF_RESETTING &&
prev_state != __IAVF_DOWN) ||
(adapter->last_state == __IAVF_RUNNING &&
!(netdev->flags & IFF_UP)))
iavf_free_traffic_irqs(adapter);
iavf_reset_interrupt_capability(adapter); iavf_reset_interrupt_capability(adapter);
iavf_free_q_vectors(adapter); iavf_free_q_vectors(adapter);

Просмотреть файл

@ -19,6 +19,7 @@
static int ice_eswitch_setup_env(struct ice_pf *pf) static int ice_eswitch_setup_env(struct ice_pf *pf)
{ {
struct ice_vsi *uplink_vsi = pf->switchdev.uplink_vsi; struct ice_vsi *uplink_vsi = pf->switchdev.uplink_vsi;
struct net_device *uplink_netdev = uplink_vsi->netdev;
struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi; struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi;
struct ice_port_info *pi = pf->hw.port_info; struct ice_port_info *pi = pf->hw.port_info;
bool rule_added = false; bool rule_added = false;
@ -27,6 +28,11 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)
ice_remove_vsi_fltr(&pf->hw, uplink_vsi->idx); ice_remove_vsi_fltr(&pf->hw, uplink_vsi->idx);
netif_addr_lock_bh(uplink_netdev);
__dev_uc_unsync(uplink_netdev, NULL);
__dev_mc_unsync(uplink_netdev, NULL);
netif_addr_unlock_bh(uplink_netdev);
if (ice_vsi_add_vlan(uplink_vsi, 0, ICE_FWD_TO_VSI)) if (ice_vsi_add_vlan(uplink_vsi, 0, ICE_FWD_TO_VSI))
goto err_def_rx; goto err_def_rx;

Просмотреть файл

@ -189,18 +189,19 @@ __ice_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo,
snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
"%x.%02x 0x%x %d.%d.%d", nvm->major, nvm->minor, "%x.%02x 0x%x %d.%d.%d", nvm->major, nvm->minor,
nvm->eetrack, orom->major, orom->build, orom->patch); nvm->eetrack, orom->major, orom->build, orom->patch);
strscpy(drvinfo->bus_info, pci_name(pf->pdev),
sizeof(drvinfo->bus_info));
} }
static void static void
ice_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) ice_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
{ {
struct ice_netdev_priv *np = netdev_priv(netdev); struct ice_netdev_priv *np = netdev_priv(netdev);
struct ice_pf *pf = np->vsi->back;
__ice_get_drvinfo(netdev, drvinfo, np->vsi); __ice_get_drvinfo(netdev, drvinfo, np->vsi);
strscpy(drvinfo->bus_info, pci_name(pf->pdev),
sizeof(drvinfo->bus_info));
drvinfo->n_priv_flags = ICE_PRIV_FLAG_ARRAY_SIZE; drvinfo->n_priv_flags = ICE_PRIV_FLAG_ARRAY_SIZE;
} }

Просмотреть файл

@ -2284,11 +2284,10 @@ bool ice_vsi_is_vlan_pruning_ena(struct ice_vsi *vsi)
* ice_cfg_vlan_pruning - enable or disable VLAN pruning on the VSI * ice_cfg_vlan_pruning - enable or disable VLAN pruning on the VSI
* @vsi: VSI to enable or disable VLAN pruning on * @vsi: VSI to enable or disable VLAN pruning on
* @ena: set to true to enable VLAN pruning and false to disable it * @ena: set to true to enable VLAN pruning and false to disable it
* @vlan_promisc: enable valid security flags if not in VLAN promiscuous mode
* *
* returns 0 if VSI is updated, negative otherwise * returns 0 if VSI is updated, negative otherwise
*/ */
int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena, bool vlan_promisc) int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena)
{ {
struct ice_vsi_ctx *ctxt; struct ice_vsi_ctx *ctxt;
struct ice_pf *pf; struct ice_pf *pf;
@ -2316,9 +2315,7 @@ int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena, bool vlan_promisc)
else else
ctxt->info.sw_flags2 &= ~ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA; ctxt->info.sw_flags2 &= ~ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;
if (!vlan_promisc) ctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_SW_VALID);
ctxt->info.valid_sections =
cpu_to_le16(ICE_AQ_VSI_PROP_SW_VALID);
status = ice_update_vsi(&pf->hw, vsi->idx, ctxt, NULL); status = ice_update_vsi(&pf->hw, vsi->idx, ctxt, NULL);
if (status) { if (status) {

Просмотреть файл

@ -45,7 +45,7 @@ int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi);
bool ice_vsi_is_vlan_pruning_ena(struct ice_vsi *vsi); bool ice_vsi_is_vlan_pruning_ena(struct ice_vsi *vsi);
int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena, bool vlan_promisc); int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena);
void ice_cfg_sw_lldp(struct ice_vsi *vsi, bool tx, bool create); void ice_cfg_sw_lldp(struct ice_vsi *vsi, bool tx, bool create);

Просмотреть файл

@ -396,7 +396,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)
~IFF_PROMISC; ~IFF_PROMISC;
goto out_promisc; goto out_promisc;
} }
ice_cfg_vlan_pruning(vsi, false, false); ice_cfg_vlan_pruning(vsi, false);
} }
} else { } else {
/* Clear Rx filter to remove traffic from wire */ /* Clear Rx filter to remove traffic from wire */
@ -410,7 +410,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)
goto out_promisc; goto out_promisc;
} }
if (vsi->num_vlan > 1) if (vsi->num_vlan > 1)
ice_cfg_vlan_pruning(vsi, true, false); ice_cfg_vlan_pruning(vsi, true);
} }
} }
} }
@ -3387,7 +3387,7 @@ ice_vlan_rx_add_vid(struct net_device *netdev, __always_unused __be16 proto,
/* Enable VLAN pruning when a VLAN other than 0 is added */ /* Enable VLAN pruning when a VLAN other than 0 is added */
if (!ice_vsi_is_vlan_pruning_ena(vsi)) { if (!ice_vsi_is_vlan_pruning_ena(vsi)) {
ret = ice_cfg_vlan_pruning(vsi, true, false); ret = ice_cfg_vlan_pruning(vsi, true);
if (ret) if (ret)
return ret; return ret;
} }
@ -3431,7 +3431,7 @@ ice_vlan_rx_kill_vid(struct net_device *netdev, __always_unused __be16 proto,
/* Disable pruning when VLAN 0 is the only VLAN rule */ /* Disable pruning when VLAN 0 is the only VLAN rule */
if (vsi->num_vlan == 1 && ice_vsi_is_vlan_pruning_ena(vsi)) if (vsi->num_vlan == 1 && ice_vsi_is_vlan_pruning_ena(vsi))
ret = ice_cfg_vlan_pruning(vsi, false, false); ret = ice_cfg_vlan_pruning(vsi, false);
set_bit(ICE_VSI_VLAN_FLTR_CHANGED, vsi->state); set_bit(ICE_VSI_VLAN_FLTR_CHANGED, vsi->state);
return ret; return ret;
@ -5616,10 +5616,10 @@ ice_set_features(struct net_device *netdev, netdev_features_t features)
if ((features & NETIF_F_HW_VLAN_CTAG_FILTER) && if ((features & NETIF_F_HW_VLAN_CTAG_FILTER) &&
!(netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) !(netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
ret = ice_cfg_vlan_pruning(vsi, true, false); ret = ice_cfg_vlan_pruning(vsi, true);
else if (!(features & NETIF_F_HW_VLAN_CTAG_FILTER) && else if (!(features & NETIF_F_HW_VLAN_CTAG_FILTER) &&
(netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) (netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
ret = ice_cfg_vlan_pruning(vsi, false, false); ret = ice_cfg_vlan_pruning(vsi, false);
if ((features & NETIF_F_NTUPLE) && if ((features & NETIF_F_NTUPLE) &&
!(netdev->features & NETIF_F_NTUPLE)) { !(netdev->features & NETIF_F_NTUPLE)) {

Просмотреть файл

@ -3072,7 +3072,10 @@ static int ice_vc_cfg_promiscuous_mode_msg(struct ice_vf *vf, u8 *msg)
v_ret = VIRTCHNL_STATUS_ERR_PARAM; v_ret = VIRTCHNL_STATUS_ERR_PARAM;
} }
ret = ice_cfg_vlan_pruning(vsi, true, !rm_promisc); if (rm_promisc)
ret = ice_cfg_vlan_pruning(vsi, true);
else
ret = ice_cfg_vlan_pruning(vsi, false);
if (ret) { if (ret) {
dev_err(dev, "Failed to configure VLAN pruning in promiscuous mode\n"); dev_err(dev, "Failed to configure VLAN pruning in promiscuous mode\n");
v_ret = VIRTCHNL_STATUS_ERR_PARAM; 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)
/* Enable VLAN pruning when non-zero VLAN is added */ /* Enable VLAN pruning when non-zero VLAN is added */
if (!vlan_promisc && vid && if (!vlan_promisc && vid &&
!ice_vsi_is_vlan_pruning_ena(vsi)) { !ice_vsi_is_vlan_pruning_ena(vsi)) {
status = ice_cfg_vlan_pruning(vsi, true, false); status = ice_cfg_vlan_pruning(vsi, true);
if (status) { if (status) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM; v_ret = VIRTCHNL_STATUS_ERR_PARAM;
dev_err(dev, "Enable VLAN pruning on VLAN ID: %d failed error-%d\n", 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)
/* Disable VLAN pruning when only VLAN 0 is left */ /* Disable VLAN pruning when only VLAN 0 is left */
if (vsi->num_vlan == 1 && if (vsi->num_vlan == 1 &&
ice_vsi_is_vlan_pruning_ena(vsi)) ice_vsi_is_vlan_pruning_ena(vsi))
ice_cfg_vlan_pruning(vsi, false, false); ice_cfg_vlan_pruning(vsi, false);
/* Disable Unicast/Multicast VLAN promiscuous mode */ /* Disable Unicast/Multicast VLAN promiscuous mode */
if (vlan_promisc) { if (vlan_promisc) {

Просмотреть файл

@ -238,27 +238,26 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
* VIRTCHNL_VF_OFFLOAD_L2 flag is inclusive of base mode L2 offloads including * VIRTCHNL_VF_OFFLOAD_L2 flag is inclusive of base mode L2 offloads including
* TX/RX Checksum offloading and TSO for non-tunnelled packets. * TX/RX Checksum offloading and TSO for non-tunnelled packets.
*/ */
#define VIRTCHNL_VF_OFFLOAD_L2 0x00000001 #define VIRTCHNL_VF_OFFLOAD_L2 BIT(0)
#define VIRTCHNL_VF_OFFLOAD_IWARP 0x00000002 #define VIRTCHNL_VF_OFFLOAD_IWARP BIT(1)
#define VIRTCHNL_VF_OFFLOAD_RSVD 0x00000004 #define VIRTCHNL_VF_OFFLOAD_RSS_AQ BIT(3)
#define VIRTCHNL_VF_OFFLOAD_RSS_AQ 0x00000008 #define VIRTCHNL_VF_OFFLOAD_RSS_REG BIT(4)
#define VIRTCHNL_VF_OFFLOAD_RSS_REG 0x00000010 #define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR BIT(5)
#define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR 0x00000020 #define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES BIT(6)
#define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES 0x00000040 /* used to negotiate communicating link speeds in Mbps */
#define VIRTCHNL_VF_OFFLOAD_VLAN 0x00010000 #define VIRTCHNL_VF_CAP_ADV_LINK_SPEED BIT(7)
#define VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000 #define VIRTCHNL_VF_OFFLOAD_VLAN BIT(16)
#define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000 #define VIRTCHNL_VF_OFFLOAD_RX_POLLING BIT(17)
#define VIRTCHNL_VF_OFFLOAD_RSS_PF 0X00080000 #define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 BIT(18)
#define VIRTCHNL_VF_OFFLOAD_ENCAP 0X00100000 #define VIRTCHNL_VF_OFFLOAD_RSS_PF BIT(19)
#define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00200000 #define VIRTCHNL_VF_OFFLOAD_ENCAP BIT(20)
#define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM 0X00400000 #define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM BIT(21)
#define VIRTCHNL_VF_OFFLOAD_ADQ 0X00800000 #define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM BIT(22)
#define VIRTCHNL_VF_OFFLOAD_USO 0X02000000 #define VIRTCHNL_VF_OFFLOAD_ADQ BIT(23)
#define VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF 0X08000000 #define VIRTCHNL_VF_OFFLOAD_USO BIT(25)
#define VIRTCHNL_VF_OFFLOAD_FDIR_PF 0X10000000 #define VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF BIT(27)
#define VIRTCHNL_VF_OFFLOAD_FDIR_PF BIT(28)
/* Define below the capability flags that are not offloads */
#define VIRTCHNL_VF_CAP_ADV_LINK_SPEED 0x00000080
#define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \ #define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
VIRTCHNL_VF_OFFLOAD_VLAN | \ VIRTCHNL_VF_OFFLOAD_VLAN | \
VIRTCHNL_VF_OFFLOAD_RSS_PF) VIRTCHNL_VF_OFFLOAD_RSS_PF)