Skip to contentSkip to conversation

net/axgbe: add additional MAC address support

PATCH In review [email protected] 2 participants 3 messages Feb 28, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net/axgbe: add additional MAC address support

From: Chandu Babu N <[email protected]>

Supports adding MAC addresses to enable whitelist filtering to accept packets
implement eth_dev_ops mac_addr_set, mac_addr_add, mac_addr_remove and set_mc_addr_list

---
 drivers/net/axgbe/axgbe_dev.c    | 29 ++++++++++
 drivers/net/axgbe/axgbe_ethdev.c | 94 ++++++++++++++++++++++++++++++--
 drivers/net/axgbe/axgbe_ethdev.h |  4 +-
 3 files changed, 121 insertions(+), 6 deletions(-)
drivers/net/axgbe/axgbe_dev.c +29 -0
index 2e796c0b3..f830b7230 100644
@@ -1008,6 +1008,35 @@ static void axgbe_enable_mtl_interrupts(struct axgbe_port *pdata)
 	}
 }
 
+void axgbe_set_mac_addn_addr(struct axgbe_port *pdata, u8 *addr, uint32_t index)
+{
+	unsigned int mac_addr_hi, mac_addr_lo;
+	u8 *mac_addr;
+
+	mac_addr_lo = 0;
+	mac_addr_hi = 0;
+
+	if (addr) {
+		mac_addr = (u8 *)&mac_addr_lo;
+		mac_addr[0] = addr[0];
+		mac_addr[1] = addr[1];
+		mac_addr[2] = addr[2];
+		mac_addr[3] = addr[3];
+		mac_addr = (u8 *)&mac_addr_hi;
+		mac_addr[0] = addr[4];
+		mac_addr[1] = addr[5];
+
+		/*Address Enable: Use this Addr for Perfect Filtering */
+		AXGMAC_SET_BITS(mac_addr_hi, MAC_MACA1HR, AE, 1);
+	}
+
+	PMD_DRV_LOG(DEBUG, "%s mac address at %#x\n",
+		    addr ? "set" : "clear", index);
+
+	AXGMAC_IOWRITE(pdata, MAC_MACAHR(index), mac_addr_hi);
+	AXGMAC_IOWRITE(pdata, MAC_MACALR(index), mac_addr_lo);
+}
+
 static int axgbe_set_mac_address(struct axgbe_port *pdata, u8 *addr)
 {
 	unsigned int mac_addr_hi, mac_addr_lo;
drivers/net/axgbe/axgbe_ethdev.c +89 -5

132 lines not on this page · raw message

drivers/net/axgbe/axgbe_ethdev.h +3 -1
index a1083b17b..781d170e5 100644
@@ -16,7 +16,7 @@
 #define AXGBE_TX_MAX_BUF_SIZE		(0x3fff & ~(64 - 1))
 #define AXGBE_RX_MAX_BUF_SIZE		(0x3fff & ~(64 - 1))
 #define AXGBE_RX_MIN_BUF_SIZE		(RTE_ETHER_MAX_LEN + VLAN_HLEN)
-#define AXGBE_MAX_MAC_ADDRS		1
+#define AXGBE_MAX_MAC_ADDRS		32
 
 #define AXGBE_RX_BUF_ALIGN		64
 
@@ -631,5 +631,7 @@ void axgbe_init_function_ptrs_dev(struct axgbe_hw_if *hw_if);
 void axgbe_init_function_ptrs_phy(struct axgbe_phy_if *phy_if);
 void axgbe_init_function_ptrs_phy_v2(struct axgbe_phy_if *phy_if);
 void axgbe_init_function_ptrs_i2c(struct axgbe_i2c_if *i2c_if);
+void axgbe_set_mac_addn_addr(struct axgbe_port *pdata, u8 *addr,
+			     uint32_t index);
 
 #endif /* RTE_ETH_AXGBE_H_ */
Signature · 1 line
2.17.1
#1 lore raw
Quoted 8 lines · On 2/28/2020 1:59 PM, [email protected] wrote:

From: Chandu Babu N <[email protected]>

Supports adding MAC addresses to enable whitelist filtering to accept packets
implement eth_dev_ops mac_addr_set, mac_addr_add, mac_addr_remove and set_mc_addr_list

Hi Chandu, Amaranath,

Same comment with previous patchset,

Please check the "Contributing Code to DPDK" before sending patch:
https://doc.dpdk.org/guides/contributing/patches.html

And prefer threading for series instead of sending them one by one, as noted in above document:

''Shallow threading (--thread --no-chain-reply-to) is preferred for a patch series.''

#2 lore raw

[AMD Official Use Only - Internal Distribution Only]

Hi Ferruh,

Thank you for pointing it out, I will correct them.

Regards,
Chandu
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, February 28, 2020 7:33 PM
To: Namburu, Chandu-babu <[email protected]>; [email protected]; Somalapuram, Amaranath <[email protected]>
Cc: Kumar, Ravi1 <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1 1/2] net/axgbe: add additional MAC address support

Quoted 7 lines · On 2/28/2020 1:59 PM, [email protected] wrote:

From: Chandu Babu N <[email protected]>

Supports adding MAC addresses to enable whitelist filtering to accept packets implement eth_dev_ops mac_addr_set, mac_addr_add, mac_addr_remove and set_mc_addr_list

Hi Chandu, Amaranath,

Same comment with previous patchset,

Please check the "Contributing Code to DPDK" before sending patch:
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fguides%2Fcontributing%2Fpatches.html&amp;data=02%7C01%7Cchandu%40amd.com%7Cdaf59805e48d4384dc8708d7bc570ff4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637184954444477587&amp;sdata=PLWzmriaCP0%2FS51xJomCQWlT7EJ5bwz95ZOsJAP5fX0%3D&amp;reserved=0

And prefer threading for series instead of sending them one by one, as noted in above document:

''Shallow threading (--thread --no-chain-reply-to) is preferred for a patch series.''