mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-01 12:04:08 +00:00
net/packet: Remove redundant skb->protocol set
c72219b75f
introduced tpacket_set_protocol that parses the Ethernet L2
header and sets skb->protocol if it's unset. It is no longer needed
since the introduction of packet_parse_headers. In case of SOCK_RAW and
unset skb->protocol, packet_parse_headers asks the driver to tell the
protocol number, and it's implemented for all Ethernet devices. As the
old function supported only Ethernet, no functionality is lost.
Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
75c65772c3
commit
6437866e49
1 changed files with 0 additions and 11 deletions
|
@ -2413,15 +2413,6 @@ static void tpacket_destruct_skb(struct sk_buff *skb)
|
||||||
sock_wfree(skb);
|
sock_wfree(skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tpacket_set_protocol(const struct net_device *dev,
|
|
||||||
struct sk_buff *skb)
|
|
||||||
{
|
|
||||||
if (dev->type == ARPHRD_ETHER) {
|
|
||||||
skb_reset_mac_header(skb);
|
|
||||||
skb->protocol = eth_hdr(skb)->h_proto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int __packet_snd_vnet_parse(struct virtio_net_hdr *vnet_hdr, size_t len)
|
static int __packet_snd_vnet_parse(struct virtio_net_hdr *vnet_hdr, size_t len)
|
||||||
{
|
{
|
||||||
if ((vnet_hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) &&
|
if ((vnet_hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) &&
|
||||||
|
@ -2492,8 +2483,6 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb,
|
||||||
return err;
|
return err;
|
||||||
if (!dev_validate_header(dev, skb->data, hdrlen))
|
if (!dev_validate_header(dev, skb->data, hdrlen))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (!skb->protocol)
|
|
||||||
tpacket_set_protocol(dev, skb);
|
|
||||||
|
|
||||||
data += hdrlen;
|
data += hdrlen;
|
||||||
to_write -= hdrlen;
|
to_write -= hdrlen;
|
||||||
|
|
Loading…
Add table
Reference in a new issue