Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
authorDavid S. Miller <davem@davemloft.net>
Thu, 27 Jun 2019 17:49:06 +0000 (10:49 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 27 Jun 2019 17:49:06 +0000 (10:49 -0700)
Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates 2019-06-26

This series contains updates to ixgbe and i40e only.

Mauro S. M. Rodrigues update the ixgbe driver to handle transceivers who
comply with SFF-8472 but do not implement the Digital Diagnostic
Monitoring (DOM) interface.  Update the driver to check the necessary
bits to see if DOM is implemented before trying to read the additional
256 bytes in the EEPROM for DOM data.

Young Xiao fixes a potential divide by zero issue in ixgbe driver.

Aleksandr fixes i40e to recognize 2.5 and 5.0 GbE link speeds so that it
is not reported as "Unknown bps".  Fixes the driver to read the firmware
LLDP agent status during DCB initialization, and to properly log the
LLDP agent status to help with debugging when DCB fails to initialize.

Martyna fixes i40e for the missing supported and advertised link modes
information in ethtool.

Jake fixes a function header comment that was incorrect for a PTP
function in i40e.

Maciej fixes an issue for i40e when a XDP program is loaded the
descriptor count gets reset to the default value, resolve the issue by
making the current descriptor count persistent across resets.

Alice corrects a copyright date which she found to be incorrect.

Piotr adds a log entry when the traffic class 0 is added or deleted, which
was not being logged previously.

Gustavo A. R. Silva updates i40e to use struct_size() where possible.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
12 files changed:
drivers/net/ethernet/intel/i40e/i40e.h
drivers/net/ethernet/intel/i40e/i40e_common.c
drivers/net/ethernet/intel/i40e/i40e_debugfs.c
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/i40e/i40e_prototype.h
drivers/net/ethernet/intel/i40e/i40e_ptp.c
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
include/linux/avf/virtchnl.h

index 8dc98d1..24e6ce6 100644 (file)
@@ -775,7 +775,8 @@ struct i40e_vsi {
        u16 alloc_queue_pairs;  /* Allocated Tx/Rx queues */
        u16 req_queue_pairs;    /* User requested queue pairs */
        u16 num_queue_pairs;    /* Used tx and rx pairs */
-       u16 num_desc;
+       u16 num_tx_desc;
+       u16 num_rx_desc;
        enum i40e_vsi_type type;  /* VSI type, e.g., LAN, FCoE, etc */
        s16 vf_id;              /* Virtual function ID for SRIOV VSIs */
 
index 641b500..906cf68 100644 (file)
@@ -1861,8 +1861,7 @@ i40e_status i40e_aq_get_link_info(struct i40e_hw *hw,
             hw->aq.fw_min_ver < 40)) && hw_link_info->phy_type == 0xE)
                hw_link_info->phy_type = I40E_PHY_TYPE_10GBASE_SFPP_CU;
 
-       if (hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
-           hw->aq.api_min_ver >= 7) {
+       if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE) {
                __le32 tmp;
 
                memcpy(&tmp, resp->link_type, sizeof(tmp));
index dc5b400..55d20ac 100644 (file)
@@ -333,8 +333,9 @@ static void i40e_dbg_dump_vsi_seid(struct i40e_pf *pf, int seid)
                 "    seid = %d, id = %d, uplink_seid = %d\n",
                 vsi->seid, vsi->id, vsi->uplink_seid);
        dev_info(&pf->pdev->dev,
-                "    base_queue = %d, num_queue_pairs = %d, num_desc = %d\n",
-                vsi->base_queue, vsi->num_queue_pairs, vsi->num_desc);
+                "    base_queue = %d, num_queue_pairs = %d, num_tx_desc = %d, num_rx_desc = %d\n",
+                vsi->base_queue, vsi->num_queue_pairs, vsi->num_tx_desc,
+                vsi->num_rx_desc);
        dev_info(&pf->pdev->dev, "    type = %i\n", vsi->type);
        if (vsi->type == I40E_VSI_SRIOV)
                dev_info(&pf->pdev->dev, "    VF ID = %i\n", vsi->vf_id);
