diff options
author | Haiyang Zhang <haiyangz@microsoft.com> | 2012-10-02 07:30:23 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-10-02 20:39:31 +0200 |
commit | 63f6921d300c6fbdca3d0e73dcc24b4e5e4dced2 (patch) | |
tree | 5cd2560e12959f51574e0235bc1d9bdb81b30b98 /drivers/net/hyperv/netvsc.c | |
parent | hyperv: Remove extra allocated space for recv_pkt_list elements (diff) | |
download | linux-63f6921d300c6fbdca3d0e73dcc24b4e5e4dced2.tar.xz linux-63f6921d300c6fbdca3d0e73dcc24b4e5e4dced2.zip |
hyperv: Report actual status in receive completion packet
The existing code always reports NVSP_STAT_SUCCESS. This patch adds the
mechanism to report failure when it happens.
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hyperv/netvsc.c')
-rw-r--r-- | drivers/net/hyperv/netvsc.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index d9c4c0399c88..1cd77483da50 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -558,7 +558,7 @@ int netvsc_send(struct hv_device *device, } static void netvsc_send_recv_completion(struct hv_device *device, - u64 transaction_id) + u64 transaction_id, u32 status) { struct nvsp_message recvcompMessage; int retries = 0; @@ -571,9 +571,7 @@ static void netvsc_send_recv_completion(struct hv_device *device, recvcompMessage.hdr.msg_type = NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE; - /* FIXME: Pass in the status */ - recvcompMessage.msg.v1_msg.send_rndis_pkt_complete.status = - NVSP_STAT_SUCCESS; + recvcompMessage.msg.v1_msg.send_rndis_pkt_complete.status = status; retry_send_cmplt: /* Send the completion */ @@ -613,6 +611,7 @@ static void netvsc_receive_completion(void *context) bool fsend_receive_comp = false; unsigned long flags; struct net_device *ndev; + u32 status = NVSP_STAT_NONE; /* * Even though it seems logical to do a GetOutboundNetDevice() here to @@ -627,6 +626,9 @@ static void netvsc_receive_completion(void *context) /* Overloading use of the lock. */ spin_lock_irqsave(&net_device->recv_pkt_list_lock, flags); + if (packet->status != NVSP_STAT_SUCCESS) + packet->xfer_page_pkt->status = NVSP_STAT_FAIL; + packet->xfer_page_pkt->count--; /* @@ -636,6 +638,7 @@ static void netvsc_receive_completion(void *context) if (packet->xfer_page_pkt->count == 0) { fsend_receive_comp = true; transaction_id = packet->completion.recv.recv_completion_tid; + status = packet->xfer_page_pkt->status; list_add_tail(&packet->xfer_page_pkt->list_ent, &net_device->recv_pkt_list); @@ -647,7 +650,7 @@ static void netvsc_receive_completion(void *context) /* Send a receive completion for the xfer page packet */ if (fsend_receive_comp) - netvsc_send_recv_completion(device, transaction_id); + netvsc_send_recv_completion(device, transaction_id, status); } @@ -736,7 +739,8 @@ static void netvsc_receive(struct hv_device *device, flags); netvsc_send_recv_completion(device, - vmxferpage_packet->d.trans_id); + vmxferpage_packet->d.trans_id, + NVSP_STAT_FAIL); return; } @@ -744,6 +748,7 @@ static void netvsc_receive(struct hv_device *device, /* Remove the 1st packet to represent the xfer page packet itself */ xferpage_packet = (struct xferpage_packet *)listHead.next; list_del(&xferpage_packet->list_ent); + xferpage_packet->status = NVSP_STAT_SUCCESS; /* This is how much we can satisfy */ xferpage_packet->count = count - 1; @@ -760,6 +765,7 @@ static void netvsc_receive(struct hv_device *device, list_del(&netvsc_packet->list_ent); /* Initialize the netvsc packet */ + netvsc_packet->status = NVSP_STAT_SUCCESS; netvsc_packet->xfer_page_pkt = xferpage_packet; netvsc_packet->completion.recv.recv_completion = netvsc_receive_completion; |