All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] ipvlan: Eliminate duplicated codes with existing function
@ 2017-12-06 11:04 gfree.wind
  2017-12-06 20:15 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: gfree.wind @ 2017-12-06 11:04 UTC (permalink / raw)
  To: davem, netdev; +Cc: Gao Feng

From: Gao Feng <gfree.wind@vip.163.com>

The recv flow of ipvlan l2 mode performs as same as l3 mode for
non-multicast packet, so use the existing func ipvlan_handle_mode_l3
instead of these duplicated statements in non-multicast case.

Signed-off-by: Gao Feng <gfree.wind@vip.163.com>
---
 drivers/net/ipvlan/ipvlan_core.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
index 11c1e79..20dd95e7 100644
--- a/drivers/net/ipvlan/ipvlan_core.c
+++ b/drivers/net/ipvlan/ipvlan_core.c
@@ -663,8 +663,6 @@ static rx_handler_result_t ipvlan_handle_mode_l2(struct sk_buff **pskb,
 	struct sk_buff *skb = *pskb;
 	struct ethhdr *eth = eth_hdr(skb);
 	rx_handler_result_t ret = RX_HANDLER_PASS;
-	void *lyr3h;
-	int addr_type;
 
 	if (is_multicast_ether_addr(eth->h_dest)) {
 		if (ipvlan_external_frame(skb, port)) {
@@ -682,15 +680,8 @@ static rx_handler_result_t ipvlan_handle_mode_l2(struct sk_buff **pskb,
 			}
 		}
 	} else {
-		struct ipvl_addr *addr;
-
-		lyr3h = ipvlan_get_L3_hdr(port, skb, &addr_type);
-		if (!lyr3h)
-			return ret;
-
-		addr = ipvlan_addr_lookup(port, lyr3h, addr_type, true);
-		if (addr)
-			ret = ipvlan_rcv_frame(addr, pskb, false);
+		/* Perform like l3 mode for non-multicast packet */
+		ret = ipvlan_handle_mode_l3(pskb, port);
 	}
 
 	return ret;
-- 
1.9.1

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

* Re: [PATCH net-next] ipvlan: Eliminate duplicated codes with existing function
  2017-12-06 11:04 [PATCH net-next] ipvlan: Eliminate duplicated codes with existing function gfree.wind
@ 2017-12-06 20:15 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-12-06 20:15 UTC (permalink / raw)
  To: gfree.wind; +Cc: netdev

From: gfree.wind@vip.163.com
Date: Wed,  6 Dec 2017 19:04:26 +0800

> From: Gao Feng <gfree.wind@vip.163.com>
> 
> The recv flow of ipvlan l2 mode performs as same as l3 mode for
> non-multicast packet, so use the existing func ipvlan_handle_mode_l3
> instead of these duplicated statements in non-multicast case.
> 
> Signed-off-by: Gao Feng <gfree.wind@vip.163.com>

Applied, thanks.

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

end of thread, other threads:[~2017-12-06 20:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-06 11:04 [PATCH net-next] ipvlan: Eliminate duplicated codes with existing function gfree.wind
2017-12-06 20:15 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.