/* CNXK platform independent eth dev ops */
struct eth_dev_ops cnxk_eth_dev_ops = {
+ .mac_addr_set = cnxk_nix_mac_addr_set,
.dev_infos_get = cnxk_nix_info_get,
.link_update = cnxk_nix_link_update,
.tx_queue_release = cnxk_nix_tx_queue_release,
int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
struct rte_pci_device *pci_dev);
int cnxk_nix_remove(struct rte_pci_device *pci_dev);
+int cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev,
+ struct rte_ether_addr *addr);
int cnxk_nix_info_get(struct rte_eth_dev *eth_dev,
struct rte_eth_dev_info *dev_info);
int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
return 0;
}
+
+int
+cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *addr)
+{
+ struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+ struct roc_nix *nix = &dev->nix;
+ int rc;
+
+ /* Update mac address at NPC */
+ rc = roc_nix_npc_mac_addr_set(nix, addr->addr_bytes);
+ if (rc)
+ goto exit;
+
+ /* Update mac address at CGX for PFs only */
+ if (!roc_nix_is_vf_or_sdp(nix)) {
+ rc = roc_nix_mac_addr_set(nix, addr->addr_bytes);
+ if (rc) {
+ /* Rollback to previous mac address */
+ roc_nix_npc_mac_addr_set(nix, dev->mac_addr);
+ goto exit;
+ }
+ }
+
+ /* Update mac address to cnxk ethernet device */
+ rte_memcpy(dev->mac_addr, addr->addr_bytes, RTE_ETHER_ADDR_LEN);
+
+exit:
+ return rc;
+}