Minor macvlan source mode cleanups
Subsystems (2)
cover Minor macvlan source mode cleanups
So this patch series is just a few minor cleanups for macvlan source mode. The first patch addresses double receives when a packet is being routed to the macvlan destination address, and the other addresses the pkt_type being updated in cases where it most likely should not be.
---
Alexander Duyck (2):
macvlan: Only deliver one copy of the frame to the macvlan interface
macvlan: Only update pkt_type if destination MAC address matches
drivers/net/macvlan.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
PATCH 1/2 macvlan: Only deliver one copy of the frame to the macvlan interface
From: Alexander Duyck <[email protected]>
This patch intoduces a slight adjustment for macvlan to address the fact that in source mode I was seeing two copies of any packet addressed to the macvlan interface being delivered where there should have been only one.
The issue appears to be that one copy was delivered based on the source MAC address and then the second copy was being delivered based on the destination MAC address. To fix it I am just treating a unicast address match as though it is not a match since source based macvlan isn't supposed to be matching based on the destination MAC anyway.
--- drivers/net/macvlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/macvlan.c +1 -1
@@ -480,7 +480,7 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb) struct macvlan_dev, list); else vlan =macvlan_hash_lookup (port, eth->h_dest); -if (vlan ==NULL ) +if (!vlan || vlan->mode ==MACVLAN_MODE_SOURCE )return RX_HANDLER_PASS ; dev = vlan->dev;
PATCH 2/2 macvlan: Only update pkt_type if destination MAC address matches
In reply to Alexander DuyckFrom: Alexander Duyck <[email protected]>
This patch updates the pkt_type to PACKET_HOST only if the destination MAC address matches on the on the source based macvlan. It didn't make sense to be updating broadcast, multicast, and non-local destined frames with PACKET_HOST.
--- drivers/net/macvlan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/macvlan.c +3 -1
@@ -413,7 +413,9 @@ static void macvlan_forward_source_one(struct sk_buff *skb, len = nskb->len +ETH_HLEN ; nskb->dev = dev; - nskb->pkt_type =PACKET_HOST ; + +if (ether_addr_equal_64bits (eth_hdr (skb)->h_dest, dev->dev_addr)) + nskb->pkt_type =PACKET_HOST ; ret =netif_rx (nskb);macvlan_count_rx (vlan, len, ret ==NET_RX_SUCCESS , false);
David Miller
maintainerFrom: Alexander Duyck <[email protected]>
Date: Fri, 13 Oct 2017 13:40:18 -0700
Quoted 4 lines
So this patch series is just a few minor cleanups for macvlan source mode. The first patch addresses double receives when a packet is being routed to the macvlan destination address, and the other addresses the
pkt_typebeing updated in cases where it most likely should not be.
Series applied, thanks.