Commit 3a3d9a0a authored by KY Srinivasan's avatar KY Srinivasan Committed by David S. Miller

hv_netvsc: Eliminate send_completion_tid from struct hv_netvsc_packet

Eliminate send_completion_tid from struct hv_netvsc_packet.
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a9f2e2d6
...@@ -145,10 +145,6 @@ struct hv_netvsc_packet { ...@@ -145,10 +145,6 @@ struct hv_netvsc_packet {
u32 send_buf_index; u32 send_buf_index;
u32 total_data_buflen; u32 total_data_buflen;
u32 pad1;
u64 send_completion_tid;
}; };
struct netvsc_device_info { struct netvsc_device_info {
...@@ -187,10 +183,10 @@ int netvsc_device_remove(struct hv_device *device); ...@@ -187,10 +183,10 @@ int netvsc_device_remove(struct hv_device *device);
int netvsc_send(struct hv_device *device, int netvsc_send(struct hv_device *device,
struct hv_netvsc_packet *packet, struct hv_netvsc_packet *packet,
struct rndis_message *rndis_msg, struct rndis_message *rndis_msg,
struct hv_page_buffer **page_buffer); struct hv_page_buffer **page_buffer,
struct sk_buff *skb);
void netvsc_linkstatus_callback(struct hv_device *device_obj, void netvsc_linkstatus_callback(struct hv_device *device_obj,
struct rndis_message *resp); struct rndis_message *resp);
void netvsc_xmit_completion(void *context);
int netvsc_recv_callback(struct hv_device *device_obj, int netvsc_recv_callback(struct hv_device *device_obj,
struct hv_netvsc_packet *packet, struct hv_netvsc_packet *packet,
void **data, void **data,
......
...@@ -614,6 +614,7 @@ static void netvsc_send_completion(struct netvsc_device *net_device, ...@@ -614,6 +614,7 @@ static void netvsc_send_completion(struct netvsc_device *net_device,
struct hv_netvsc_packet *nvsc_packet; struct hv_netvsc_packet *nvsc_packet;
struct net_device *ndev; struct net_device *ndev;
u32 send_index; u32 send_index;
struct sk_buff *skb;
ndev = net_device->ndev; ndev = net_device->ndev;
...@@ -639,17 +640,17 @@ static void netvsc_send_completion(struct netvsc_device *net_device, ...@@ -639,17 +640,17 @@ static void netvsc_send_completion(struct netvsc_device *net_device,
int queue_sends; int queue_sends;
/* Get the send context */ /* Get the send context */
nvsc_packet = (struct hv_netvsc_packet *)(unsigned long) skb = (struct sk_buff *)(unsigned long)packet->trans_id;
packet->trans_id;
/* Notify the layer above us */ /* Notify the layer above us */
if (nvsc_packet) { if (skb) {
nvsc_packet = (struct hv_netvsc_packet *) skb->cb;
send_index = nvsc_packet->send_buf_index; send_index = nvsc_packet->send_buf_index;
if (send_index != NETVSC_INVALID_INDEX) if (send_index != NETVSC_INVALID_INDEX)
netvsc_free_send_slot(net_device, send_index); netvsc_free_send_slot(net_device, send_index);
q_idx = nvsc_packet->q_idx; q_idx = nvsc_packet->q_idx;
channel = incoming_channel; channel = incoming_channel;
netvsc_xmit_completion(nvsc_packet); dev_kfree_skb_any(skb);
} }
num_outstanding_sends = num_outstanding_sends =
...@@ -744,7 +745,8 @@ static u32 netvsc_copy_to_send_buf(struct netvsc_device *net_device, ...@@ -744,7 +745,8 @@ static u32 netvsc_copy_to_send_buf(struct netvsc_device *net_device,
static inline int netvsc_send_pkt( static inline int netvsc_send_pkt(
struct hv_netvsc_packet *packet, struct hv_netvsc_packet *packet,
struct netvsc_device *net_device, struct netvsc_device *net_device,
struct hv_page_buffer **pb) struct hv_page_buffer **pb,
struct sk_buff *skb)
{ {
struct nvsp_message nvmsg; struct nvsp_message nvmsg;
u16 q_idx = packet->q_idx; u16 q_idx = packet->q_idx;
...@@ -772,10 +774,7 @@ static inline int netvsc_send_pkt( ...@@ -772,10 +774,7 @@ static inline int netvsc_send_pkt(
nvmsg.msg.v1_msg.send_rndis_pkt.send_buf_section_size = nvmsg.msg.v1_msg.send_rndis_pkt.send_buf_section_size =
packet->total_data_buflen; packet->total_data_buflen;
if (packet->completion_func) req_id = (ulong)skb;
req_id = (ulong)packet;
else
req_id = 0;
if (out_channel->rescind) if (out_channel->rescind)
return -ENODEV; return -ENODEV;
...@@ -841,7 +840,8 @@ static inline int netvsc_send_pkt( ...@@ -841,7 +840,8 @@ static inline int netvsc_send_pkt(
int netvsc_send(struct hv_device *device, int netvsc_send(struct hv_device *device,
struct hv_netvsc_packet *packet, struct hv_netvsc_packet *packet,
struct rndis_message *rndis_msg, struct rndis_message *rndis_msg,
struct hv_page_buffer **pb) struct hv_page_buffer **pb,
struct sk_buff *skb)
{ {
struct netvsc_device *net_device; struct netvsc_device *net_device;
int ret = 0, m_ret = 0; int ret = 0, m_ret = 0;
...@@ -907,7 +907,7 @@ int netvsc_send(struct hv_device *device, ...@@ -907,7 +907,7 @@ int netvsc_send(struct hv_device *device,
} }
if (msdp->pkt) if (msdp->pkt)
netvsc_xmit_completion(msdp->pkt); dev_kfree_skb_any(skb);
if (packet->xmit_more && !packet->cp_partial) { if (packet->xmit_more && !packet->cp_partial) {
msdp->pkt = packet; msdp->pkt = packet;
...@@ -925,17 +925,17 @@ int netvsc_send(struct hv_device *device, ...@@ -925,17 +925,17 @@ int netvsc_send(struct hv_device *device,
} }
if (msd_send) { if (msd_send) {
m_ret = netvsc_send_pkt(msd_send, net_device, pb); m_ret = netvsc_send_pkt(msd_send, net_device, pb, skb);
if (m_ret != 0) { if (m_ret != 0) {
netvsc_free_send_slot(net_device, netvsc_free_send_slot(net_device,
msd_send->send_buf_index); msd_send->send_buf_index);
netvsc_xmit_completion(msd_send); dev_kfree_skb_any(skb);
} }
} }
if (cur_send) if (cur_send)
ret = netvsc_send_pkt(cur_send, net_device, pb); ret = netvsc_send_pkt(cur_send, net_device, pb, skb);
if (ret != 0 && section_index != NETVSC_INVALID_INDEX) if (ret != 0 && section_index != NETVSC_INVALID_INDEX)
netvsc_free_send_slot(net_device, section_index); netvsc_free_send_slot(net_device, section_index);
......
...@@ -279,16 +279,6 @@ static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb, ...@@ -279,16 +279,6 @@ static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb,
return q_idx; return q_idx;
} }
void netvsc_xmit_completion(void *context)
{
struct hv_netvsc_packet *packet = (struct hv_netvsc_packet *)context;
struct sk_buff *skb = (struct sk_buff *)
(unsigned long)packet->send_completion_tid;
if (skb)
dev_kfree_skb_any(skb);
}
static u32 fill_pg_buf(struct page *page, u32 offset, u32 len, static u32 fill_pg_buf(struct page *page, u32 offset, u32 len,
struct hv_page_buffer *pb) struct hv_page_buffer *pb)
{ {
...@@ -497,7 +487,6 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) ...@@ -497,7 +487,6 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
/* Set the completion routine */ /* Set the completion routine */
packet->completion_func = 1; packet->completion_func = 1;
packet->send_completion_tid = (unsigned long)skb;
isvlan = packet->vlan_tci & VLAN_TAG_PRESENT; isvlan = packet->vlan_tci & VLAN_TAG_PRESENT;
...@@ -625,7 +614,8 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) ...@@ -625,7 +614,8 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
packet->page_buf_cnt = init_page_array(rndis_msg, rndis_msg_size, packet->page_buf_cnt = init_page_array(rndis_msg, rndis_msg_size,
skb, packet, &pb); skb, packet, &pb);
ret = netvsc_send(net_device_ctx->device_ctx, packet, rndis_msg, &pb); ret = netvsc_send(net_device_ctx->device_ctx, packet,
rndis_msg, &pb, skb);
drop: drop:
if (ret == 0) { if (ret == 0) {
......
...@@ -240,7 +240,7 @@ static int rndis_filter_send_request(struct rndis_device *dev, ...@@ -240,7 +240,7 @@ static int rndis_filter_send_request(struct rndis_device *dev,
packet->completion_func = 0; packet->completion_func = 0;
packet->xmit_more = false; packet->xmit_more = false;
ret = netvsc_send(dev->net_dev->dev, packet, NULL, &pb); ret = netvsc_send(dev->net_dev->dev, packet, NULL, &pb, NULL);
return ret; return ret;
} }
......
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