i40e: support default MAC address setting

Signed-off-by: Remy Horton <remy.horton@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
This commit is contained in:
Remy Horton 2016-03-09 13:29:24 +00:00 committed by Thomas Monjalon
parent d9efd0136a
commit e18e01e92c
2 changed files with 19 additions and 1 deletions

View File

@ -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.**

View File

@ -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);
}