Commit f1a7178b authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'net-vlan-claim-one-bit-from-sk_buff'

Eric Dumazet says:

====================
net: vlan: claim one bit from sk_buff

First patch claims skb->vlan_present.
This means some bpf changes, eg for sparc32 that I could not test.

Second patch removes one conditional test in gro_list_prepare().
====================

Link: https://lore.kernel.org/r/20221109095759.1874969-1-edumazet@google.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 2cf7e87f be3ed486
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -555,11 +555,11 @@ void bpf_jit_compile(struct bpf_prog *fp)
				emit_skb_load16(vlan_tci, r_A);
				break;
			case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
				__emit_skb_load8(__pkt_vlan_present_offset, r_A);
				if (PKT_VLAN_PRESENT_BIT)
					emit_alu_K(SRL, PKT_VLAN_PRESENT_BIT);
				if (PKT_VLAN_PRESENT_BIT < 7)
					emit_andi(r_A, 1, r_A);
				emit_skb_load32(vlan_all, r_A);
				emit_cmpi(r_A, 0);
				emit_branch_off(BE, 12);
				emit_nop();
				emit_loadimm(1, r_A);
				break;
			case BPF_LD | BPF_W | BPF_LEN:
				emit_skb_load32(len, r_A);
+1 −1
Original line number Diff line number Diff line
@@ -1973,7 +1973,7 @@ static u16 otx2_select_queue(struct net_device *netdev, struct sk_buff *skb,
#endif

#ifdef CONFIG_DCB
	if (!skb->vlan_present)
	if (!skb_vlan_tag_present(skb))
		goto pick_tx;

	vlan_prio = skb->vlan_tci >> 13;
+3 −6
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ static inline bool is_vlan_dev(const struct net_device *dev)
        return dev->priv_flags & IFF_802_1Q_VLAN;
}

#define skb_vlan_tag_present(__skb)	((__skb)->vlan_present)
#define skb_vlan_tag_present(__skb)	(!!(__skb)->vlan_all)
#define skb_vlan_tag_get(__skb)		((__skb)->vlan_tci)
#define skb_vlan_tag_get_id(__skb)	((__skb)->vlan_tci & VLAN_VID_MASK)
#define skb_vlan_tag_get_cfi(__skb)	(!!((__skb)->vlan_tci & VLAN_CFI_MASK))
@@ -471,7 +471,7 @@ static inline struct sk_buff *vlan_insert_tag_set_proto(struct sk_buff *skb,
 */
static inline void __vlan_hwaccel_clear_tag(struct sk_buff *skb)
{
	skb->vlan_present = 0;
	skb->vlan_all = 0;
}

/**
@@ -483,9 +483,7 @@ static inline void __vlan_hwaccel_clear_tag(struct sk_buff *skb)
 */
static inline void __vlan_hwaccel_copy_tag(struct sk_buff *dst, const struct sk_buff *src)
{
	dst->vlan_present = src->vlan_present;
	dst->vlan_proto = src->vlan_proto;
	dst->vlan_tci = src->vlan_tci;
	dst->vlan_all = src->vlan_all;
}

/*
@@ -519,7 +517,6 @@ static inline void __vlan_hwaccel_put_tag(struct sk_buff *skb,
{
	skb->vlan_proto = vlan_proto;
	skb->vlan_tci = vlan_tci;
	skb->vlan_present = 1;
}

/**
+10 −8
Original line number Diff line number Diff line
@@ -818,7 +818,7 @@ typedef unsigned char *sk_buff_data_t;
 *	@mark: Generic packet mark
 *	@reserved_tailroom: (aka @mark) number of bytes of free space available
 *		at the tail of an sk_buff
 *	@vlan_present: VLAN tag is present
 *	@vlan_all: vlan fields (proto & tci)
 *	@vlan_proto: vlan encapsulation protocol
 *	@vlan_tci: vlan tag control information
 *	@inner_protocol: Protocol (encapsulation)
@@ -951,7 +951,7 @@ struct sk_buff {
	/* private: */
	__u8			__pkt_vlan_present_offset[0];
	/* public: */
	__u8			vlan_present:1;	/* See PKT_VLAN_PRESENT_BIT */
	__u8			remcsum_offload:1;
	__u8			csum_complete_sw:1;
	__u8			csum_level:2;
	__u8			dst_pending_confirm:1;
@@ -966,7 +966,6 @@ struct sk_buff {

	__u8			ipvs_property:1;
	__u8			inner_protocol_type:1;
	__u8			remcsum_offload:1;
#ifdef CONFIG_NET_SWITCHDEV
	__u8			offload_fwd_mark:1;
	__u8			offload_l3_fwd_mark:1;
@@ -999,8 +998,13 @@ struct sk_buff {
	__u32			priority;
	int			skb_iif;
	__u32			hash;
	union {
		u32		vlan_all;
		struct {
			__be16	vlan_proto;
			__u16	vlan_tci;
		};
	};
#if defined(CONFIG_NET_RX_BUSY_POLL) || defined(CONFIG_XPS)
	union {
		unsigned int	napi_id;
@@ -1059,15 +1063,13 @@ struct sk_buff {
#endif
#define PKT_TYPE_OFFSET		offsetof(struct sk_buff, __pkt_type_offset)

/* if you move pkt_vlan_present, tc_at_ingress, or mono_delivery_time
/* if you move tc_at_ingress or mono_delivery_time
 * around, you also must adapt these constants.
 */
#ifdef __BIG_ENDIAN_BITFIELD
#define PKT_VLAN_PRESENT_BIT	7
#define TC_AT_INGRESS_MASK		(1 << 0)
#define SKB_MONO_DELIVERY_TIME_MASK	(1 << 2)
#else
#define PKT_VLAN_PRESENT_BIT	0
#define TC_AT_INGRESS_MASK		(1 << 7)
#define SKB_MONO_DELIVERY_TIME_MASK	(1 << 5)
#endif
+0 −1
Original line number Diff line number Diff line
@@ -14346,7 +14346,6 @@ static struct sk_buff *populate_skb(char *buf, int size)
	skb->hash = SKB_HASH;
	skb->queue_mapping = SKB_QUEUE_MAP;
	skb->vlan_tci = SKB_VLAN_TCI;
	skb->vlan_present = SKB_VLAN_PRESENT;
	skb->vlan_proto = htons(ETH_P_IP);
	dev_net_set(&dev, &init_net);
	skb->dev = &dev;
Loading