skbuff.c (040b5cfbcefa263ccf2c118c4938308606bb7ed8) skbuff.c (d04ac224b1688f005a84f764cfe29844f8e9da08)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Routines having to do with the 'struct sk_buff' memory handlers.
4 *
5 * Authors: Alan Cox <alan@lxorguk.ukuu.org.uk>
6 * Florian La Roche <rzsfl@rz.uni-sb.de>
7 *
8 * Fixes:

--- 5470 unchanged lines hidden (view full) ---

5479 * @mpls_proto: ethertype of the new MPLS header (expects 0x8847 or 0x8848)
5480 * @mac_len: length of the MAC header
5481 *
5482 * Expects skb->data at mac header.
5483 *
5484 * Returns 0 on success, -errno otherwise.
5485 */
5486int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto,
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Routines having to do with the 'struct sk_buff' memory handlers.
4 *
5 * Authors: Alan Cox <alan@lxorguk.ukuu.org.uk>
6 * Florian La Roche <rzsfl@rz.uni-sb.de>
7 *
8 * Fixes:

--- 5470 unchanged lines hidden (view full) ---

5479 * @mpls_proto: ethertype of the new MPLS header (expects 0x8847 or 0x8848)
5480 * @mac_len: length of the MAC header
5481 *
5482 * Expects skb->data at mac header.
5483 *
5484 * Returns 0 on success, -errno otherwise.
5485 */
5486int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto,
5487 int mac_len)
5487 int mac_len, bool ethernet)
5488{
5489 struct mpls_shim_hdr *lse;
5490 int err;
5491
5492 if (unlikely(!eth_p_mpls(mpls_proto)))
5493 return -EINVAL;
5494
5495 /* Networking stack does not allow simultaneous Tunnel and MPLS GSO. */

--- 14 unchanged lines hidden (view full) ---

5510 mac_len);
5511 skb_reset_mac_header(skb);
5512 skb_set_network_header(skb, mac_len);
5513
5514 lse = mpls_hdr(skb);
5515 lse->label_stack_entry = mpls_lse;
5516 skb_postpush_rcsum(skb, lse, MPLS_HLEN);
5517
5488{
5489 struct mpls_shim_hdr *lse;
5490 int err;
5491
5492 if (unlikely(!eth_p_mpls(mpls_proto)))
5493 return -EINVAL;
5494
5495 /* Networking stack does not allow simultaneous Tunnel and MPLS GSO. */

--- 14 unchanged lines hidden (view full) ---

5510 mac_len);
5511 skb_reset_mac_header(skb);
5512 skb_set_network_header(skb, mac_len);
5513
5514 lse = mpls_hdr(skb);
5515 lse->label_stack_entry = mpls_lse;
5516 skb_postpush_rcsum(skb, lse, MPLS_HLEN);
5517
5518 if (skb->dev && skb->dev->type == ARPHRD_ETHER)
5518 if (ethernet)
5519 skb_mod_eth_type(skb, eth_hdr(skb), mpls_proto);
5520 skb->protocol = mpls_proto;
5521
5522 return 0;
5523}
5524EXPORT_SYMBOL_GPL(skb_mpls_push);
5525
5526/**

--- 590 unchanged lines hidden ---
5519 skb_mod_eth_type(skb, eth_hdr(skb), mpls_proto);
5520 skb->protocol = mpls_proto;
5521
5522 return 0;
5523}
5524EXPORT_SYMBOL_GPL(skb_mpls_push);
5525
5526/**

--- 590 unchanged lines hidden ---