Skip to content

Commit 592b4fe

Browse files
shemmingerdavem330
authored andcommitted
netvsc: fold in get_outbound_net_device
No longer need common code to find get_outbound_net_device. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9579083 commit 592b4fe

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

drivers/net/hyperv/netvsc.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,6 @@ static void free_netvsc_device_rcu(struct netvsc_device *nvdev)
9797
call_rcu(&nvdev->rcu, free_netvsc_device);
9898
}
9999

100-
static struct netvsc_device *get_outbound_net_device(struct hv_device *device)
101-
{
102-
struct netvsc_device *net_device = hv_device_to_netvsc_device(device);
103-
104-
if (net_device && net_device->destroy)
105-
net_device = NULL;
106-
107-
return net_device;
108-
}
109-
110100
static void netvsc_destroy_buf(struct hv_device *device)
111101
{
112102
struct nvsp_message *revoke_packet;
@@ -833,7 +823,7 @@ int netvsc_send(struct hv_device *device,
833823
struct hv_page_buffer **pb,
834824
struct sk_buff *skb)
835825
{
836-
struct netvsc_device *net_device;
826+
struct netvsc_device *net_device = hv_device_to_netvsc_device(device);
837827
int ret = 0;
838828
struct netvsc_channel *nvchan;
839829
u32 pktlen = packet->total_data_buflen, msd_len = 0;
@@ -844,8 +834,8 @@ int netvsc_send(struct hv_device *device,
844834
bool try_batch;
845835
bool xmit_more = (skb != NULL) ? skb->xmit_more : false;
846836

847-
net_device = get_outbound_net_device(device);
848-
if (unlikely(!net_device))
837+
/* If device is rescinded, return error and packet will get dropped. */
838+
if (unlikely(net_device->destroy))
849839
return -ENODEV;
850840

851841
/* We may race with netvsc_connect_vsp()/netvsc_init_buf() and get

0 commit comments

Comments
 (0)