ice: remove unnecessary virtchnl_ether_addr struct use
authorJacob Keller <jacob.e.keller@intel.com>
Thu, 19 Jan 2023 01:16:53 +0000 (17:16 -0800)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Mon, 6 Feb 2023 17:47:48 +0000 (09:47 -0800)
The dev_lan_addr and hw_lan_addr members of ice_vf are used only to store
the MAC address for the VF. They are defined using virtchnl_ether_addr, but
only the .addr sub-member is actually used. Drop the use of
virtchnl_ether_addr and just use a u8 array of length [ETH_ALEN].

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Marek Szlosek <marek.szlosek@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_eswitch.c
drivers/net/ethernet/intel/ice/ice_sriov.c
drivers/net/ethernet/intel/ice/ice_vf_lib.c
drivers/net/ethernet/intel/ice/ice_vf_lib.h
drivers/net/ethernet/intel/ice/ice_virtchnl.c

index b86d173a20af006dfbd6bf7167aa069d86f319ee..f6dd3f8fd936e0e5bf31786a7de49a59aa0c53c1 100644 (file)
@@ -71,17 +71,17 @@ void ice_eswitch_replay_vf_mac_rule(struct ice_vf *vf)
        if (!ice_is_switchdev_running(vf->pf))
                return;
 
-       if (is_valid_ether_addr(vf->hw_lan_addr.addr)) {
+       if (is_valid_ether_addr(vf->hw_lan_addr)) {
                err = ice_eswitch_add_vf_mac_rule(vf->pf, vf,
-                                                 vf->hw_lan_addr.addr);
+                                                 vf->hw_lan_addr);
                if (err) {
                        dev_err(ice_pf_to_dev(vf->pf), "Failed to add MAC %pM for VF %d\n, error %d\n",
-                               vf->hw_lan_addr.addr, vf->vf_id, err);
+                               vf->hw_lan_addr, vf->vf_id, err);
                        return;
                }
                vf->num_mac++;
 
-               ether_addr_copy(vf->dev_lan_addr.addr, vf->hw_lan_addr.addr);
+               ether_addr_copy(vf->dev_lan_addr, vf->hw_lan_addr);
        }
 }
 
@@ -237,7 +237,7 @@ ice_eswitch_release_reprs(struct ice_pf *pf, struct ice_vsi *ctrl_vsi)
                ice_vsi_update_security(vsi, ice_vsi_ctx_set_antispoof);
                metadata_dst_free(vf->repr->dst);
                vf->repr->dst = NULL;
