Commit 7025abb2 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'vlan-prepare-for-removal-of-VLAN_TAG_PRESENT'



Michał Mirosław says:

====================
net/vlan: prepare for removal of VLAN_TAG_PRESENT

This is a preparatory patchset before removing the use of VLAN_TAG_PRESENT
bit in skb->vlan_tci as indication of VLAN offload. This set includes
only cleanups that allow abstracting of code testing VLAN tag presence
in drivers and networking code.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 1295e2cf 295d072a
Loading
Loading
Loading
Loading
+26 −4
Original line number Original line Diff line number Diff line
@@ -81,7 +81,7 @@ static inline bool is_vlan_dev(const struct net_device *dev)
#define skb_vlan_tag_present(__skb)	((__skb)->vlan_tci & VLAN_TAG_PRESENT)
#define skb_vlan_tag_present(__skb)	((__skb)->vlan_tci & VLAN_TAG_PRESENT)
#define skb_vlan_tag_get(__skb)		((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
#define skb_vlan_tag_get(__skb)		((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
#define skb_vlan_tag_get_id(__skb)	((__skb)->vlan_tci & VLAN_VID_MASK)
#define skb_vlan_tag_get_id(__skb)	((__skb)->vlan_tci & VLAN_VID_MASK)
#define skb_vlan_tag_get_prio(__skb)	((__skb)->vlan_tci & VLAN_PRIO_MASK)
#define skb_vlan_tag_get_prio(__skb)	(((__skb)->vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT)


static inline int vlan_get_rx_ctag_filter_info(struct net_device *dev)
static inline int vlan_get_rx_ctag_filter_info(struct net_device *dev)
{
{
@@ -461,6 +461,30 @@ static inline struct sk_buff *vlan_insert_tag_set_proto(struct sk_buff *skb,
	return skb;
	return skb;
}
}


/**
 * __vlan_hwaccel_clear_tag - clear hardware accelerated VLAN info
 * @skb: skbuff to clear
 *
 * Clears the VLAN information from @skb
 */
static inline void __vlan_hwaccel_clear_tag(struct sk_buff *skb)
{
	skb->vlan_tci = 0;
}

/**
 * __vlan_hwaccel_copy_tag - copy hardware accelerated VLAN info from another skb
 * @dst: skbuff to copy to
 * @src: skbuff to copy from
 *
 * Copies VLAN information from @src to @dst (for branchless code)
 */
static inline void __vlan_hwaccel_copy_tag(struct sk_buff *dst, const struct sk_buff *src)
{
	dst->vlan_proto = src->vlan_proto;
	dst->vlan_tci = src->vlan_tci;
}

/*
/*
 * __vlan_hwaccel_push_inside - pushes vlan tag to the payload
 * __vlan_hwaccel_push_inside - pushes vlan tag to the payload
 * @skb: skbuff to tag
 * @skb: skbuff to tag
@@ -475,7 +499,7 @@ static inline struct sk_buff *__vlan_hwaccel_push_inside(struct sk_buff *skb)
	skb = vlan_insert_tag_set_proto(skb, skb->vlan_proto,
	skb = vlan_insert_tag_set_proto(skb, skb->vlan_proto,
					skb_vlan_tag_get(skb));
					skb_vlan_tag_get(skb));
	if (likely(skb))
	if (likely(skb))
		skb->vlan_tci = 0;
		__vlan_hwaccel_clear_tag(skb);
	return skb;
	return skb;
}
}


@@ -531,8 +555,6 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb,
	}
	}
}
}


#define HAVE_VLAN_GET_TAG

/**
/**
 * vlan_get_tag - get the VLAN ID from the skb
 * vlan_get_tag - get the VLAN ID from the skb
 * @skb: skbuff to query
 * @skb: skbuff to query
+1 −2
Original line number Original line Diff line number Diff line
@@ -952,8 +952,7 @@ proto_again:


			if (!vlan) {
			if (!vlan) {
				key_vlan->vlan_id = skb_vlan_tag_get_id(skb);
				key_vlan->vlan_id = skb_vlan_tag_get_id(skb);
				key_vlan->vlan_priority =
				key_vlan->vlan_priority = skb_vlan_tag_get_prio(skb);
					(skb_vlan_tag_get_prio(skb) >> VLAN_PRIO_SHIFT);
			} else {
			} else {
				key_vlan->vlan_id = ntohs(vlan->h_vlan_TCI) &
				key_vlan->vlan_id = ntohs(vlan->h_vlan_TCI) &
					VLAN_VID_MASK;
					VLAN_VID_MASK;