From: Stephen Hemminger <stephen@networkplumber•org>
To: kys@microsoft•com, haiyangz@microsoft•com, sthemmin@microsoft•com
Cc: devel@linuxdriverproject•org, netdev@vger•kernel.org
Subject: [PATCH net-next 6/6] netvsc: fold in get_outbound_net_device
Date: Thu, 8 Jun 2017 16:21:23 -0700 [thread overview]
Message-ID: <20170608232123.28366-7-sthemmin@microsoft.com> (raw)
In-Reply-To: <20170608232123.28366-1-sthemmin@microsoft.com>
No longer need common code to find get_outbound_net_device.
Signed-off-by: Stephen Hemminger <sthemmin@microsoft•com>
---
drivers/net/hyperv/netvsc.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index 4d4fde0c7974..7c5ed8fe7a4f 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -97,16 +97,6 @@ static void free_netvsc_device_rcu(struct netvsc_device *nvdev)
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)
{
struct nvsp_message *revoke_packet;
@@ -833,7 +823,7 @@ int netvsc_send(struct hv_device *device,
struct hv_page_buffer **pb,
struct sk_buff *skb)
{
- struct netvsc_device *net_device;
+ struct netvsc_device *net_device = hv_device_to_netvsc_device(device);
int ret = 0;
struct netvsc_channel *nvchan;
u32 pktlen = packet->total_data_buflen, msd_len = 0;
@@ -844,8 +834,8 @@ int netvsc_send(struct hv_device *device,
bool try_batch;
bool xmit_more = (skb != NULL) ? skb->xmit_more : false;
- net_device = get_outbound_net_device(device);
- if (unlikely(!net_device))
+ /* If device is rescinded, return error and packet will get dropped. */
+ if (unlikely(net_device->destroy))
return -ENODEV;
/* We may race with netvsc_connect_vsp()/netvsc_init_buf() and get
--
2.11.0
next prev parent reply other threads:[~2017-06-08 23:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-08 23:21 [PATCH net-next 0/6] netvsc: small cleanups Stephen Hemminger
2017-06-08 23:21 ` [PATCH net-next 1/6] netvsc: optimize calculation of number of slots Stephen Hemminger
2017-06-08 23:21 ` [PATCH net-next 2/6] netvsc: use hv_get_bytes_to_read Stephen Hemminger
2017-06-08 23:21 ` [PATCH net-next 3/6] netvsc: use typed pointer for internal state Stephen Hemminger
2017-06-09 10:24 ` Sergei Shtylyov
2017-06-08 23:21 ` [PATCH net-next 4/6] netvsc: mark error cases as unlikely Stephen Hemminger
2017-06-08 23:21 ` [PATCH net-next 5/6] netvsc: pass net_device to netvsc_init_buf and netvsc_connect_vsp Stephen Hemminger
2017-06-08 23:21 ` Stephen Hemminger [this message]
2017-06-09 16:16 ` [PATCH net-next 0/6] netvsc: small cleanups David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170608232123.28366-7-sthemmin@microsoft.com \
--to=stephen@networkplumber$(echo .)org \
--cc=devel@linuxdriverproject$(echo .)org \
--cc=haiyangz@microsoft$(echo .)com \
--cc=kys@microsoft$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=sthemmin@microsoft$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox