On 6/17/21 1:59 PM, Jiawen Wu wrote: > Store MAC addresses and init receive address filters. > > Signed-off-by: Jiawen Wu <jiawe...@trustnetic.com>
[snip] > diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c > index 31d4dda976..deca64137d 100644 > --- a/drivers/net/ngbe/ngbe_ethdev.c > +++ b/drivers/net/ngbe/ngbe_ethdev.c > @@ -116,6 +116,31 @@ eth_ngbe_dev_init(struct rte_eth_dev *eth_dev, void > *init_params __rte_unused) > return -EIO; > } > > + /* Allocate memory for storing MAC addresses */ > + eth_dev->data->mac_addrs = rte_zmalloc("ngbe", RTE_ETHER_ADDR_LEN * > + hw->mac.num_rar_entries, 0); > + if (eth_dev->data->mac_addrs == NULL) { > + PMD_INIT_LOG(ERR, > + "Failed to allocate %u bytes needed to store " > + "MAC addresses", Do not split format strings. It makes it hard to find line in code using grep by the message found in log. [snip] > + RTE_ETHER_ADDR_LEN * hw->mac.num_rar_entries); > + return -ENOMEM; > + } > + > + /* Copy the permanent MAC address */ > + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, > + ð_dev->data->mac_addrs[0]); > + > + /* Allocate memory for storing hash filter MAC addresses */ > + eth_dev->data->hash_mac_addrs = rte_zmalloc("ngbe", > + RTE_ETHER_ADDR_LEN * NGBE_VMDQ_NUM_UC_MAC, 0); > + if (eth_dev->data->hash_mac_addrs == NULL) { > + PMD_INIT_LOG(ERR, > + "Failed to allocate %d bytes needed to store MAC > addresses", > + RTE_ETHER_ADDR_LEN * NGBE_VMDQ_NUM_UC_MAC); Shouldn't we free eth_dev->data->mac_addrs here? > + return -ENOMEM; > + } > + > return 0; > } >