net/ice: use ethernet copy API to do MAC assignment
authorHaiyue Wang <haiyue.wang@intel.com>
Mon, 13 Jan 2020 08:22:21 +0000 (16:22 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 17 Jan 2020 18:46:02 +0000 (19:46 +0100)
Use the API rte_ether_addr_copy to do MAC assignment, instead of
calling rte_memcpy function directly.

Fixes: 84dc7a95a2d3 ("net/ice: enable flow director engine")
Cc: stable@dpdk.org
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/ice/ice_ethdev.c

index 88cd906..6b344cb 100644 (file)
@@ -875,7 +875,7 @@ ice_add_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *mac_addr)
                ret = -ENOMEM;
                goto DONE;
        }
-       rte_memcpy(&f->mac_info.mac_addr, mac_addr, ETH_ADDR_LEN);
+       rte_ether_addr_copy(mac_addr, &f->mac_info.mac_addr);
        TAILQ_INSERT_TAIL(&vsi->mac_list, f, next);
        vsi->mac_num++;
 
@@ -1663,16 +1663,16 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
 
        if (type == ICE_VSI_PF) {
                /* MAC configuration */
-               rte_memcpy(pf->dev_addr.addr_bytes,
-                          hw->port_info->mac.perm_addr,
-                          ETH_ADDR_LEN);
+               rte_ether_addr_copy((struct rte_ether_addr *)
+                                       hw->port_info->mac.perm_addr,
+                                   &pf->dev_addr);
 
-               rte_memcpy(&mac_addr, &pf->dev_addr, RTE_ETHER_ADDR_LEN);
+               rte_ether_addr_copy(&pf->dev_addr, &mac_addr);
                ret = ice_add_mac_filter(vsi, &mac_addr);
                if (ret != ICE_SUCCESS)
                        PMD_INIT_LOG(ERR, "Failed to add dflt MAC filter");
 
-               rte_memcpy(&mac_addr, &broadcast, RTE_ETHER_ADDR_LEN);
+               rte_ether_addr_copy(&broadcast, &mac_addr);
                ret = ice_add_mac_filter(vsi, &mac_addr);
                if (ret != ICE_SUCCESS)
                        PMD_INIT_LOG(ERR, "Failed to add MAC filter");
@@ -3270,7 +3270,7 @@ static int ice_macaddr_set(struct rte_eth_dev *dev,
                PMD_DRV_LOG(ERR, "Failed to add mac filter");
                return -EIO;
        }
-       memcpy(&pf->dev_addr, mac_addr, ETH_ADDR_LEN);
+       rte_ether_addr_copy(mac_addr, &pf->dev_addr);
 
        flags = ICE_AQC_MAN_MAC_UPDATE_LAA_WOL;
        ret = ice_aq_manage_mac_write(hw, mac_addr->addr_bytes, flags, NULL);