Commit 3962981f authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

netvsc: add rtnl annotations in rndis

The rndis functions are used when changing device state.
Therefore the references from network device to internal state
are protected by RTNL mutex.
Signed-off-by: default avatarStephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 35fbbccf
......@@ -787,12 +787,6 @@ struct netvsc_device {
struct rcu_head rcu;
};
static inline struct netvsc_device *
net_device_to_netvsc_device(struct net_device *ndev)
{
return ((struct net_device_context *)netdev_priv(ndev))->nvdev;
}
/* NdisInitialize message */
struct rndis_initialize_request {
u32 req_id;
......
......@@ -105,7 +105,8 @@ static void netvsc_destroy_buf(struct hv_device *device)
{
struct nvsp_message *revoke_packet;
struct net_device *ndev = hv_get_drvdata(device);
struct netvsc_device *net_device = net_device_to_netvsc_device(ndev);
struct net_device_context *ndc = netdev_priv(ndev);
struct netvsc_device *net_device = rtnl_dereference(ndc->nvdev);
int ret;
/*
......@@ -829,7 +830,8 @@ int netvsc_send(struct net_device_context *ndev_ctx,
struct hv_page_buffer **pb,
struct sk_buff *skb)
{
struct netvsc_device *net_device = rcu_dereference(ndev_ctx->nvdev);
struct netvsc_device *net_device
= rcu_dereference_rtnl(ndev_ctx->nvdev);
struct hv_device *device = ndev_ctx->device_ctx;
int ret = 0;
struct netvsc_channel *nvchan;
......
......@@ -1548,6 +1548,7 @@ static int netvsc_probe(struct hv_device *dev,
netif_set_real_num_tx_queues(net, nvdev->num_chn);
netif_set_real_num_rx_queues(net, nvdev->num_chn);
rtnl_unlock();
netdev_lockdep_set_classes(net);
......
......@@ -84,6 +84,14 @@ static struct rndis_device *get_rndis_device(void)
return device;
}
static struct netvsc_device *
net_device_to_netvsc_device(struct net_device *ndev)
{
struct net_device_context *net_device_ctx = netdev_priv(ndev);
return rtnl_dereference(net_device_ctx->nvdev);
}
static struct rndis_request *get_rndis_request(struct rndis_device *dev,
u32 msg_type,
u32 msg_len)
......@@ -472,7 +480,7 @@ static int rndis_filter_query_device(struct rndis_device *dev, u32 oid,
if (oid == OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES) {
struct net_device_context *ndevctx = netdev_priv(dev->ndev);
struct netvsc_device *nvdev = ndevctx->nvdev;
struct netvsc_device *nvdev = rtnl_dereference(ndevctx->nvdev);
struct ndis_offload *hwcaps;
u32 nvsp_version = nvdev->nvsp_version;
u8 ndis_rev;
......@@ -944,7 +952,7 @@ static void rndis_filter_halt_device(struct rndis_device *dev)
struct rndis_request *request;
struct rndis_halt_request *halt;
struct net_device_context *net_device_ctx = netdev_priv(dev->ndev);
struct netvsc_device *nvdev = net_device_ctx->nvdev;
struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev);
/* Attempt to do a rndis device halt */
request = get_rndis_request(dev, RNDIS_MSG_HALT,
......
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