]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net...
authorDavid S. Miller <davem@davemloft.net>
Wed, 4 Mar 2015 01:47:23 +0000 (20:47 -0500)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 Mar 2015 01:47:23 +0000 (20:47 -0500)
Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates 2015-03-03

This series contains updates to fm10k, i40e and i40evf.

Matthew updates the fm10k driver by cleaning up code comments and whitespace
issues.  Also modifies the tunnel length header check, to make it more robust
by calculating the inner L4 header length based on whether it is TCP or UDP.
Implemented ndo_features_check() that allows drivers to report their offload
capabilities per-skb.

Neerav updates the i40e driver to skip over priority tagging if DCB is not
enabled.  Fixes an issue where the driver is not flushing out the
DCBNL app table for applications that are not present in the local DCBX
application configuration TLVs.  Fixed i40e where, in the case of MFP
mode, the driver was returning the incorrect number of traffic classes
for partitions that are not enabled for iSCSI.  Even though the driver
was not configuring these traffic classes in the transmit scheduler for
the NIC partitions, it does use this map to setup the queue mappings.

Shannon updates i40e/i40evf to include the firmware build number in the
formatted firmware version string.

Akeem adds a safety net (by adding a 'default' case) for the possible
unmatched switch calls.

Mitch updates i40e to not automatically disable PF loopback at runtime,
now that we have the functionality to enable and disable PF loopback.  This
fix cleans up a bogus error message when removing the PF module with VFs
enabled.  Adds a extra check to make sure that the indirection table
pointer is valid before dereferencing it.

Anjali enables i40e to enable more than the max RSS qps when running in a
single TC mode for the main VSI.  It is possible to enable as many as
num_online_cpus().  Adds a firmware check to ensure that DCB is disabled for
firmware versions older than 4.33.  Updates i40e/i40evf to add missing
packet types for VXLAN offload.  Updated i40e to be able to handle varying
RSS table size for each VSI, since all VSI's do not have the same RSS table
size.

v2: Dropped previous patch #9 "i40e/i40evf: Add capability to gather VEB
    per TC stats" since the stats should be in ethtool and not debugfs.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
1  2 
drivers/net/ethernet/intel/i40e/i40e.h
drivers/net/ethernet/intel/i40e/i40e_main.c

index 5761917734dc7bb036d34ebb4171dba2b638d977,cfc1d8a52e42deffd88664768297bf30a01bc972..c5137313b62a3bd97bd1bfa880df902735eb6627
@@@ -471,6 -471,9 +471,9 @@@ struct i40e_vsi 
        u16 rx_itr_setting;
        u16 tx_itr_setting;
  
+       u16 rss_table_size;
+       u16 rss_size;
        u16 max_frame;
        u16 rx_hdr_len;
        u16 rx_buf_len;
  
        u16 base_queue;      /* vsi's first queue in hw array */
        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;
        enum i40e_vsi_type type;  /* VSI type, e.g., LAN, FCoE, etc */
@@@ -557,14 -561,14 +561,14 @@@ static inline char *i40e_fw_version_str
        static char buf[32];
  
        snprintf(buf, sizeof(buf),
-                "f%d.%d a%d.%d n%02x.%02x e%08x",
-                hw->aq.fw_maj_ver, hw->aq.fw_min_ver,
+                "f%d.%d.%05d a%d.%d n%x.%02x e%x",
+                hw->aq.fw_maj_ver, hw->aq.fw_min_ver, hw->aq.fw_build,
                 hw->aq.api_maj_ver, hw->aq.api_min_ver,
                 (hw->nvm.version & I40E_NVM_VERSION_HI_MASK) >>
                        I40E_NVM_VERSION_HI_SHIFT,
                 (hw->nvm.version & I40E_NVM_VERSION_LO_MASK) >>
                        I40E_NVM_VERSION_LO_SHIFT,
-                hw->nvm.eetrack);
+                (hw->nvm.eetrack & 0xffffff));
  
        return buf;
  }
