Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assistance with MAC Address Setting for QDMA-DPDK VF #24

Open
vijayaKesavan19 opened this issue Oct 7, 2024 · 0 comments
Open

Assistance with MAC Address Setting for QDMA-DPDK VF #24

vijayaKesavan19 opened this issue Oct 7, 2024 · 0 comments

Comments

@vijayaKesavan19
Copy link

vijayaKesavan19 commented Oct 7, 2024

Hi @cneely-amd and team,

I am currently working on port representor testing using the QDMA-DPDK framework, based on the OpenNIC design project (GitHub link for the project). I need to test the process of changing the MAC addresses for both the Physical Function (PF) and Virtual Function (VF) from the PF.

For the PF, I successfully use the following command to set the MAC address:

testpmd> mac_addr set <port id> <XX:XX:XX:XX:XX:XX>

I have implemented a function to achieve this, which is shown below:

int qdma_set_mac_address(struct rte_eth_dev *dev, struct rte_ether_addr *addr)
 
{
 
        int i ;
 
        uint64_t mac_addr = (uint64_t)(uintptr_t)&addr;
 
        if (!rte_is_valid_assigned_ether_addr(addr))
 
               return -EADDRNOTAVAIL;
 
        for (i = 0; i < RTE_ETHER_ADDR_LEN; i++)
 
                dev->data->mac_addrs[0].addr_bytes[RTE_ETHER_ADDR_LEN -1 -i] =
 
                                                (uint8_t)((mac_addr >> (BITS_IN_BYTE * i)) & 0xFF);
 
        return 0;
 
}

File : drivers/net/qdma/qdma_devops.c

In the case of the VF, I use the command:

testpmd> set vf mac addr <port id> <vf id> <XX:XX:XX:XX:XX:XX>

I believe this invokes the following function:

static void cmd_set_vf_mac_addr_parsed (
 
        void *parsed_result,
 
        __rte_unused struct cmdline *cl,
 
        __rte_unused void *data)
 
{
 
        struct cmd_set_vf_mac_addr_result *res = parsed_result;
 
        int ret = -ENOTSUP;
 
 
 
        if (port_id_is_invalid(res->port_id, ENABLED_WARN))
 
                return;
 
 
 
#ifdef RTE_NET_IXGBE
 
        if (ret == -ENOTSUP)
 
                ret = rte_pmd_ixgbe_set_vf_mac_addr(res->port_id, res->vf_id,
 
                                &res->mac_addr);
 
#endif
 
#ifdef RTE_NET_I40E
 
        if (ret == -ENOTSUP)
 
                ret = rte_pmd_i40e_set_vf_mac_addr(res->port_id, res->vf_id,
 
                                &res->mac_addr);
 
#endif
 
#ifdef RTE_NET_BNXT
 
        if (ret == -ENOTSUP)
 
                ret = rte_pmd_bnxt_set_vf_mac_addr(res->port_id, res->vf_id,
 
                                &res->mac_addr);
 
#endif
 
     
 
        switch (ret) {
 
        case 0:
 
                break;
 
        case -EINVAL:
 
                printf("invalid vf_id %d or mac_addr\n", res->vf_id);
 
                break;
 
        case -ENODEV:
 
                printf("invalid port_id %d\n", res->port_id);
 
                break;
 
        case -ENOTSUP:
 
                printf("function not implemented\n");
 
                break;
 
        default:
 
                printf("programming error: (%s)\n", strerror(-ret));
 
        }
 
}
 

As you can notice that this functionality is only supported for ixgbe, i40e, or bnxt devices, while I am working with a QDMA device (with the VF device name being "qdma_vf").

For other drivers, the MAC address is accessed through a structure that allows fetching the VF's information. Unfortunately, in the QDMA driver, I can only retrieve the function ID for the VF, as shown below:

struct qdma_vf_info {
    uint16_t func_id;
};

Could you please guide me on how to access the MAC address and received packets of the QDMA_VF device through the PF in the QDMA-DPDK testpmd application? Alternatively, if you could point me toward any reference documentation that could assist with this issue, I would greatly appreciate it.

Thank you in advance for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant