[dpdk-users] How to get ixgbe vf port MAC address when ixgbe vf port bound to igb_uio but before dpdk app starts running?
Vincent Li
vincent.mc.li at gmail.com
Wed Jun 15 22:58:41 CEST 2016
Hi,
I am attempting to make mTCP support ixgbevf
https://github.com/eunyoung14/mtcp/. here is briefly how mTCP work
with DPDK.
mTCP made a small changes to igb_uio.c to create a netdev interface in
Linux for packet statistics. when a NIC port bound to igb_uio, a
dpdk<#> interface will be created in Linux and the dpdk<#> interface
will have proper MAC address, this works for igb and ixgbe, the
igb_uio.c has not been changed to support ixgbevf, so once ixgbe vf
port is bound to igb_uio, the dpdk<#> interface get 00:00:00:00:00:00
MAC address.
the way it works for igb and ixgbe is code snippet below to read MAC
address from register:
/**
* A device specific function that retrieves mac address from each NIC interface
*/
void
retrieve_dev_addr(struct net_device *netdev, struct net_adapter *adapter)
{
struct ixgbe_hw *hw_i;
struct e1000_hw *hw_e;
//struct vmxnet3_hw *hw_x;
u32 rar_high;
u32 rar_low;
u16 i;
switch (adapter->type) {
case IXGBE:
hw_i = &adapter->hw._ixgbe_hw;
rar_high = IXGBE_READ_REG(hw_i, IXGBE_RAH(0));
rar_low = IXGBE_READ_REG(hw_i, IXGBE_RAL(0));
for (i = 0; i < 4; i++)
netdev->dev_addr[i] = (u8)(rar_low >> (i*8));
for (i = 0; i < 2; i++)
netdev->dev_addr[i+4] = (u8)(rar_high >> (i*8));
break;
case IGB:
hw_e = &adapter->hw._e1000_hw;
rar_high = E1000_READ_REG(hw_e, E1000_RAH(0));
rar_low = E1000_READ_REG(hw_e, E1000_RAL(0));
for (i = 0; i < E1000_RAL_MAC_ADDR_LEN; i++)
netdev->dev_addr[i] = (u8)(rar_low >> (i*8));
for (i = 0; i < E1000_RAH_MAC_ADDR_LEN; i++)
netdev->dev_addr[i+4] = (u8)(rar_high >> (i*8));
break;
}
my question is IXGBE_READ_REG works for IXGBE VF port ?
I also see IXGBE VF PMD has function below:
/**
* ixgbe_get_mac_addr_vf - Read device MAC address
* @hw: pointer to the HW structure
**/
s32 ixgbe_get_mac_addr_vf(struct ixgbe_hw *hw, u8 *mac_addr)
{
int i;
for (i = 0; i < IXGBE_ETH_LENGTH_OF_ADDRESS; i++)
mac_addr[i] = hw->mac.perm_addr[i];
return IXGBE_SUCCESS;
}
is the hw->mac.perm_addr populated when IXGBE VF port bound to igb_uio
? if so I could copy hw->mac.perm_addr to netdev-dev_addr[] for the
dpdk<#> interface. but I thought hw->mac.perm_addr may not be
populated when IXGBE_VF port bound to igb_uio, hw->mac.perm_addr is
populated when dpdk app start to run that include loading/initializing
the relevant dpdk PMD drivers. am I miss anything, any idea how this
can be achieved?
Regards,
Vincent
More information about the users
mailing list