index a6c5e10..527eb52 100644 (file)
@@ -1982,6 +1982,8 @@ static int i40e_set_ringparam(struct net_device *netdev,
                        if (i40e_enabled_xdp_vsi(vsi))
                                vsi->xdp_rings[i]->count = new_tx_count;
                }
+               vsi->num_tx_desc = new_tx_count;
+               vsi->num_rx_desc = new_rx_count;
                goto done;
        }
 
@@ -2118,6 +2120,8 @@ rx_unwind:
                rx_rings = NULL;
        }
 
+       vsi->num_tx_desc = new_tx_count;
+       vsi->num_rx_desc = new_rx_count;
        i40e_up(vsi);
 
 free_tx:
index 7c43ec5..8b0c29b 100644 (file)
@@ -32,7 +32,7 @@ static const char i40e_driver_string[] =
             __stringify(DRV_VERSION_MINOR) "." \
             __stringify(DRV_VERSION_BUILD)    DRV_KERN
 const char i40e_driver_version_str[] = DRV_VERSION;
-static const char i40e_copyright[] = "Copyright (c) 2013 - 2014 Intel Corporation.";
+static const char i40e_copyright[] = "Copyright (c) 2013 - 2019 Intel Corporation.";
 
 /* a bit of forward declarations */
 static void i40e_vsi_reinit_locked(struct i40e_vsi *vsi);
@@ -6410,6 +6410,50 @@ static int i40e_resume_port_tx(struct i40e_pf *pf)
 }
 
 /**
+ * i40e_update_dcb_config
+ * @hw: pointer to the HW struct
+ * @enable_mib_change: enable MIB change event
+ *
+ * Update DCB configuration from the firmware
+ **/
+static enum i40e_status_code
+i40e_update_dcb_config(struct i40e_hw *hw, bool enable_mib_change)
+{
+       struct i40e_lldp_variables lldp_cfg;
+       i40e_status ret;
+
+       if (!hw->func_caps.dcb)
+               return I40E_NOT_SUPPORTED;
+
+       /* Read LLDP NVM area */
+       ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
+       if (ret)
+               return I40E_ERR_NOT_READY;
+
+       /* Get DCBX status */
+       ret = i40e_get_dcbx_status(hw, &hw->dcbx_status);
+       if (ret)
+               return ret;
+
+       /* Check the DCBX Status */
+       if (hw->dcbx_status == I40E_DCBX_STATUS_DONE ||
+           hw->dcbx_status == I40E_DCBX_STATUS_IN_PROGRESS) {
+               /* Get current DCBX configuration */
+               ret = i40e_get_dcb_config(hw);
+               if (ret)
+                       return ret;
+       } else if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED) {
+               return I40E_ERR_NOT_READY;
+       }
+
+       /* Configure the LLDP MIB change event */
+       if (enable_mib_change)
+               ret = i40e_aq_cfg_lldp_mib_change_event(hw, true, NULL);
+
+       return ret;
+}
+
+/**
  * i40e_init_pf_dcb - Initialize DCB configuration
  * @pf: PF being configured
  *
@@ -6425,11 +6469,13 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf)
         * Also do not enable DCBx if FW LLDP agent is disabled
         */
        if ((pf->hw_features & I40E_HW_NO_DCB_SUPPORT) ||
-           (pf->flags & I40E_FLAG_DISABLE_FW_LLDP))
+           (pf->flags & I40E_FLAG_DISABLE_FW_LLDP)) {
+               dev_info(&pf->pdev->dev, "DCB is not supported or FW LLDP is disabled\n");
+               err = I40E_NOT_SUPPORTED;
                goto out;
+       }
 
