forked from Minki/linux
netvsc: fold in get_outbound_net_device
No longer need common code to find get_outbound_net_device. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9579083732
commit
592b4fe895
@ -97,16 +97,6 @@ static void free_netvsc_device_rcu(struct netvsc_device *nvdev)
|
|||||||
call_rcu(&nvdev->rcu, free_netvsc_device);
|
call_rcu(&nvdev->rcu, free_netvsc_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct netvsc_device *get_outbound_net_device(struct hv_device *device)
|
|
||||||
{
|
|
||||||
struct netvsc_device *net_device = hv_device_to_netvsc_device(device);
|
|
||||||
|
|
||||||
if (net_device && net_device->destroy)
|
|
||||||
net_device = NULL;
|
|
||||||
|
|
||||||
return net_device;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void netvsc_destroy_buf(struct hv_device *device)
|
static void netvsc_destroy_buf(struct hv_device *device)
|
||||||
{
|
{
|
||||||
struct nvsp_message *revoke_packet;
|
struct nvsp_message *revoke_packet;
|
||||||
@ -833,7 +823,7 @@ int netvsc_send(struct hv_device *device,
|
|||||||
struct hv_page_buffer **pb,
|
struct hv_page_buffer **pb,
|
||||||
struct sk_buff *skb)
|
struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct netvsc_device *net_device;
|
struct netvsc_device *net_device = hv_device_to_netvsc_device(device);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct netvsc_channel *nvchan;
|
struct netvsc_channel *nvchan;
|
||||||
u32 pktlen = packet->total_data_buflen, msd_len = 0;
|
u32 pktlen = packet->total_data_buflen, msd_len = 0;
|
||||||
@ -844,8 +834,8 @@ int netvsc_send(struct hv_device *device,
|
|||||||
bool try_batch;
|
bool try_batch;
|
||||||
bool xmit_more = (skb != NULL) ? skb->xmit_more : false;
|
bool xmit_more = (skb != NULL) ? skb->xmit_more : false;
|
||||||
|
|
||||||
net_device = get_outbound_net_device(device);
|
/* If device is rescinded, return error and packet will get dropped. */
|
||||||
if (unlikely(!net_device))
|
if (unlikely(net_device->destroy))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
/* We may race with netvsc_connect_vsp()/netvsc_init_buf() and get
|
/* We may race with netvsc_connect_vsp()/netvsc_init_buf() and get
|
||||||
|
Loading…
Reference in New Issue
Block a user