From: Remy Horton Date: Wed, 9 Mar 2016 13:29:24 +0000 (+0000) Subject: i40e: support default MAC address setting X-Git-Tag: spdx-start~7352 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e18e01e92c29677b2974bb4e3dfa35754e879f17;p=dpdk.git i40e: support default MAC address setting Signed-off-by: Remy Horton Acked-by: John McNamara --- diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index b5987569b5..1c117f36c1 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -144,7 +144,7 @@ This section should contain new features added in this release. Sample format: space bytes, to boost the performance. In the meanwhile, it deprecated the legacy way via reading/writing sysfile supported by kernel module igb_uio. -* **Added i40e support for setting VF mac addresses.** +* **Added i40e support for setting mac addresses.** * **Added dump of i40e registers and EEPROM.** diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index f7f4ed8935..10e0d38507 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -434,6 +434,9 @@ static int i40e_get_eeprom_length(struct rte_eth_dev *dev); static int i40e_get_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *eeprom); +static void i40e_set_default_mac_addr(struct rte_eth_dev *dev, + struct ether_addr *mac_addr); + static const struct rte_pci_id pci_id_i40e_map[] = { #define RTE_PCI_DEV_ID_DECL_I40E(vend, dev) {RTE_PCI_DEVICE(vend, dev)}, #include "rte_pci_dev_ids.h" @@ -505,6 +508,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .get_reg = i40e_get_regs, .get_eeprom_length = i40e_get_eeprom_length, .get_eeprom = i40e_get_eeprom, + .mac_addr_set = i40e_set_default_mac_addr, }; /* store statistics names and its offset in stats structure */ @@ -8988,3 +8992,17 @@ static int i40e_get_eeprom(struct rte_eth_dev *dev, return 0; } + +static void i40e_set_default_mac_addr(struct rte_eth_dev *dev, + struct ether_addr *mac_addr) +{ + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (!is_valid_assigned_ether_addr(mac_addr)) { + PMD_DRV_LOG(ERR, "Tried to set invalid MAC address."); + return; + } + + /* Flags: 0x3 updates port address */ + i40e_aq_mac_address_write(hw, 0x3, mac_addr->addr_bytes, NULL); +}