-               ice_fltr_add_mac_and_broadcast(vsi, vf->hw_lan_addr.addr,
+               ice_fltr_add_mac_and_broadcast(vsi, vf->hw_lan_addr,
                                               ICE_FWD_TO_VSI);
 
                netif_napi_del(&vf->repr->q_vector->napi);
@@ -265,14 +265,14 @@ static int ice_eswitch_setup_reprs(struct ice_pf *pf)
                                                   GFP_KERNEL);
                if (!vf->repr->dst) {
                        ice_fltr_add_mac_and_broadcast(vsi,
-                                                      vf->hw_lan_addr.addr,
+                                                      vf->hw_lan_addr,
                                                       ICE_FWD_TO_VSI);
                        goto err;
                }
 
                if (ice_vsi_update_security(vsi, ice_vsi_ctx_clear_antispoof)) {
                        ice_fltr_add_mac_and_broadcast(vsi,
-                                                      vf->hw_lan_addr.addr,
+                                                      vf->hw_lan_addr,
                                                       ICE_FWD_TO_VSI);
                        metadata_dst_free(vf->repr->dst);
                        vf->repr->dst = NULL;
@@ -281,7 +281,7 @@ static int ice_eswitch_setup_reprs(struct ice_pf *pf)
 
                if (ice_vsi_add_vlan_zero(vsi)) {
                        ice_fltr_add_mac_and_broadcast(vsi,
-                                                      vf->hw_lan_addr.addr,
+                                                      vf->hw_lan_addr,
                                                       ICE_FWD_TO_VSI);
                        metadata_dst_free(vf->repr->dst);
                        vf->repr->dst = NULL;
@@ -338,7 +338,7 @@ void ice_eswitch_update_repr(struct ice_vsi *vsi)
 
        ret = ice_vsi_update_security(vsi, ice_vsi_ctx_clear_antispoof);
        if (ret) {
-               ice_fltr_add_mac_and_broadcast(vsi, vf->hw_lan_addr.addr, ICE_FWD_TO_VSI);
+               ice_fltr_add_mac_and_broadcast(vsi, vf->hw_lan_addr, ICE_FWD_TO_VSI);
                dev_err(ice_pf_to_dev(pf), "Failed to update VF %d port representor",
                        vsi->vf->vf_id);
        }
index 356ac76ef90f02ac00067efe0dbf334c4c95a05a..96a64c25e2ef7f7d796c55bbd46e6a68bc84fd74 100644 (file)
@@ -1242,7 +1242,7 @@ ice_get_vf_cfg(struct net_device *netdev, int vf_id, struct ifla_vf_info *ivi)
                goto out_put_vf;
 
        ivi->vf = vf_id;
-       ether_addr_copy(ivi->mac, vf->hw_lan_addr.addr);
+       ether_addr_copy(ivi->mac, vf->hw_lan_addr);
 
        /* VF configuration for VLAN and applicable QoS */
        ivi->vlan = ice_vf_get_port_vlan_id(vf);
@@ -1290,8 +1290,8 @@ int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
                return -EINVAL;
 
        /* nothing left to do, unicast MAC already set */
-       if (ether_addr_equal(vf->dev_lan_addr.addr, mac) &&
-           ether_addr_equal(vf->hw_lan_addr.addr, mac)) {
+       if (ether_addr_equal(vf->dev_lan_addr, mac) &&
+           ether_addr_equal(vf->hw_lan_addr, mac)) {
                ret = 0;
                goto out_put_vf;
        }
@@ -1305,8 +1305,8 @@ int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
        /* VF is notified of its new MAC via the PF's response to the
         * VIRTCHNL_OP_GET_VF_RESOURCES message after the VF has been reset
         */
-       ether_addr_copy(vf->dev_lan_addr.addr, mac);
-       ether_addr_copy(vf->hw_lan_addr.addr, mac);
+       ether_addr_copy(vf->dev_lan_addr, mac);
+       ether_addr_copy(vf->hw_lan_addr, mac);
        if (is_zero_ether_addr(mac)) {
                /* VF will send VIRTCHNL_OP_ADD_ETH_ADDR message with its MAC */
                vf->pf_set_mac = false;
@@ -1707,7 +1707,7 @@ void ice_print_vf_rx_mdd_event(struct ice_vf *vf)
 
        dev_info(dev, "%d Rx Malicious Driver Detection events detected on PF %d VF %d MAC %pM. mdd-auto-reset-vfs=%s\n",
                 vf->mdd_rx_events.count, pf->hw.pf_id, vf->vf_id,
-                vf->dev_lan_addr.addr,
+                vf->dev_lan_addr,
                 test_bit(ICE_FLAG_MDD_AUTO_RESET_VF, pf->flags)
                          ? "on" : "off");
 }
@@ -1751,7 +1751,7 @@ void ice_print_vfs_mdd_events(struct ice_pf *pf)
 
                        dev_info(dev, "%d Tx Malicious Driver Detection events detected on PF %d VF %d MAC %pM.\n",
                                 vf->mdd_tx_events.count, hw->pf_id, vf->vf_id,
-                                vf->dev_lan_addr.addr);
+                                vf->dev_lan_addr);
                }
        }
        mutex_unlock(&pf->vfs.table_lock);
@@ -1841,7 +1841,7 @@ ice_is_malicious_vf(struct ice_pf *pf, struct ice_rq_event_info *event,
 
                        if (pf_vsi)
                                dev_warn(dev, "VF MAC %pM on PF MAC %pM is generating asynchronous messages and may be overflowing the PF message queue. Please see the Adapter User Guide for more information\n",
-                                        &vf->dev_lan_addr.addr[0],
+                                        &vf->dev_lan_addr[0],
                                         pf_vsi->netdev->dev_addr);
                }
        }
index d16c2ea83873aa9cbe7b8cd130102f659fd66376..0e57bd1b85fd432cf667ad99de3f158a9cb853d8 100644 (file)
@@ -1008,18 +1008,18 @@ static int ice_vf_rebuild_host_mac_cfg(struct ice_vf *vf)
 
        vf->num_mac++;
 
