Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/vxlan.c drivers/vhost/net.c include/linux/if_vlan.h net/core/dev.c The net/core/dev.c conflict was the overlap of one commit marking an existing function static whilst another was adding a new function. In the include/linux/if_vlan.h case, the type used for a local variable was changed in 'net', whereas the function got rewritten to fix a stacked vlan bug in 'net-next'. In drivers/vhost/net.c, Al Viro's iov_iter conversions in 'net-next' overlapped with an endainness fix for VHOST 1.0 in 'net'. In drivers/net/vxlan.c, vxlan_find_vni() added a 'flags' parameter in 'net-next' whereas in 'net' there was a bug fix to pass in the correct network namespace pointer in calls to this function. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -472,27 +472,59 @@ static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
|
||||
/**
|
||||
* vlan_get_protocol - get protocol EtherType.
|
||||
* @skb: skbuff to query
|
||||
* @type: first vlan protocol
|
||||
* @depth: buffer to store length of eth and vlan tags in bytes
|
||||
*
|
||||
* Returns the EtherType of the packet, regardless of whether it is
|
||||
* vlan encapsulated (normal or hardware accelerated) or not.
|
||||
*/
|
||||
static inline __be16 vlan_get_protocol(const struct sk_buff *skb)
|
||||
static inline __be16 __vlan_get_protocol(struct sk_buff *skb, __be16 type,
|
||||
int *depth)
|
||||
{
|
||||
__be16 protocol = 0;
|
||||
unsigned int vlan_depth = skb->mac_len;
|
||||
|
||||
if (skb_vlan_tag_present(skb) ||
|
||||
skb->protocol != cpu_to_be16(ETH_P_8021Q))
|
||||
protocol = skb->protocol;
|
||||
else {
|
||||
__be16 proto, *protop;
|
||||
protop = skb_header_pointer(skb, offsetof(struct vlan_ethhdr,
|
||||
h_vlan_encapsulated_proto),
|
||||
sizeof(proto), &proto);
|
||||
if (likely(protop))
|
||||
protocol = *protop;
|
||||
/* if type is 802.1Q/AD then the header should already be
|
||||
* present at mac_len - VLAN_HLEN (if mac_len > 0), or at
|
||||
* ETH_HLEN otherwise
|
||||
*/
|
||||
if (type == htons(ETH_P_8021Q) || type == htons(ETH_P_8021AD)) {
|
||||
if (vlan_depth) {
|
||||
if (WARN_ON(vlan_depth < VLAN_HLEN))
|
||||
return 0;
|
||||
vlan_depth -= VLAN_HLEN;
|
||||
} else {
|
||||
vlan_depth = ETH_HLEN;
|
||||
}
|
||||
do {
|
||||
struct vlan_hdr *vh;
|
||||
|
||||
if (unlikely(!pskb_may_pull(skb,
|
||||
vlan_depth + VLAN_HLEN)))
|
||||
return 0;
|
||||
|
||||
vh = (struct vlan_hdr *)(skb->data + vlan_depth);
|
||||
type = vh->h_vlan_encapsulated_proto;
|
||||
vlan_depth += VLAN_HLEN;
|
||||
} while (type == htons(ETH_P_8021Q) ||
|
||||
type == htons(ETH_P_8021AD));
|
||||
}
|
||||
|
||||
return protocol;
|
||||
if (depth)
|
||||
*depth = vlan_depth;
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* vlan_get_protocol - get protocol EtherType.
|
||||
* @skb: skbuff to query
|
||||
*
|
||||
* Returns the EtherType of the packet, regardless of whether it is
|
||||
* vlan encapsulated (normal or hardware accelerated) or not.
|
||||
*/
|
||||
static inline __be16 vlan_get_protocol(struct sk_buff *skb)
|
||||
{
|
||||
return __vlan_get_protocol(skb, skb->protocol, NULL);
|
||||
}
|
||||
|
||||
static inline void vlan_set_encap_proto(struct sk_buff *skb,
|
||||
|
Reference in New Issue
Block a user