@@@ -725,6 -729,7 +729,7 @@@ void i40e_fcoe_handle_status(struct i40
  void i40e_vlan_stripping_enable(struct i40e_vsi *vsi);
  #ifdef CONFIG_I40E_DCB
  void i40e_dcbnl_flush_apps(struct i40e_pf *pf,
+                          struct i40e_dcbx_config *old_cfg,
                           struct i40e_dcbx_config *new_cfg);
  void i40e_dcbnl_set_all(struct i40e_vsi *vsi);
  void i40e_dcbnl_setup(struct i40e_vsi *vsi);
@@@ -741,10 -746,10 +746,10 @@@ int i40e_ptp_get_ts_config(struct i40e_
  void i40e_ptp_init(struct i40e_pf *pf);
  void i40e_ptp_stop(struct i40e_pf *pf);
  int i40e_is_vsi_uplink_mode_veb(struct i40e_vsi *vsi);
 -#if IS_ENABLED(CONFIG_CONFIGFS_FS)
 +#if IS_ENABLED(CONFIG_I40E_CONFIGFS_FS)
  int i40e_configfs_init(void);
  void i40e_configfs_exit(void);
 -#endif /* CONFIG_CONFIGFS_FS */
 +#endif /* CONFIG_I40E_CONFIGFS_FS */
  i40e_status i40e_get_npar_bw_setting(struct i40e_pf *pf);
  i40e_status i40e_set_npar_bw_setting(struct i40e_pf *pf);
  i40e_status i40e_commit_npar_bw_setting(struct i40e_pf *pf);
index aadc604329808f7c503130472251a60800788cf9,3c4f4192feff1b1c29b76e37d30a5d48069fc7b9..c3858e7f0e66f032de3899082e29cfbfdea056b9
@@@ -39,7 -39,7 +39,7 @@@ static const char i40e_driver_string[] 
  
  #define DRV_VERSION_MAJOR 1
  #define DRV_VERSION_MINOR 2
- #define DRV_VERSION_BUILD 9
+ #define DRV_VERSION_BUILD 10
  #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
             __stringify(DRV_VERSION_MINOR) "." \
             __stringify(DRV_VERSION_BUILD)    DRV_KERN
@@@ -1566,6 -1566,12 +1566,12 @@@ static void i40e_vsi_setup_queue_map(st
  
        /* Set actual Tx/Rx queue pairs */
        vsi->num_queue_pairs = offset;
+       if ((vsi->type == I40E_VSI_MAIN) && (numtc == 1)) {
+               if (vsi->req_queue_pairs > 0)
+                       vsi->num_queue_pairs = vsi->req_queue_pairs;
+               else
+                       vsi->num_queue_pairs = pf->num_lan_msix;
+       }
  
        /* Scheduler section valid can only be set for ADD VSI */
        if (is_add) {
@@@ -4101,7 -4107,7 +4107,7 @@@ static u8 i40e_pf_get_num_tc(struct i40
        if (pf->hw.func_caps.iscsi)
                enabled_tc =  i40e_get_iscsi_tc_map(pf);
        else
-               enabled_tc = pf->hw.func_caps.enabled_tcmap;
+               return 1; /* Only TC0 */
  
        /* At least have TC0 */
        enabled_tc = (enabled_tc ? enabled_tc : 0x1);
@@@ -4151,11 -4157,11 +4157,11 @@@ static u8 i40e_pf_get_tc_map(struct i40
        if (!(pf->flags & I40E_FLAG_MFP_ENABLED))
                return i40e_dcb_get_enabled_tc(&pf->hw.local_dcbx_config);
  
-       /* MPF enabled and iSCSI PF type */
+       /* MFP enabled and iSCSI PF type */
        if (pf->hw.func_caps.iscsi)
                return i40e_get_iscsi_tc_map(pf);
        else
-               return pf->hw.func_caps.enabled_tcmap;
+               return i40e_pf_get_default_tc(pf);
  }
  
  /**
@@@ -4545,6 -4551,11 +4551,11 @@@ static int i40e_init_pf_dcb(struct i40e
        struct i40e_hw *hw = &pf->hw;
        int err = 0;
  
+       /* Do not enable DCB for SW1 and SW2 images even if the FW is capable */
+       if (((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver < 33)) ||
+           (pf->hw.aq.fw_maj_ver < 4))
+               goto out;
        /* Get the initial DCB configuration */
        err = i40e_init_dcb(hw);
        if (!err) {
@@@ -5155,7 -5166,6 +5166,6 @@@ static int i40e_handle_lldp_event(struc
        struct i40e_aqc_lldp_get_mib *mib =
                (struct i40e_aqc_lldp_get_mib *)&e->desc.params.raw;
        struct i40e_hw *hw = &pf->hw;
-       struct i40e_dcbx_config *dcbx_cfg = &hw->local_dcbx_config;
        struct i40e_dcbx_config tmp_dcbx_cfg;
        bool need_reconfig = false;
        int ret = 0;
  
        memset(&tmp_dcbx_cfg, 0, sizeof(tmp_dcbx_cfg));
        /* Store the old configuration */
-       tmp_dcbx_cfg = *dcbx_cfg;
+       memcpy(&tmp_dcbx_cfg, &hw->local_dcbx_config, sizeof(tmp_dcbx_cfg));
  
+       /* Reset the old DCBx configuration data */
+       memset(&hw->local_dcbx_config, 0, sizeof(hw->local_dcbx_config));
        /* Get updated DCBX data from firmware */
        ret = i40e_get_dcb_config(&pf->hw);
        if (ret) {
        }
  
        /* No change detected in DCBX configs */
-       if (!memcmp(&tmp_dcbx_cfg, dcbx_cfg, sizeof(tmp_dcbx_cfg))) {
+       if (!memcmp(&tmp_dcbx_cfg, &hw->local_dcbx_config,
+                   sizeof(tmp_dcbx_cfg))) {
                dev_dbg(&pf->pdev->dev, "No change detected in DCBX configuration.\n");
                goto exit;
        }
  
-       need_reconfig = i40e_dcb_need_reconfig(pf, &tmp_dcbx_cfg, dcbx_cfg);
+       need_reconfig = i40e_dcb_need_reconfig(pf, &tmp_dcbx_cfg,
+                                              &hw->local_dcbx_config);
  
-       i40e_dcbnl_flush_apps(pf, dcbx_cfg);
+       i40e_dcbnl_flush_apps(pf, &tmp_dcbx_cfg, &hw->local_dcbx_config);
  
        if (!need_reconfig)
                goto exit;
  
        /* Enable DCB tagging only when more than one TC */
-       if (i40e_dcb_get_num_tc(dcbx_cfg) > 1)
+       if (i40e_dcb_get_num_tc(&hw->local_dcbx_config) > 1)
                pf->flags |= I40E_FLAG_DCB_ENABLED;
        else
                pf->flags &= ~I40E_FLAG_DCB_ENABLED;
@@@ -6305,13 -6319,14 +6319,14 @@@ static void i40e_reset_and_rebuild(stru
                }
        }
  
-       msleep(75);
-       ret = i40e_aq_set_link_restart_an(&pf->hw, true, NULL);
-       if (ret) {
-               dev_info(&pf->pdev->dev, "link restart failed, aq_err=%d\n",
-                        pf->hw.aq.asq_last_status);
+       if (((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver < 33)) ||
+           (pf->hw.aq.fw_maj_ver < 4)) {
+               msleep(75);
+               ret = i40e_aq_set_link_restart_an(&pf->hw, true, NULL);
+               if (ret)
+                       dev_info(&pf->pdev->dev, "link restart failed, aq_err=%d\n",
+                                pf->hw.aq.asq_last_status);
        }
        /* reinit the misc interrupt */
        if (pf->flags & I40E_FLAG_MSIX_ENABLED)
                ret = i40e_setup_misc_vector(pf);
@@@ -6698,6 -6713,8 +6713,8 @@@ static int i40e_vsi_mem_alloc(struct i4
        vsi->idx = vsi_idx;
        vsi->rx_itr_setting = pf->rx_itr_default;
        vsi->tx_itr_setting = pf->tx_itr_default;
+       vsi->rss_table_size = (vsi->type == I40E_VSI_MAIN) ?
+                               pf->rss_table_size : 64;
        vsi->netdev_registered = false;
        vsi->work_limit = I40E_DEFAULT_IRQ_WORK;
        INIT_LIST_HEAD(&vsi->mac_filter_list);
@@@ -6921,7 -6938,8 +6938,8 @@@ static int i40e_init_msix(struct i40e_p
         * If we can't get what we want, we'll simplify to nearly nothing
         * and try again.  If that still fails, we punt.
         */
-       pf->num_lan_msix = pf->num_lan_qps - (pf->rss_size_max - pf->rss_size);
+       pf->num_lan_msix = min_t(int, num_online_cpus(),
+                                hw->func_caps.num_msix_vectors);
        pf->num_vmdq_msix = pf->num_vmdq_qps;
        other_vecs = 1;
        other_vecs += (pf->num_vmdq_vsis * pf->num_vmdq_msix);
@@@ -7189,6 -7207,7 +7207,7 @@@ static int i40e_setup_misc_vector(struc
  static int i40e_config_rss(struct i40e_pf *pf)
  {
        u32 rss_key[I40E_PFQF_HKEY_MAX_INDEX + 1];
+       struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
        struct i40e_hw *hw = &pf->hw;
        u32 lut = 0;
        int i, j;
        wr32(hw, I40E_PFQF_HENA(0), (u32)hena);
        wr32(hw, I40E_PFQF_HENA(1), (u32)(hena >> 32));
  
+       vsi->rss_size = min_t(int, pf->rss_size, vsi->num_queue_pairs);
        /* Check capability and Set table size and register per hw expectation*/
        reg_val = rd32(hw, I40E_PFQF_CTL_0);
        if (hw->func_caps.rss_table_size == 512) {
                 * If LAN VSI is the only consumer for RSS then this requirement
                 * is not necessary.
                 */
-               if (j == pf->rss_size)
+               if (j == vsi->rss_size)
                        j = 0;
                /* lut = 4-byte sliding window of 4 lut entries */
                lut = (lut << 8) | (j &
   **/
  int i40e_reconfig_rss_queues(struct i40e_pf *pf, int queue_count)
  {
+       struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
+       int new_rss_size;
        if (!(pf->flags & I40E_FLAG_RSS_ENABLED))
                return 0;
  
-       queue_count = min_t(int, queue_count, pf->rss_size_max);
+       new_rss_size = min_t(int, queue_count, pf->rss_size_max);
  
-       if (queue_count != pf->rss_size) {
+       if (queue_count != vsi->num_queue_pairs) {
+               vsi->req_queue_pairs = queue_count;
                i40e_prep_for_reset(pf);
  
-               pf->rss_size = queue_count;
+               pf->rss_size = new_rss_size;
  
                i40e_reset_and_rebuild(pf, true);
                i40e_config_rss(pf);
@@@ -7432,6 -7457,7 +7457,7 @@@ static int i40e_sw_init(struct i40e_pf 
         */
        pf->rss_size_max = 0x1 << pf->hw.func_caps.rss_table_entry_width;
        pf->rss_size = 1;
+       pf->rss_table_size = pf->hw.func_caps.rss_table_size;
        pf->rss_size_max = min_t(int, pf->rss_size_max,
                                 pf->hw.func_caps.num_tx_qp);
        if (pf->hw.func_caps.rss) {
@@@ -9258,7 -9284,11 +9284,11 @@@ static void i40e_determine_queue_usage(
                        pf->flags &= ~I40E_FLAG_DCB_CAPABLE;
                        dev_info(&pf->pdev->dev, "not enough queues for DCB. DCB is disabled.\n");
                }
-               pf->num_lan_qps = pf->rss_size_max;
+               pf->num_lan_qps = max_t(int, pf->rss_size_max,
+                                       num_online_cpus());
+               pf->num_lan_qps = min_t(int, pf->num_lan_qps,
+                                       pf->hw.func_caps.num_tx_qp);
                queues_left -= pf->num_lan_qps;
        }
  
@@@ -9662,13 -9692,14 +9692,14 @@@ static int i40e_probe(struct pci_dev *p
        if (err)
                dev_info(&pf->pdev->dev, "set phy mask fail, aq_err %d\n", err);
  
-       msleep(75);
-       err = i40e_aq_set_link_restart_an(&pf->hw, true, NULL);
-       if (err) {
-               dev_info(&pf->pdev->dev, "link restart failed, aq_err=%d\n",
-                        pf->hw.aq.asq_last_status);
+       if (((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver < 33)) ||
+           (pf->hw.aq.fw_maj_ver < 4)) {
+               msleep(75);
+               err = i40e_aq_set_link_restart_an(&pf->hw, true, NULL);
+               if (err)
+                       dev_info(&pf->pdev->dev, "link restart failed, aq_err=%d\n",
+                                pf->hw.aq.asq_last_status);
        }
        /* The main driver is (mostly) up and happy. We need to set this state
         * before setting up the misc vector or we get a race and the vector
         * ends up disabled forever.
@@@ -10108,9 -10139,9 +10139,9 @@@ static int __init i40e_init_module(void
                i40e_driver_string, i40e_driver_version_str);
        pr_info("%s: %s\n", i40e_driver_name, i40e_copyright);
  
 -#if IS_ENABLED(CONFIG_CONFIGFS_FS)
 +#if IS_ENABLED(CONFIG_I40E_CONFIGFS_FS)
        i40e_configfs_init();
 -#endif /* CONFIG_CONFIGFS_FS */
 +#endif /* CONFIG_I40E_CONFIGFS_FS */
        i40e_dbg_init();
        return pci_register_driver(&i40e_driver);
  }
@@@ -10126,8 -10157,8 +10157,8 @@@ static void __exit i40e_exit_module(voi
  {
        pci_unregister_driver(&i40e_driver);
        i40e_dbg_exit();
 -#if IS_ENABLED(CONFIG_CONFIGFS_FS)
 +#if IS_ENABLED(CONFIG_I40E_CONFIGFS_FS)
        i40e_configfs_exit();
 -#endif /* CONFIG_CONFIGFS_FS */
 +#endif /* CONFIG_I40E_CONFIGFS_FS */
  }
  module_exit(i40e_exit_module);