]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
i40e: add hw struct local variable
authorMitch Williams <mitch.a.williams@intel.com>
Mon, 16 May 2016 17:26:32 +0000 (10:26 -0700)
committerDhaval Giani <dhaval.giani@oracle.com>
Wed, 8 Mar 2017 00:30:21 +0000 (19:30 -0500)
Orabug: 24568124

This function uses the i40e_hw struct all over the place, so why doesn't
it keep a pointer to the struct? Add this pointer as a local variable
and use it consistently throughout the function.

Change-ID: I10eb688fe40909433fcb8ac7ac891cef67445d72
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 3e25a8f31af1c740c6ba2c7ad74d91830fd630c8)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/intel/i40e/i40e_main.c

Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
drivers/net/ethernet/intel/i40e/i40e_main.c

index d3fcefc87a5da916864fbd1cc13a1b8b17a370ea..6ff11a10363b60e877e4e1d2e0875619bd3cd4d4 100644 (file)
@@ -1853,6 +1853,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
 {
        struct list_head tmp_del_list, tmp_add_list;
        struct i40e_mac_filter *f, *ftmp, *fclone;
+       struct i40e_hw *hw = &vsi->back->hw;
        bool promisc_forced_on = false;
        bool add_happened = false;
        int filter_list_len = 0;
@@ -1933,7 +1934,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
        if (!list_empty(&tmp_del_list)) {
                int del_list_size;
 
-               filter_list_len = pf->hw.aq.asq_buf_size /
+               filter_list_len = hw->aq.asq_buf_size /
                            sizeof(struct i40e_aqc_remove_macvlan_element_data);
                del_list_size = filter_list_len *
                            sizeof(struct i40e_aqc_remove_macvlan_element_data);
@@ -1965,12 +1966,11 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
 
                        /* flush a full buffer */
                        if (num_del == filter_list_len) {
-                               aq_ret = i40e_aq_remove_macvlan(&pf->hw,
-                                                               vsi->seid,
-                                                               del_list,
-                                                               num_del,
-                                                               NULL);
-                               aq_err = pf->hw.aq.asq_last_status;
+                               aq_ret =
+                                       i40e_aq_remove_macvlan(hw, vsi->seid,
+                                                              del_list,
+                                                              num_del, NULL);
+                               aq_err = hw->aq.asq_last_status;
                                num_del = 0;
                                memset(del_list, 0, del_list_size);
 
@@ -1978,8 +1978,9 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
                                        retval = -EIO;
                                        dev_err(&pf->pdev->dev,
                                                "ignoring delete macvlan error, err %s, aq_err %s while flushing a full buffer\n",
-                                               i40e_stat_str(&pf->hw, aq_ret),
-                                               i40e_aq_str(&pf->hw, aq_err));
+
+                                                i40e_stat_str(hw, aq_ret),
+                                                i40e_aq_str(hw, aq_err));
                                }
                        }
                        /* Release memory for MAC filter entries which were
@@ -1990,17 +1991,16 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
                }
 
                if (num_del) {
-                       aq_ret = i40e_aq_remove_macvlan(&pf->hw, vsi->seid,
-                                                       del_list, num_del,
-                                                       NULL);
-                       aq_err = pf->hw.aq.asq_last_status;
+                       aq_ret = i40e_aq_remove_macvlan(hw, vsi->seid, del_list,
+                                                       num_del, NULL);
+                       aq_err = hw->aq.asq_last_status;
                        num_del = 0;
 
                        if (aq_ret && aq_err != I40E_AQ_RC_ENOENT)
                                dev_info(&pf->pdev->dev,
                                         "ignoring delete macvlan error, err %s aq_err %s\n",
-                                        i40e_stat_str(&pf->hw, aq_ret),
-                                        i40e_aq_str(&pf->hw, aq_err));
+                                        i40e_stat_str(hw, aq_ret),
+                                        i40e_aq_str(hw, aq_err));
                }
 
                kfree(del_list);
@@ -2011,7 +2011,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
                int add_list_size;
 
                /* do all the adds now */
-               filter_list_len = pf->hw.aq.asq_buf_size /
+               filter_list_len = hw->aq.asq_buf_size /
                               sizeof(struct i40e_aqc_add_macvlan_element_data),
                add_list_size = filter_list_len *
                               sizeof(struct i40e_aqc_add_macvlan_element_data);
@@ -2046,10 +2046,10 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
 
                        /* flush a full buffer */
                        if (num_add == filter_list_len) {
-                               aq_ret = i40e_aq_add_macvlan(&pf->hw, vsi->seid,
+                               aq_ret = i40e_aq_add_macvlan(hw, vsi->seid,
                                                             add_list, num_add,
                                                             NULL);
-                               aq_err = pf->hw.aq.asq_last_status;
+                               aq_err = hw->aq.asq_last_status;
                                num_add = 0;
 
                                if (aq_ret)
@@ -2064,9 +2064,9 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
                }
 
                if (num_add) {
-                       aq_ret = i40e_aq_add_macvlan(&pf->hw, vsi->seid,
+                       aq_ret = i40e_aq_add_macvlan(hw, vsi->seid,
                                                     add_list, num_add, NULL);
-                       aq_err = pf->hw.aq.asq_last_status;
+                       aq_err = hw->aq.asq_last_status;
                        num_add = 0;
                }
                kfree(add_list);
@@ -2076,9 +2076,9 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
                        retval = i40e_aq_rc_to_posix(aq_ret, aq_err);
                        dev_info(&pf->pdev->dev,
                                 "add filter failed, err %s aq_err %s\n",
-                                i40e_stat_str(&pf->hw, aq_ret),
-                                i40e_aq_str(&pf->hw, aq_err));
-                       if ((pf->hw.aq.asq_last_status == I40E_AQ_RC_ENOSPC) &&
+                                i40e_stat_str(hw, aq_ret),
+                                i40e_aq_str(hw, aq_err));
+                       if ((hw->aq.asq_last_status == I40E_AQ_RC_ENOSPC) &&
                            !test_bit(__I40E_FILTER_OVERFLOW_PROMISC,
                                      &vsi->state)) {
                                promisc_forced_on = true;
@@ -2106,12 +2106,11 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
                                                               NULL);
                if (aq_ret) {
                        retval = i40e_aq_rc_to_posix(aq_ret,
-                                                    pf->hw.aq.asq_last_status);
+                                                    hw->aq.asq_last_status);
                        dev_info(&pf->pdev->dev,
                                 "set multi promisc failed, err %s aq_err %s\n",
-                                i40e_stat_str(&pf->hw, aq_ret),
-                                i40e_aq_str(&pf->hw,
-                                            pf->hw.aq.asq_last_status));
+                                i40e_stat_str(hw, aq_ret),
+                                i40e_aq_str(hw, hw->aq.asq_last_status));
                }
        }
        if ((changed_flags & IFF_PROMISC) || promisc_forced_on) {
@@ -2128,12 +2127,12 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
                if (aq_ret) {
                        retval =
                        i40e_aq_rc_to_posix(aq_ret,
-                                           pf->hw.aq.asq_last_status);
+                                           hw->aq.asq_last_status);
                        dev_info(&pf->pdev->dev,
                                 "set uni promisc failed, err %s, aq_err %s\n",
-                                i40e_stat_str(&pf->hw, aq_ret),
-                                i40e_aq_str(&pf->hw,
-                                            pf->hw.aq.asq_last_status));
+                                i40e_stat_str(hw, aq_ret),
+                                i40e_aq_str(hw,
+                                            hw->aq.asq_last_status));
                }
 
        }