On Fri, 03 Jan 2025 23:04:13 +0800
"WanRenyong" <wa...@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

Reply via email to