Message ID | 85c211f16e696607c9f61f96b8234684a2a2385b.1483487888.git.mirq-linux@rere.qmqm.pl |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
Michał Mirosław <mirq-linux@rere.qmqm.pl> writes: > Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Can we have a non-empty description please? > --- > drivers/net/hyperv/hyperv_net.h | 2 +- > drivers/net/hyperv/netvsc_drv.c | 13 ++++++------- > drivers/net/hyperv/rndis_filter.c | 4 ++-- > 3 files changed, 9 insertions(+), 10 deletions(-) > > diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h > index 3958adade7eb..b53729e85a79 100644 > --- a/drivers/net/hyperv/hyperv_net.h > +++ b/drivers/net/hyperv/hyperv_net.h > @@ -186,7 +186,7 @@ int netvsc_recv_callback(struct hv_device *device_obj, > void **data, > struct ndis_tcp_ip_checksum_info *csum_info, > struct vmbus_channel *channel, > - u16 vlan_tci); > + u16 vlan_tci, bool vlan_present); > void netvsc_channel_cb(void *context); > int rndis_filter_open(struct netvsc_device *nvdev); > int rndis_filter_close(struct netvsc_device *nvdev); > diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c > index c9414c054852..6597d7901929 100644 > --- a/drivers/net/hyperv/netvsc_drv.c > +++ b/drivers/net/hyperv/netvsc_drv.c > @@ -595,7 +595,7 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, > static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net, > struct hv_netvsc_packet *packet, > struct ndis_tcp_ip_checksum_info *csum_info, > - void *data, u16 vlan_tci) > + void *data) > { > struct sk_buff *skb; > > @@ -625,10 +625,6 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net, > skb->ip_summed = CHECKSUM_UNNECESSARY; > } > > - if (vlan_tci & VLAN_TAG_PRESENT) > - __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), > - vlan_tci); > - > return skb; > } > > @@ -641,7 +637,7 @@ int netvsc_recv_callback(struct hv_device *device_obj, > void **data, > struct ndis_tcp_ip_checksum_info *csum_info, > struct vmbus_channel *channel, > - u16 vlan_tci) > + u16 vlan_tci, bool vlan_present) > { > struct net_device *net = hv_get_drvdata(device_obj); > struct net_device_context *net_device_ctx = netdev_priv(net); > @@ -664,12 +660,15 @@ int netvsc_recv_callback(struct hv_device *device_obj, > net = vf_netdev; > > /* Allocate a skb - TODO direct I/O to pages? */ > - skb = netvsc_alloc_recv_skb(net, packet, csum_info, *data, vlan_tci); > + skb = netvsc_alloc_recv_skb(net, packet, csum_info, *data); > if (unlikely(!skb)) { > ++net->stats.rx_dropped; > return NVSP_STAT_FAIL; > } > > + if (vlan_present) > + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci); > + > if (net != vf_netdev) > skb_record_rx_queue(skb, > channel->offermsg.offer.sub_channel_index); > diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c > index 8d90904e0e49..7f7b410a41c2 100644 > --- a/drivers/net/hyperv/rndis_filter.c > +++ b/drivers/net/hyperv/rndis_filter.c > @@ -381,13 +381,13 @@ static int rndis_filter_receive_data(struct rndis_device *dev, > > vlan = rndis_get_ppi(rndis_pkt, IEEE_8021Q_INFO); > if (vlan) { > - vlan_tci = VLAN_TAG_PRESENT | vlan->vlanid | > + vlan_tci = vlan->vlanid | > (vlan->pri << VLAN_PRIO_SHIFT); > } > > csum_info = rndis_get_ppi(rndis_pkt, TCPIP_CHKSUM_PKTINFO); > return netvsc_recv_callback(net_device_ctx->device_ctx, pkt, data, > - csum_info, channel, vlan_tci); > + csum_info, channel, vlan_tci, vlan); > } > > int rndis_filter_receive(struct hv_device *dev,
On Wed, 4 Jan 2017 01:07:58 +0100 (CET)
Michał Mirosław <mirq-linux@rere.qmqm.pl> wrote:
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
I have a cleaner way of handling this in the receive path for hyperv.
Rather than passing vlan_tci, pass the vlan info
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 3958adade7eb..b53729e85a79 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -186,7 +186,7 @@ int netvsc_recv_callback(struct hv_device *device_obj, void **data, struct ndis_tcp_ip_checksum_info *csum_info, struct vmbus_channel *channel, - u16 vlan_tci); + u16 vlan_tci, bool vlan_present); void netvsc_channel_cb(void *context); int rndis_filter_open(struct netvsc_device *nvdev); int rndis_filter_close(struct netvsc_device *nvdev); diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index c9414c054852..6597d7901929 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -595,7 +595,7 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net, struct hv_netvsc_packet *packet, struct ndis_tcp_ip_checksum_info *csum_info, - void *data, u16 vlan_tci) + void *data) { struct sk_buff *skb; @@ -625,10 +625,6 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net, skb->ip_summed = CHECKSUM_UNNECESSARY; } - if (vlan_tci & VLAN_TAG_PRESENT) - __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), - vlan_tci); - return skb; } @@ -641,7 +637,7 @@ int netvsc_recv_callback(struct hv_device *device_obj, void **data, struct ndis_tcp_ip_checksum_info *csum_info, struct vmbus_channel *channel, - u16 vlan_tci) + u16 vlan_tci, bool vlan_present) { struct net_device *net = hv_get_drvdata(device_obj); struct net_device_context *net_device_ctx = netdev_priv(net); @@ -664,12 +660,15 @@ int netvsc_recv_callback(struct hv_device *device_obj, net = vf_netdev; /* Allocate a skb - TODO direct I/O to pages? */ - skb = netvsc_alloc_recv_skb(net, packet, csum_info, *data, vlan_tci); + skb = netvsc_alloc_recv_skb(net, packet, csum_info, *data); if (unlikely(!skb)) { ++net->stats.rx_dropped; return NVSP_STAT_FAIL; } + if (vlan_present) + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci); + if (net != vf_netdev) skb_record_rx_queue(skb, channel->offermsg.offer.sub_channel_index); diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 8d90904e0e49..7f7b410a41c2 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -381,13 +381,13 @@ static int rndis_filter_receive_data(struct rndis_device *dev, vlan = rndis_get_ppi(rndis_pkt, IEEE_8021Q_INFO); if (vlan) { - vlan_tci = VLAN_TAG_PRESENT | vlan->vlanid | + vlan_tci = vlan->vlanid | (vlan->pri << VLAN_PRIO_SHIFT); } csum_info = rndis_get_ppi(rndis_pkt, TCPIP_CHKSUM_PKTINFO); return netvsc_recv_callback(net_device_ctx->device_ctx, pkt, data, - csum_info, channel, vlan_tci); + csum_info, channel, vlan_tci, vlan); } int rndis_filter_receive(struct hv_device *dev,
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> --- drivers/net/hyperv/hyperv_net.h | 2 +- drivers/net/hyperv/netvsc_drv.c | 13 ++++++------- drivers/net/hyperv/rndis_filter.c | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-)