1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2019 Marvell International Ltd.
5 #include <rte_common.h>
8 #include "otx2_ethdev.h"
11 otx2_cgx_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *addr)
13 struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
14 struct cgx_mac_addr_set_or_get *req;
15 struct otx2_mbox *mbox = dev->mbox;
18 if (otx2_dev_is_vf(dev))
21 if (otx2_dev_active_vfs(dev))
24 req = otx2_mbox_alloc_msg_cgx_mac_addr_set(mbox);
25 otx2_mbox_memcpy(req->mac_addr, addr->addr_bytes, RTE_ETHER_ADDR_LEN);
27 rc = otx2_mbox_process(mbox);
29 otx2_err("Failed to set mac address in CGX, rc=%d", rc);
35 otx2_cgx_mac_max_entries_get(struct otx2_eth_dev *dev)
37 struct cgx_max_dmac_entries_get_rsp *rsp;
38 struct otx2_mbox *mbox = dev->mbox;
41 if (otx2_dev_is_vf(dev))
44 otx2_mbox_alloc_msg_cgx_mac_max_entries_get(mbox);
45 rc = otx2_mbox_process_msg(mbox, (void *)&rsp);
49 return rsp->max_dmac_filters;
53 otx2_nix_mac_addr_get(struct rte_eth_dev *eth_dev, uint8_t *addr)
55 struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
56 struct otx2_mbox *mbox = dev->mbox;
57 struct nix_get_mac_addr_rsp *rsp;
60 otx2_mbox_alloc_msg_nix_get_mac_addr(mbox);
61 otx2_mbox_msg_send(mbox, 0);
62 rc = otx2_mbox_get_rsp(mbox, 0, (void *)&rsp);
64 otx2_err("Failed to get mac address, rc=%d", rc);
68 otx2_mbox_memcpy(addr, rsp->mac_addr, RTE_ETHER_ADDR_LEN);