Commit 01c49884 authored by David S. Miller's avatar David S. Miller

Merge branch 'netvsc-minor-fixes'

Stephen Hemminger says:

====================
netvsc: minor fixes

This fixes fallout from previous patch related to RTNL and RCU
annotaiton. Also one patch sent to wrong list.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents bae75b66 658677f1
...@@ -147,7 +147,6 @@ struct hv_netvsc_packet { ...@@ -147,7 +147,6 @@ struct hv_netvsc_packet {
struct netvsc_device_info { struct netvsc_device_info {
unsigned char mac_adr[ETH_ALEN]; unsigned char mac_adr[ETH_ALEN];
int ring_size; int ring_size;
u32 max_num_vrss_chns;
u32 num_chn; u32 num_chn;
}; };
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <linux/prefetch.h>
#include <asm/sync_bitops.h> #include <asm/sync_bitops.h>
...@@ -1265,10 +1266,15 @@ int netvsc_poll(struct napi_struct *napi, int budget) ...@@ -1265,10 +1266,15 @@ int netvsc_poll(struct napi_struct *napi, int budget)
void netvsc_channel_cb(void *context) void netvsc_channel_cb(void *context)
{ {
struct netvsc_channel *nvchan = context; struct netvsc_channel *nvchan = context;
struct vmbus_channel *channel = nvchan->channel;
struct hv_ring_buffer_info *rbi = &channel->inbound;
/* preload first vmpacket descriptor */
prefetch(hv_get_ring_buffer(rbi) + rbi->priv_read_index);
if (napi_schedule_prep(&nvchan->napi)) { if (napi_schedule_prep(&nvchan->napi)) {
/* disable interupts from host */ /* disable interupts from host */
hv_begin_read(&nvchan->channel->inbound); hv_begin_read(rbi);
__napi_schedule(&nvchan->napi); __napi_schedule(&nvchan->napi);
} }
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#include <linux/in.h> #include <linux/in.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/rtnetlink.h>
#include <net/arp.h> #include <net/arp.h>
#include <net/route.h> #include <net/route.h>
#include <net/sock.h> #include <net/sock.h>
...@@ -339,7 +341,7 @@ static u32 net_checksum_info(struct sk_buff *skb) ...@@ -339,7 +341,7 @@ static u32 net_checksum_info(struct sk_buff *skb)
if (ip6->nexthdr == IPPROTO_TCP) if (ip6->nexthdr == IPPROTO_TCP)
return TRANSPORT_INFO_IPV6_TCP; return TRANSPORT_INFO_IPV6_TCP;
else if (ipv6_hdr(skb)->nexthdr == IPPROTO_UDP) else if (ip6->nexthdr == IPPROTO_UDP)
return TRANSPORT_INFO_IPV6_UDP; return TRANSPORT_INFO_IPV6_UDP;
} }
...@@ -713,39 +715,16 @@ static void netvsc_get_channels(struct net_device *net, ...@@ -713,39 +715,16 @@ static void netvsc_get_channels(struct net_device *net,
} }
} }
static int netvsc_set_queues(struct net_device *net, struct hv_device *dev,
u32 num_chn)
{
struct netvsc_device_info device_info;
struct netvsc_device *net_device;
int ret;
memset(&device_info, 0, sizeof(device_info));
device_info.num_chn = num_chn;
device_info.ring_size = ring_size;
device_info.max_num_vrss_chns = num_chn;
ret = netif_set_real_num_tx_queues(net, num_chn);
if (ret)
return ret;
ret = netif_set_real_num_rx_queues(net, num_chn);
if (ret)
return ret;
net_device = rndis_filter_device_add(dev, &device_info);
return PTR_ERR_OR_ZERO(net_device);
}
static int netvsc_set_channels(struct net_device *net, static int netvsc_set_channels(struct net_device *net,
struct ethtool_channels *channels) struct ethtool_channels *channels)
{ {
struct net_device_context *net_device_ctx = netdev_priv(net); struct net_device_context *net_device_ctx = netdev_priv(net);
struct hv_device *dev = net_device_ctx->device_ctx; struct hv_device *dev = net_device_ctx->device_ctx;
struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev); struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev);
unsigned int count = channels->combined_count; unsigned int orig, count = channels->combined_count;
struct netvsc_device_info device_info;
bool was_opened; bool was_opened;
int ret; int ret = 0;
/* We do not support separate count for rx, tx, or other */ /* We do not support separate count for rx, tx, or other */
if (count == 0 || if (count == 0 ||
...@@ -764,19 +743,27 @@ static int netvsc_set_channels(struct net_device *net, ...@@ -764,19 +743,27 @@ static int netvsc_set_channels(struct net_device *net,
if (count > nvdev->max_chn) if (count > nvdev->max_chn)
return -EINVAL; return -EINVAL;
orig = nvdev->num_chn;
was_opened = rndis_filter_opened(nvdev); was_opened = rndis_filter_opened(nvdev);
if (was_opened) if (was_opened)
rndis_filter_close(nvdev); rndis_filter_close(nvdev);
rndis_filter_device_remove(dev, nvdev); rndis_filter_device_remove(dev, nvdev);
ret = netvsc_set_queues(net, dev, count); memset(&device_info, 0, sizeof(device_info));
if (ret == 0) device_info.num_chn = count;
nvdev->num_chn = count; device_info.ring_size = ring_size;
else
netvsc_set_queues(net, dev, nvdev->num_chn); nvdev = rndis_filter_device_add(dev, &device_info);
if (!IS_ERR(nvdev)) {
netif_set_real_num_tx_queues(net, nvdev->num_chn);
netif_set_real_num_rx_queues(net, nvdev->num_chn);
ret = PTR_ERR(nvdev);
} else {
device_info.num_chn = orig;
rndis_filter_device_add(dev, &device_info);
}
nvdev = rtnl_dereference(net_device_ctx->nvdev);
if (was_opened) if (was_opened)
rndis_filter_open(nvdev); rndis_filter_open(nvdev);
...@@ -863,7 +850,6 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu) ...@@ -863,7 +850,6 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu)
memset(&device_info, 0, sizeof(device_info)); memset(&device_info, 0, sizeof(device_info));
device_info.ring_size = ring_size; device_info.ring_size = ring_size;
device_info.num_chn = nvdev->num_chn; device_info.num_chn = nvdev->num_chn;
device_info.max_num_vrss_chns = nvdev->num_chn;
rndis_filter_device_remove(hdev, nvdev); rndis_filter_device_remove(hdev, nvdev);
...@@ -1548,7 +1534,6 @@ static int netvsc_probe(struct hv_device *dev, ...@@ -1548,7 +1534,6 @@ static int netvsc_probe(struct hv_device *dev,
netif_set_real_num_tx_queues(net, nvdev->num_chn); netif_set_real_num_tx_queues(net, nvdev->num_chn);
netif_set_real_num_rx_queues(net, nvdev->num_chn); netif_set_real_num_rx_queues(net, nvdev->num_chn);
rtnl_unlock();
netdev_lockdep_set_classes(net); netdev_lockdep_set_classes(net);
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#include <linux/nls.h> #include <linux/nls.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/rtnetlink.h>
#include "hyperv_net.h" #include "hyperv_net.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment