@@ -33,7 +33,7 @@ nfp_net_pf_read_mac(struct nfp_app_fw_nic *app_fw_nic,
nfp_eth_table = nfp_eth_read_ports(app_fw_nic->pf_dev->cpp);
- rte_ether_addr_copy(&nfp_eth_table->ports[port].mac_addr, &hw->mac_addr);
+ rte_ether_addr_copy(&nfp_eth_table->ports[port].mac_addr, &hw->super.mac_addr);
free(nfp_eth_table);
@@ -599,18 +599,18 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
}
nfp_net_pf_read_mac(app_fw_nic, port);
- nfp_net_write_mac(hw, &hw->mac_addr.addr_bytes[0]);
+ nfp_net_write_mac(&hw->super, &hw->super.mac_addr.addr_bytes[0]);
- tmp_ether_addr = &hw->mac_addr;
+ tmp_ether_addr = &hw->super.mac_addr;
if (rte_is_valid_assigned_ether_addr(tmp_ether_addr) == 0) {
PMD_INIT_LOG(INFO, "Using random mac address for port %d", port);
/* Using random mac addresses for VFs */
- rte_eth_random_addr(&hw->mac_addr.addr_bytes[0]);
- nfp_net_write_mac(hw, &hw->mac_addr.addr_bytes[0]);
+ rte_eth_random_addr(&hw->super.mac_addr.addr_bytes[0]);
+ nfp_net_write_mac(&hw->super, &hw->super.mac_addr.addr_bytes[0]);
}
/* Copying mac address to DPDK eth_dev struct */
- rte_ether_addr_copy(&hw->mac_addr, eth_dev->data->mac_addrs);
+ rte_ether_addr_copy(&hw->super.mac_addr, eth_dev->data->mac_addrs);
if ((hw->super.cap & NFP_NET_CFG_CTRL_LIVE_ADDR) == 0)
eth_dev->data->dev_flags |= RTE_ETH_DEV_NOLIVE_MAC_ADDR;
@@ -621,7 +621,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
"mac=" RTE_ETHER_ADDR_PRT_FMT,
eth_dev->data->port_id, pci_dev->id.vendor_id,
pci_dev->id.device_id,
- RTE_ETHER_ADDR_BYTES(&hw->mac_addr));
+ RTE_ETHER_ADDR_BYTES(&hw->super.mac_addr));
/* Registering LSC interrupt handler */
rte_intr_callback_register(pci_dev->intr_handle,
@@ -16,14 +16,14 @@
#include "nfp_net_common.h"
static void
-nfp_netvf_read_mac(struct nfp_net_hw *hw)
+nfp_netvf_read_mac(struct nfp_hw *hw)
{
uint32_t tmp;
- tmp = rte_be_to_cpu_32(nn_cfg_readl(&hw->super, NFP_NET_CFG_MACADDR));
+ tmp = rte_be_to_cpu_32(nn_cfg_readl(hw, NFP_NET_CFG_MACADDR));
memcpy(&hw->mac_addr.addr_bytes[0], &tmp, 4);
- tmp = rte_be_to_cpu_32(nn_cfg_readl(&hw->super, NFP_NET_CFG_MACADDR + 4));
+ tmp = rte_be_to_cpu_32(nn_cfg_readl(hw, NFP_NET_CFG_MACADDR + 4));
memcpy(&hw->mac_addr.addr_bytes[4], &tmp, 2);
}
@@ -332,16 +332,16 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)
goto dev_err_ctrl_map;
}
- nfp_netvf_read_mac(hw);
- if (rte_is_valid_assigned_ether_addr(&hw->mac_addr) == 0) {
+ nfp_netvf_read_mac(&hw->super);
+ if (rte_is_valid_assigned_ether_addr(&hw->super.mac_addr) == 0) {
PMD_INIT_LOG(INFO, "Using random mac address for port %hu", port);
/* Using random mac addresses for VFs */
- rte_eth_random_addr(&hw->mac_addr.addr_bytes[0]);
- nfp_net_write_mac(hw, &hw->mac_addr.addr_bytes[0]);
+ rte_eth_random_addr(&hw->super.mac_addr.addr_bytes[0]);
+ nfp_net_write_mac(&hw->super, &hw->super.mac_addr.addr_bytes[0]);
}
/* Copying mac address to DPDK eth_dev struct */
- rte_ether_addr_copy(&hw->mac_addr, eth_dev->data->mac_addrs);
+ rte_ether_addr_copy(&hw->super.mac_addr, eth_dev->data->mac_addrs);
if ((hw->super.cap & NFP_NET_CFG_CTRL_LIVE_ADDR) == 0)
eth_dev->data->dev_flags |= RTE_ETH_DEV_NOLIVE_MAC_ADDR;
@@ -352,7 +352,7 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)
"mac=" RTE_ETHER_ADDR_PRT_FMT,
port, pci_dev->id.vendor_id,
pci_dev->id.device_id,
- RTE_ETHER_ADDR_BYTES(&hw->mac_addr));
+ RTE_ETHER_ADDR_BYTES(&hw->super.mac_addr));
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
/* Registering LSC interrupt handler */
@@ -532,19 +532,19 @@ nfp_net_cfg_queue_setup(struct nfp_net_hw *hw)
}
void
-nfp_net_write_mac(struct nfp_net_hw *hw,
+nfp_net_write_mac(struct nfp_hw *hw,
uint8_t *mac)
{
uint32_t mac0;
uint16_t mac1;
mac0 = *(uint32_t *)mac;
- nn_writel(rte_cpu_to_be_32(mac0), hw->super.ctrl_bar + NFP_NET_CFG_MACADDR);
+ nn_writel(rte_cpu_to_be_32(mac0), hw->ctrl_bar + NFP_NET_CFG_MACADDR);
mac += 4;
mac1 = *(uint16_t *)mac;
nn_writew(rte_cpu_to_be_16(mac1),
- hw->super.ctrl_bar + NFP_NET_CFG_MACADDR + 6);
+ hw->ctrl_bar + NFP_NET_CFG_MACADDR + 6);
}
int
@@ -565,7 +565,7 @@ nfp_net_set_mac_addr(struct rte_eth_dev *dev,
}
/* Writing new MAC to the specific port BAR address */
- nfp_net_write_mac(net_hw, (uint8_t *)mac_addr);
+ nfp_net_write_mac(hw, (uint8_t *)mac_addr);
update = NFP_NET_CFG_UPDATE_MACADDR;
ctrl = hw->ctrl;
@@ -120,6 +120,7 @@ struct nfp_hw {
uint32_t ctrl;
uint32_t ctrl_ext;
rte_spinlock_t reconfig_lock;
+ struct rte_ether_addr mac_addr;
};
struct nfp_net_hw {
@@ -159,8 +160,6 @@ struct nfp_net_hw {
uint16_t subsystem_device_id;
uint16_t subsystem_vendor_id;
- struct rte_ether_addr mac_addr;
-
/** Records starting point for counters */
struct rte_eth_stats eth_stats_base;
struct rte_eth_xstat *eth_xstats_base;
@@ -376,7 +375,7 @@ void nfp_net_log_device_information(const struct nfp_net_hw *hw);
void nfp_net_enable_queues(struct rte_eth_dev *dev);
void nfp_net_disable_queues(struct rte_eth_dev *dev);
void nfp_net_params_setup(struct nfp_net_hw *hw);
-void nfp_net_write_mac(struct nfp_net_hw *hw, uint8_t *mac);
+void nfp_net_write_mac(struct nfp_hw *hw, uint8_t *mac);
int nfp_net_set_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr);
int nfp_configure_rx_interrupt(struct rte_eth_dev *dev,
struct rte_intr_handle *intr_handle);