net/ice: fix Rx statistics
[dpdk.git] / drivers / net / ice / ice_ethdev.c
index 1f06a2c..cae7a9d 100644 (file)
@@ -645,12 +645,14 @@ ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id)
        struct ice_fltr_list_entry *v_list_itr = NULL;
        struct ice_vlan_filter *f;
        struct LIST_HEAD_TYPE list_head;
-       struct ice_hw *hw = ICE_VSI_TO_HW(vsi);
+       struct ice_hw *hw;
        int ret = 0;
 
        if (!vsi || vlan_id > ETHER_MAX_VLAN_ID)
                return -EINVAL;
 
+       hw = ICE_VSI_TO_HW(vsi);
+
        /* If it's added and configured, return. */
        f = ice_find_vlan_filter(vsi, vlan_id);
        if (f) {
@@ -710,7 +712,7 @@ ice_remove_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id)
        struct ice_fltr_list_entry *v_list_itr = NULL;
        struct ice_vlan_filter *f;
        struct LIST_HEAD_TYPE list_head;
-       struct ice_hw *hw = ICE_VSI_TO_HW(vsi);
+       struct ice_hw *hw;
        int ret = 0;
 
        /**
@@ -720,6 +722,8 @@ ice_remove_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id)
        if (!vsi || vlan_id == 0 || vlan_id > ETHER_MAX_VLAN_ID)
                return -EINVAL;
 
+       hw = ICE_VSI_TO_HW(vsi);
+
        /* Can't find it, return an error */
        f = ice_find_vlan_filter(vsi, vlan_id);
        if (!f)
@@ -2565,13 +2569,16 @@ ice_get_rss_lut(struct ice_vsi *vsi, uint8_t *lut, uint16_t lut_size)
 static int
 ice_set_rss_lut(struct ice_vsi *vsi, uint8_t *lut, uint16_t lut_size)
 {
-       struct ice_pf *pf = ICE_VSI_TO_PF(vsi);
-       struct ice_hw *hw = ICE_VSI_TO_HW(vsi);
+       struct ice_pf *pf;
+       struct ice_hw *hw;
        int ret;
 
        if (!vsi || !lut)
                return -EINVAL;
 
+       pf = ICE_VSI_TO_PF(vsi);
+       hw = ICE_VSI_TO_HW(vsi);
+
        if (pf->flags & ICE_FLAG_RSS_AQ_CAPABLE) {
                ret = ice_aq_set_rss_lut(hw, vsi->idx, TRUE,
                                         lut, lut_size);
@@ -3319,15 +3326,14 @@ ice_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
        /* call read registers - updates values, now write them to struct */
        ice_read_stats_registers(pf, hw);
 
-       stats->ipackets = ns->eth.rx_unicast +
-                         ns->eth.rx_multicast +
-                         ns->eth.rx_broadcast -
-                         ns->eth.rx_discards -
+       stats->ipackets = pf->main_vsi->eth_stats.rx_unicast +
+                         pf->main_vsi->eth_stats.rx_multicast +
+                         pf->main_vsi->eth_stats.rx_broadcast -
                          pf->main_vsi->eth_stats.rx_discards;
        stats->opackets = ns->eth.tx_unicast +
                          ns->eth.tx_multicast +
                          ns->eth.tx_broadcast;
-       stats->ibytes   = ns->eth.rx_bytes;
+       stats->ibytes   = pf->main_vsi->eth_stats.rx_bytes;
        stats->obytes   = ns->eth.tx_bytes;
        stats->oerrors  = ns->eth.tx_errors +
                          pf->main_vsi->eth_stats.tx_errors;