[dpdk-dev] [PATCH 1/2] szedata2: new poll mode driver

Stephen Hemminger stephen at networkplumber.org
Mon Mar 21 18:45:08 CET 2016


On Fri, 19 Jun 2015 10:25:00 +0200
Matej Vido <vido at cesnet.cz> wrote:

> +static struct ether_addr eth_addr = {
> +	.addr_bytes = { 0, 0, 0, 0x1, 0x2, 0x3 }
> +};
...

> static int
> rte_szedata2_eth_dev_init(struct rte_eth_dev *dev)
> {
.. 
> 	/* Allocate space for one mac address */
> 	data->mac_addrs = rte_zmalloc(data->name, sizeof(struct ether_addr),
> 			RTE_CACHE_LINE_SIZE);
> 	if (data->mac_addrs == NULL) {
> 		RTE_LOG(ERR, PMD, "Could not alloc space for MAC address!\n");
> 		munmap(dev->pci_dev->mem_resource[PCI_RESOURCE_NUMBER].addr,
> 			dev->pci_dev->mem_resource[PCI_RESOURCE_NUMBER].len);
> 		return -EINVAL;
> 	}
> 
> 	ether_addr_copy(&eth_addr, data->mac_addrs);

If your hardware has no permanent MAC address, then please use eth_random_addr()
to make one on boot, rather than having a bogus static value.


More information about the dev mailing list