-       if (is_valid_ether_addr(vf->hw_lan_addr.addr)) {
-               status = ice_fltr_add_mac(vsi, vf->hw_lan_addr.addr,
+       if (is_valid_ether_addr(vf->hw_lan_addr)) {
+               status = ice_fltr_add_mac(vsi, vf->hw_lan_addr,
                                          ICE_FWD_TO_VSI);
                if (status) {
                        dev_err(dev, "failed to add default unicast MAC filter %pM for VF %u, error %d\n",
-                               &vf->hw_lan_addr.addr[0], vf->vf_id,
+                               &vf->hw_lan_addr[0], vf->vf_id,
                                status);
                        return status;
                }
                vf->num_mac++;
 
-               ether_addr_copy(vf->dev_lan_addr.addr, vf->hw_lan_addr.addr);
+               ether_addr_copy(vf->dev_lan_addr, vf->hw_lan_addr);
        }
 
        return 0;
index b4e6480f30a73e80ac1a8461bdcdb611b2ff4513..ef30f05b5d02e58f998149bd90ad2921df84ffa6 100644 (file)
@@ -98,8 +98,8 @@ struct ice_vf {
        struct ice_sw *vf_sw_id;        /* switch ID the VF VSIs connect to */
        struct virtchnl_version_info vf_ver;
        u32 driver_caps;                /* reported by VF driver */
-       struct virtchnl_ether_addr dev_lan_addr;
-       struct virtchnl_ether_addr hw_lan_addr;
+       u8 dev_lan_addr[ETH_ALEN];
+       u8 hw_lan_addr[ETH_ALEN];
        struct ice_time_mac legacy_last_added_umac;
        DECLARE_BITMAP(txq_ena, ICE_MAX_RSS_QS_PER_VF);
        DECLARE_BITMAP(rxq_ena, ICE_MAX_RSS_QS_PER_VF);
index dab3cd5d300e573f82c0444e9556c68666828f16..e24e3f5017ca6013e0d90881592cceec8e03d606 100644 (file)
@@ -507,7 +507,7 @@ static int ice_vc_get_vf_res_msg(struct ice_vf *vf, u8 *msg)
        vfres->vsi_res[0].vsi_type = VIRTCHNL_VSI_SRIOV;
        vfres->vsi_res[0].num_queue_pairs = vsi->num_txq;
        ether_addr_copy(vfres->vsi_res[0].default_mac_addr,
-                       vf->hw_lan_addr.addr);
+                       vf->hw_lan_addr);
 
        /* match guest capabilities */
        vf->driver_caps = vfres->vf_cap_flags;
@@ -1802,10 +1802,10 @@ ice_vfhw_mac_add(struct ice_vf *vf, struct virtchnl_ether_addr *vc_ether_addr)
         * was correctly specified over VIRTCHNL
         */
        if ((ice_is_vc_addr_legacy(vc_ether_addr) &&
-            is_zero_ether_addr(vf->hw_lan_addr.addr)) ||
+            is_zero_ether_addr(vf->hw_lan_addr)) ||
            ice_is_vc_addr_primary(vc_ether_addr)) {
-               ether_addr_copy(vf->dev_lan_addr.addr, mac_addr);
-               ether_addr_copy(vf->hw_lan_addr.addr, mac_addr);
+               ether_addr_copy(vf->dev_lan_addr, mac_addr);
+               ether_addr_copy(vf->hw_lan_addr, mac_addr);
        }
 
        /* hardware and device MACs are already set, but its possible that the
@@ -1836,7 +1836,7 @@ ice_vc_add_mac_addr(struct ice_vf *vf, struct ice_vsi *vsi,
        int ret;
 
        /* device MAC already added */
-       if (ether_addr_equal(mac_addr, vf->dev_lan_addr.addr))
+       if (ether_addr_equal(mac_addr, vf->dev_lan_addr))
                return 0;
 
        if (is_unicast_ether_addr(mac_addr) && !ice_can_vf_change_mac(vf)) {
@@ -1891,8 +1891,8 @@ ice_update_legacy_cached_mac(struct ice_vf *vf,
            ice_is_legacy_umac_expired(&vf->legacy_last_added_umac))
                return;
 
-       ether_addr_copy(vf->dev_lan_addr.addr, vf->legacy_last_added_umac.addr);
-       ether_addr_copy(vf->hw_lan_addr.addr, vf->legacy_last_added_umac.addr);
+       ether_addr_copy(vf->dev_lan_addr, vf->legacy_last_added_umac.addr);
+       ether_addr_copy(vf->hw_lan_addr, vf->legacy_last_added_umac.addr);
 }
 
 /**
@@ -1906,15 +1906,15 @@ ice_vfhw_mac_del(struct ice_vf *vf, struct virtchnl_ether_addr *vc_ether_addr)
        u8 *mac_addr = vc_ether_addr->addr;
 
        if (!is_valid_ether_addr(mac_addr) ||
-           !ether_addr_equal(vf->dev_lan_addr.addr, mac_addr))
+           !ether_addr_equal(vf->dev_lan_addr, mac_addr))
                return;
 
        /* allow the device MAC to be repopulated in the add flow and don't
-        * clear the hardware MAC (i.e. hw_lan_addr.addr) here as that is meant
+        * clear the hardware MAC (i.e. hw_lan_addr) here as that is meant
         * to be persistent on VM reboot and across driver unload/load, which
         * won't work if we clear the hardware MAC here
         */
-       eth_zero_addr(vf->dev_lan_addr.addr);
+       eth_zero_addr(vf->dev_lan_addr);
 
        ice_update_legacy_cached_mac(vf, vc_ether_addr);
 }
@@ -1934,7 +1934,7 @@ ice_vc_del_mac_addr(struct ice_vf *vf, struct ice_vsi *vsi,
        int status;
 
        if (!ice_can_vf_change_mac(vf) &&
-           ether_addr_equal(vf->dev_lan_addr.addr, mac_addr))
+           ether_addr_equal(vf->dev_lan_addr, mac_addr))
                return 0;
 
        status = ice_fltr_remove_mac(vsi, mac_addr, ICE_FWD_TO_VSI);
@@ -3733,7 +3733,7 @@ static int ice_vc_repr_add_mac(struct ice_vf *vf, u8 *msg)
                int result;
 
                if (!is_unicast_ether_addr(mac_addr) ||
-                   ether_addr_equal(mac_addr, vf->hw_lan_addr.addr))
+                   ether_addr_equal(mac_addr, vf->hw_lan_addr))
                        continue;
 
                if (vf->pf_set_mac) {