diff mbox series

[net-next,1/3] net: skb_mpls_push() modified to allow MPLS header push at start of packet.

Message ID 8ff8206cc062f1755292b26a32421a66eeb17ce7.1575964218.git.martin.varghese@nokia.com
State Changes Requested
Delegated to: David Miller
Headers show
Series New openvswitch MPLS actions for layer 2 tunnelling | expand

Commit Message

Martin Varghese Dec. 10, 2019, 8:15 a.m. UTC
From: Martin Varghese <martin.varghese@nokia.com>

The existing skb_mpls_push() implementation always inserts mpls header
after the mac header. L2 VPN use cases requires MPLS header to be
inserted before the ethernet header as the ethernet packet gets tunnelled
inside MPLS header in those cases.

Signed-off-by: Martin Varghese <martin.varghese@nokia.com>
---
 net/core/skbuff.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

David Miller Dec. 11, 2019, 1:43 a.m. UTC | #1
From: Martin Varghese <martinvarghesenokia@gmail.com>
Date: Tue, 10 Dec 2019 13:45:52 +0530

> @@ -5472,12 +5472,15 @@ static void skb_mod_eth_type(struct sk_buff *skb, struct ethhdr *hdr,
>  }
>  
>  /**
> - * skb_mpls_push() - push a new MPLS header after the mac header
> + * skb_mpls_push() - push a new MPLS header after mac_len bytes from start of
> + *                   the packet
>   *
>   * @skb: buffer
>   * @mpls_lse: MPLS label stack entry to push
>   * @mpls_proto: ethertype of the new MPLS header (expects 0x8847 or 0x8848)
>   * @mac_len: length of the MAC header
> + * #ethernet: flag to indicate if the resulting packet after skb_mpls_push is
> + *            ethernet

Why "#ethernet" and not "@ethernet" to refer to this argument?
Varghese, Martin (Nokia - IN/Bangalore) Dec. 11, 2019, 3:06 a.m. UTC | #2
Oops Typo, will fix it. thanks

-----Original Message-----
From: David Miller <davem@davemloft.net> 
Sent: Wednesday, December 11, 2019 7:14 AM
To: martinvarghesenokia@gmail.com
Cc: netdev@vger.kernel.org; pshelar@ovn.org; Drennan, Scott (Nokia - US/Mountain View) <scott.drennan@nokia.com>; jbenc@redhat.com; Varghese, Martin (Nokia - IN/Bangalore) <martin.varghese@nokia.com>
Subject: Re: [PATCH net-next 1/3] net: skb_mpls_push() modified to allow MPLS header push at start of packet.

From: Martin Varghese <martinvarghesenokia@gmail.com>
Date: Tue, 10 Dec 2019 13:45:52 +0530

> @@ -5472,12 +5472,15 @@ static void skb_mod_eth_type(struct sk_buff 
> *skb, struct ethhdr *hdr,  }
>  
>  /**
> - * skb_mpls_push() - push a new MPLS header after the mac header
> + * skb_mpls_push() - push a new MPLS header after mac_len bytes from start of
> + *                   the packet
>   *
>   * @skb: buffer
>   * @mpls_lse: MPLS label stack entry to push
>   * @mpls_proto: ethertype of the new MPLS header (expects 0x8847 or 0x8848)
>   * @mac_len: length of the MAC header
> + * #ethernet: flag to indicate if the resulting packet after skb_mpls_push is
> + *            ethernet

Why "#ethernet" and not "@ethernet" to refer to this argument?
diff mbox series

Patch

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 973a71f..7773176 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -5472,12 +5472,15 @@  static void skb_mod_eth_type(struct sk_buff *skb, struct ethhdr *hdr,
 }
 
 /**
- * skb_mpls_push() - push a new MPLS header after the mac header
+ * skb_mpls_push() - push a new MPLS header after mac_len bytes from start of
+ *                   the packet
  *
  * @skb: buffer
  * @mpls_lse: MPLS label stack entry to push
  * @mpls_proto: ethertype of the new MPLS header (expects 0x8847 or 0x8848)
  * @mac_len: length of the MAC header
+ * #ethernet: flag to indicate if the resulting packet after skb_mpls_push is
+ *            ethernet
  *
  * Expects skb->data at mac header.
  *
@@ -5501,7 +5504,7 @@  int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto,
 		return err;
 
 	if (!skb->inner_protocol) {
-		skb_set_inner_network_header(skb, mac_len);
+		skb_set_inner_network_header(skb, skb_network_offset(skb));
 		skb_set_inner_protocol(skb, skb->protocol);
 	}