src/dpdk/drivers/net/hinic/hinic_pmd_ethdev.c
static int hinic_init_mac_addr(struct rte_eth_dev *eth_dev)
{
	struct hinic_nic_dev *nic_dev =
				HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
	uint8_t addr_bytes[RTE_ETHER_ADDR_LEN];
	u16 func_id = 0;
	int rc = 0;

	rc = hinic_get_default_mac(nic_dev->hwdev, addr_bytes);
	if (rc)
		return rc;

	rte_ether_addr_copy((struct rte_ether_addr *)addr_bytes,
		&eth_dev->data->mac_addrs[0]);
	if (rte_is_zero_ether_addr(&eth_dev->data->mac_addrs[0]))
		hinic_gen_random_mac_addr(&eth_dev->data->mac_addrs[0]);

	func_id = hinic_global_func_id(nic_dev->hwdev);
	rc = hinic_set_mac(nic_dev->hwdev,
			eth_dev->data->mac_addrs[0].addr_bytes,
			0, func_id);
	if (rc && rc != HINIC_PF_SET_VF_ALREADY)
		return rc;

	rte_ether_addr_copy(&eth_dev->data->mac_addrs[0],
			&nic_dev->default_addr);

	return 0;
}
/**
 * Init mac_vlan table in NIC.
 *
 * @param dev
 *   Pointer to Ethernet device structure.
 *
 * @return
 *   0 on success and stats is filled,
 *   negative error value otherwise.
 */
Init mac_vlan table in NIC.
@param dev
Pointer to Ethernet device structure.

@return
0 on success and stats is filled,
negative error value otherwise.
Init mac_vlan table in NIC . @param dev Pointer to Ethernet device structure . @return 0 on success and stats is filled negative error value otherwise .
static int hinic_init_mac_addr(struct rte_eth_dev *eth_dev)
{
	struct hinic_nic_dev *nic_dev =
				HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
	uint8_t addr_bytes[RTE_ETHER_ADDR_LEN];
	u16 func_id = 0;
	int rc = 0;
	rc = hinic_get_default_mac(nic_dev->hwdev, addr_bytes);
	if (rc)
		return rc;
	rte_ether_addr_copy((struct rte_ether_addr *)addr_bytes,
		&eth_dev->data->mac_addrs[0]);
	if (rte_is_zero_ether_addr(&eth_dev->data->mac_addrs[0]))
		hinic_gen_random_mac_addr(&eth_dev->data->mac_addrs[0]);
	func_id = hinic_global_func_id(nic_dev->hwdev);
	rc = hinic_set_mac(nic_dev->hwdev,
			eth_dev->data->mac_addrs[0].addr_bytes,
			0, func_id);
	if (rc && rc != HINIC_PF_SET_VF_ALREADY)
		return rc;
	rte_ether_addr_copy(&eth_dev->data->mac_addrs[0],
			&nic_dev->default_addr);
	return 0;
}
static int hinic_init_mac_addr ( struct rte_eth_dev * eth_dev ) { struct hinic_nic_dev * nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV ( eth_dev ) ; uint8_t addr_bytes [ RTE_ETHER_ADDR_LEN ] ; u16 func_id = 0 ; int rc = 0 ; rc = hinic_get_default_mac ( nic_dev -> hwdev , addr_bytes ) ; if ( rc ) return rc ; rte_ether_addr_copy ( ( struct rte_ether_addr * ) addr_bytes , & eth_dev -> data -> mac_addrs [ 0 ] ) ; if ( rte_is_zero_ether_addr ( & eth_dev -> data -> mac_addrs [ 0 ] ) ) hinic_gen_random_mac_addr ( & eth_dev -> data -> mac_addrs [ 0 ] ) ; func_id = hinic_global_func_id ( nic_dev -> hwdev ) ; rc = hinic_set_mac ( nic_dev -> hwdev , eth_dev -> data -> mac_addrs [ 0 ] . addr_bytes , 0 , func_id ) ; if ( rc && rc != HINIC_PF_SET_VF_ALREADY ) return rc ; rte_ether_addr_copy ( & eth_dev -> data -> mac_addrs [ 0 ] , & nic_dev -> default_addr ) ; return 0 ; }
Init mac_vlan table in NIC.
Init mac_vlan table in NIC .