-       /* Get the initial DCB configuration */
-       err = i40e_init_dcb(hw, true);
+       err = i40e_update_dcb_config(hw, true);
        if (!err) {
                /* Device/Function is not DCBX capable */
                if ((!hw->func_caps.dcb) ||
@@ -6960,6 +7006,10 @@ config_tc:
                            vsi->seid);
                need_reset = true;
                goto exit;
+       } else {
+               dev_info(&vsi->back->pdev->dev,
+                        "Setup channel (id:%u) utilizing num_queues %d\n",
+                        vsi->seid, vsi->tc_config.tc_info[0].qcount);
        }
 
        if (pf->flags & I40E_FLAG_TC_MQPRIO) {
@@ -10028,8 +10078,12 @@ static int i40e_set_num_rings_in_vsi(struct i40e_vsi *vsi)
        switch (vsi->type) {
        case I40E_VSI_MAIN:
                vsi->alloc_queue_pairs = pf->num_lan_qps;
-               vsi->num_desc = ALIGN(I40E_DEFAULT_NUM_DESCRIPTORS,
-                                     I40E_REQ_DESCRIPTOR_MULTIPLE);
+               if (!vsi->num_tx_desc)
+                       vsi->num_tx_desc = ALIGN(I40E_DEFAULT_NUM_DESCRIPTORS,
+                                                I40E_REQ_DESCRIPTOR_MULTIPLE);
+               if (!vsi->num_rx_desc)
+                       vsi->num_rx_desc = ALIGN(I40E_DEFAULT_NUM_DESCRIPTORS,
+                                                I40E_REQ_DESCRIPTOR_MULTIPLE);
                if (pf->flags & I40E_FLAG_MSIX_ENABLED)
                        vsi->num_q_vectors = pf->num_lan_msix;
                else
@@ -10039,22 +10093,32 @@ static int i40e_set_num_rings_in_vsi(struct i40e_vsi *vsi)
 
        case I40E_VSI_FDIR:
                vsi->alloc_queue_pairs = 1;
-               vsi->num_desc = ALIGN(I40E_FDIR_RING_COUNT,
-                                     I40E_REQ_DESCRIPTOR_MULTIPLE);
+               vsi->num_tx_desc = ALIGN(I40E_FDIR_RING_COUNT,
+                                        I40E_REQ_DESCRIPTOR_MULTIPLE);
+               vsi->num_rx_desc = ALIGN(I40E_FDIR_RING_COUNT,
+                                        I40E_REQ_DESCRIPTOR_MULTIPLE);
                vsi->num_q_vectors = pf->num_fdsb_msix;
                break;
 
        case I40E_VSI_VMDQ2:
                vsi->alloc_queue_pairs = pf->num_vmdq_qps;
-               vsi->num_desc = ALIGN(I40E_DEFAULT_NUM_DESCRIPTORS,
-                                     I40E_REQ_DESCRIPTOR_MULTIPLE);
+               if (!vsi->num_tx_desc)
+                       vsi->num_tx_desc = ALIGN(I40E_DEFAULT_NUM_DESCRIPTORS,
+                                                I40E_REQ_DESCRIPTOR_MULTIPLE);
+               if (!vsi->num_rx_desc)
+                       vsi->num_rx_desc = ALIGN(I40E_DEFAULT_NUM_DESCRIPTORS,
+                                                I40E_REQ_DESCRIPTOR_MULTIPLE);
                vsi->num_q_vectors = pf->num_vmdq_msix;
                break;
 
        case I40E_VSI_SRIOV:
                vsi->alloc_queue_pairs = pf->num_vf_qps;
-               vsi->num_desc = ALIGN(I40E_DEFAULT_NUM_DESCRIPTORS,
-                                     I40E_REQ_DESCRIPTOR_MULTIPLE);
+               if (!vsi->num_tx_desc)
+                       vsi->num_tx_desc = ALIGN(I40E_DEFAULT_NUM_DESCRIPTORS,
+                                                I40E_REQ_DESCRIPTOR_MULTIPLE);
+               if (!vsi->num_rx_desc)
+                       vsi->num_rx_desc = ALIGN(I40E_DEFAULT_NUM_DESCRIPTORS,
+                                                I40E_REQ_DESCRIPTOR_MULTIPLE);
                break;
 
        default:
@@ -10330,7 +10394,7 @@ static int i40e_alloc_rings(struct i40e_vsi *vsi)
                ring->vsi = vsi;
                ring->netdev = vsi->netdev;
                ring->dev = &pf->pdev->dev;
-               ring->count = vsi->num_desc;
+               ring->count = vsi->num_tx_desc;
                ring->size = 0;
                ring->dcb_tc = 0;
                if (vsi->back->hw_features & I40E_HW_WB_ON_ITR_CAPABLE)
@@ -10347,7 +10411,7 @@ static int i40e_alloc_rings(struct i40e_vsi *vsi)
                ring->vsi = vsi;
                ring->netdev = NULL;
                ring->dev = &pf->pdev->dev;
-               ring->count = vsi->num_desc;
+               ring->count = vsi->num_tx_desc;
                ring->size = 0;
                ring->dcb_tc = 0;
                if (vsi->back->hw_features & I40E_HW_WB_ON_ITR_CAPABLE)
@@ -10363,7 +10427,7 @@ setup_rx:
                ring->vsi = vsi;
                ring->netdev = vsi->netdev;
                ring->dev = &pf->pdev->dev;
-               ring->count = vsi->num_desc;
+               ring->count = vsi->num_rx_desc;
                ring->size = 0;
                ring->dcb_tc = 0;
                ring->itr_setting = pf->rx_itr_default;
@@ -14397,6 +14461,11 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        pci_set_drvdata(pdev, pf);
        pci_save_state(pdev);
 
+       dev_info(&pdev->dev,
+                (pf->flags & I40E_FLAG_DISABLE_FW_LLDP) ?
+                       "FW LLDP is disabled\n" :
+                       "FW LLDP is enabled\n");
+
        /* Enable FW to write default DCB config on link-up */
        i40e_aq_set_dcb_parameters(hw, true, NULL);
 
index 8826270..eac88bc 100644 (file)
@@ -350,6 +350,10 @@ i40e_virtchnl_link_speed(enum i40e_aq_link_speed link_speed)
                return VIRTCHNL_LINK_SPEED_100MB;
        case I40E_LINK_SPEED_1GB:
                return VIRTCHNL_LINK_SPEED_1GB;
+       case I40E_LINK_SPEED_2_5GB:
+               return VIRTCHNL_LINK_SPEED_2_5GB;
+       case I40E_LINK_SPEED_5GB:
+               return VIRTCHNL_LINK_SPEED_5GB;
        case I40E_LINK_SPEED_10GB:
                return VIRTCHNL_LINK_SPEED_10GB;
        case I40E_LINK_SPEED_40GB:
index 439c35f..11394a5 100644 (file)
@@ -140,8 +140,7 @@ static int i40e_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
  * @ptp: The PTP clock structure
  * @delta: Offset in nanoseconds to adjust the PHC time by
  *
- * Adjust the frequency of the PHC by the indicated parts per billion from the
- * base frequency.
+ * Adjust the current clock time by a delta specified in nanoseconds.
  **/
 static int i40e_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
 {
index ac3a130..02b09a8 100644 (file)
@@ -440,7 +440,7 @@ static int i40e_config_iwarp_qvlist(struct i40e_vf *vf,
        struct virtchnl_iwarp_qv_info *qv_info;
        u32 v_idx, i, reg_idx, reg;
        u32 next_q_idx, next_q_type;
-       u32 msix_vf, size;
+       u32 msix_vf;
        int ret = 0;
 
        msix_vf = pf->hw.func_caps.num_msix_vectors_vf;
@@ -454,11 +454,10 @@ static int i40e_config_iwarp_qvlist(struct i40e_vf *vf,
                goto err_out;
        }
 
-       size = sizeof(struct virtchnl_iwarp_qvlist_info) +
-              (sizeof(struct virtchnl_iwarp_qv_info) *
-                                               (qvlist_info->num_vectors - 1));
        kfree(vf->qvlist_info);
-       vf->qvlist_info = kzalloc(size, GFP_KERNEL);
+       vf->qvlist_info = kzalloc(struct_size(vf->qvlist_info, qv_info,
+                                             qvlist_info->num_vectors - 1),
+                                 GFP_KERNEL);
        if (!vf->qvlist_info) {
                ret = -ENOMEM;
                goto err_out;
@@ -1846,7 +1845,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
        i40e_status aq_ret = 0;
        struct i40e_vsi *vsi;
        int num_vsis = 1;
-       int len = 0;
+       size_t len = 0;
        int ret;
 
        if (!test_bit(I40E_VF_STATE_INIT, &vf->vf_states)) {
@@ -1854,9 +1853,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
                goto err;
        }
 
-       len = (sizeof(struct virtchnl_vf_resource) +
-              sizeof(struct virtchnl_vsi_resource) * num_vsis);
-
+       len = struct_size(vfres, vsi_res, num_vsis);
        vfres = kzalloc(len, GFP_KERNEL);
        if (!vfres) {
                aq_ret = I40E_ERR_NO_MEMORY;
index acba067..7c52ae8 100644 (file)
@@ -3226,7 +3226,8 @@ static int ixgbe_get_module_info(struct net_device *dev,
                page_swap = true;
        }
 
-       if (sff8472_rev == IXGBE_SFF_SFF_8472_UNSUP || page_swap) {
+       if (sff8472_rev == IXGBE_SFF_SFF_8472_UNSUP || page_swap ||
+           !(addr_mode & IXGBE_SFF_DDM_IMPLEMENTED)) {
                /* We have a SFP, but it does not support SFF-8472 */
                modinfo->type = ETH_MODULE_SFF_8079;
                modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN;
index 214b010..6544c45 100644 (file)
@@ -45,6 +45,7 @@
 #define IXGBE_SFF_SOFT_RS_SELECT_10G           0x8
 #define IXGBE_SFF_SOFT_RS_SELECT_1G            0x0
 #define IXGBE_SFF_ADDRESSING_MODE              0x4
+#define IXGBE_SFF_DDM_IMPLEMENTED              0x40
 #define IXGBE_SFF_QSFP_DA_ACTIVE_CABLE         0x1
 #define IXGBE_SFF_QSFP_DA_PASSIVE_CABLE                0x8
 #define IXGBE_SFF_QSFP_CONNECTOR_NOT_SEPARABLE 0x23
index d189ed2..d2b41f9 100644 (file)
@@ -1423,6 +1423,9 @@ static void ixgbevf_update_itr(struct ixgbevf_q_vector *q_vector,
         */
        /* what was last interrupt timeslice? */
        timepassed_us = q_vector->itr >> 2;
+       if (timepassed_us == 0)
+               return;
+
        bytes_perint = bytes / timepassed_us; /* bytes/usec */
 
        switch (itr_setting) {
index 191621f..ca956b6 100644 (file)
@@ -61,12 +61,14 @@ enum virtchnl_status_code {
 #define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM
 #define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
 
+#define VIRTCHNL_LINK_SPEED_2_5GB_SHIFT                0x0
 #define VIRTCHNL_LINK_SPEED_100MB_SHIFT                0x1
 #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT       0x2
 #define VIRTCHNL_LINK_SPEED_10GB_SHIFT         0x3
 #define VIRTCHNL_LINK_SPEED_40GB_SHIFT         0x4
 #define VIRTCHNL_LINK_SPEED_20GB_SHIFT         0x5
 #define VIRTCHNL_LINK_SPEED_25GB_SHIFT         0x6
+#define VIRTCHNL_LINK_SPEED_5GB_SHIFT          0x7
 
 enum virtchnl_link_speed {
        VIRTCHNL_LINK_SPEED_UNKNOWN     = 0,
@@ -76,6 +78,8 @@ enum virtchnl_link_speed {
        VIRTCHNL_LINK_SPEED_40GB        = BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT),
        VIRTCHNL_LINK_SPEED_20GB        = BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT),
        VIRTCHNL_LINK_SPEED_25GB        = BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT),
+       VIRTCHNL_LINK_SPEED_2_5GB       = BIT(VIRTCHNL_LINK_SPEED_2_5GB_SHIFT),
+       VIRTCHNL_LINK_SPEED_5GB         = BIT(VIRTCHNL_LINK_SPEED_5GB_SHIFT),
 };
 
 /* for hsplit_0 field of Rx HMC context */