[PATCH v4 04/15] net/xsc: add xsc dev ops to support VFIO driver
WanRenyong
wanry at yunsilicon.com
Mon Jan 6 03:02:56 CET 2025
On 2025/1/4 3:06, Stephen Hemminger wrote:
> On Fri, 03 Jan 2025 23:04:13 +0800
> "WanRenyong" <wanry at yunsilicon.com> wrote:
>
>> +static int
>> +xsc_vfio_get_mac(struct xsc_dev *xdev, uint8_t *mac)
>> +{
>> + struct xsc_cmd_query_eth_mac_mbox_in in;
>> + struct xsc_cmd_query_eth_mac_mbox_out out;
>> + int ret;
>> +
>> + memset(&in, 0, sizeof(in));
>> + memset(&out, 0, sizeof(out));
>> + in.hdr.opcode = rte_cpu_to_be_16(XSC_CMD_OP_QUERY_ETH_MAC);
>> + ret = xsc_vfio_mbox_exec(xdev, &in, sizeof(in), &out, sizeof(out));
>> + if (ret != 0 || out.hdr.status != 0) {
>> + PMD_DRV_LOG(ERR, "Failed to get mtu, port=%d, err=%d, out.status=%u",
>> + xdev->port_id, ret, out.hdr.status);
>> + rte_errno = ENOEXEC;
>> + return -rte_errno;
>> + }
>> +
>> + memcpy(mac, out.mac, 6);
> Prefer to use RTE_ETHER_ADDR_LEN rather than 6.
> Or use rte_ether_addr_copy
will fix it in the next version.
--
Thanks,
WanRenyong
More information about the dev
mailing list