DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/nfp: add support for chaning MAC address
@ 2018-04-13 11:00 Alejandro Lucero
  2018-04-13 17:02 ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Alejandro Lucero @ 2018-04-13 11:00 UTC (permalink / raw)
  To: dev

This patch allows to use another MAC address than the one coming
with the NIC by default.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
---
 drivers/net/nfp/nfp_net.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index bedd4b6..7db438c 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -109,6 +109,8 @@ static int nfp_net_rss_reta_write(struct rte_eth_dev *dev,
 		    uint16_t reta_size);
 static int nfp_net_rss_hash_write(struct rte_eth_dev *dev,
 			struct rte_eth_rss_conf *rss_conf);
+static void nfp_set_mac_addr(struct rte_eth_dev *dev,
+			     struct ether_addr *mac_addr);
 
 /* The offset of the queue controller queues in the PCIe Target */
 #define NFP_PCIE_QUEUE(_q) (0x80000 + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & 0xff)))
@@ -684,6 +686,15 @@ enum nfp_qcp_ptr {
 		  hw->ctrl_bar + NFP_NET_CFG_MACADDR + 6);
 }
 
+void
+nfp_set_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
+{
+	struct nfp_net_hw *hw;
+
+	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	nfp_net_write_mac(hw, (uint8_t *)mac_addr);
+}
+
 static int
 nfp_configure_rx_interrupt(struct rte_eth_dev *dev,
 			   struct rte_intr_handle *intr_handle)
@@ -2750,6 +2761,7 @@ uint32_t nfp_net_txq_full(struct nfp_net_txq *txq)
 	.dev_infos_get		= nfp_net_infos_get,
 	.dev_supported_ptypes_get = nfp_net_supported_ptypes_get,
 	.mtu_set		= nfp_net_dev_mtu_set,
+	.mac_addr_set           = nfp_set_mac_addr,
 	.vlan_offload_set	= nfp_net_vlan_offload_set,
 	.reta_update		= nfp_net_reta_update,
 	.reta_query		= nfp_net_reta_query,
-- 
1.9.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-13 17:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-13 11:00 [dpdk-dev] [PATCH] net/nfp: add support for chaning MAC address Alejandro Lucero
2018-04-13 17:02 ` Ferruh Yigit
2018-04-13 17:06   ` Alejandro Lucero

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).