* [PATCH net-next,1/3] hv_netvsc: Clean up two unused variables
@ 2015-04-06 22:22 Haiyang Zhang
2015-04-06 22:22 ` [PATCH net-next,2/3] hv_netvsc: Define a macro RNDIS_AND_PPI_SIZE Haiyang Zhang
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Haiyang Zhang @ 2015-04-06 22:22 UTC (permalink / raw)
To: davem, netdev
Cc: haiyangz, kys, olaf, jasowang, linux-kernel, driverdev-devel
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/net/hyperv/hyperv_net.h | 1 -
drivers/net/hyperv/netvsc.c | 1 -
drivers/net/hyperv/rndis_filter.c | 2 --
3 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 309adee..95a25e4 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -130,7 +130,6 @@ struct hv_netvsc_packet {
u32 status;
bool part_of_skb;
- struct hv_device *device;
bool is_data_pkt;
bool xmit_more; /* from skb */
u16 vlan_tci;
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index f699236..7e83c6a 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -1011,7 +1011,6 @@ static void netvsc_receive(struct netvsc_device *net_device,
}
count = vmxferpage_packet->range_cnt;
- netvsc_packet->device = device;
netvsc_packet->channel = channel;
/* Each range represents 1 RNDIS pkt that contains 1 ethernet frame */
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index a160437..0d92efe 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -47,8 +47,6 @@ struct rndis_request {
/* Simplify allocation by having a netvsc packet inline */
struct hv_netvsc_packet pkt;
- /* Set 2 pages for rndis requests crossing page boundary */
- struct hv_page_buffer buf[2];
struct rndis_message request_msg;
/*
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next,2/3] hv_netvsc: Define a macro RNDIS_AND_PPI_SIZE
2015-04-06 22:22 [PATCH net-next,1/3] hv_netvsc: Clean up two unused variables Haiyang Zhang
@ 2015-04-06 22:22 ` Haiyang Zhang
2015-04-07 22:45 ` David Miller
2015-04-06 22:22 ` [PATCH net-next,3/3] hv_netvsc: Fix the packet free when it is in skb headroom Haiyang Zhang
2015-04-07 22:45 ` [PATCH net-next,1/3] hv_netvsc: Clean up two unused variables David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Haiyang Zhang @ 2015-04-06 22:22 UTC (permalink / raw)
To: davem, netdev
Cc: haiyangz, kys, olaf, jasowang, linux-kernel, driverdev-devel
The sum of RNDIS msg and PPI struct sizes is used in multiple places, so we define
a macro for them.
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/net/hyperv/hyperv_net.h | 6 ++++++
drivers/net/hyperv/netvsc_drv.c | 15 +++------------
2 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 95a25e4..80bc52e 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -958,6 +958,10 @@ struct ndis_tcp_lso_info {
#define NDIS_HASH_PPI_SIZE (sizeof(struct rndis_per_packet_info) + \
sizeof(u32))
+/* Total size of all PPI data */
+#define NDIS_ALL_PPI_SIZE (NDIS_VLAN_PPI_SIZE + NDIS_CSUM_PPI_SIZE + \
+ NDIS_LSO_PPI_SIZE + NDIS_HASH_PPI_SIZE)
+
/* Format of Information buffer passed in a SetRequest for the OID */
/* OID_GEN_RNDIS_CONFIG_PARAMETER. */
struct rndis_config_parameter_info {
@@ -1170,6 +1174,8 @@ struct rndis_message {
#define RNDIS_HEADER_SIZE (sizeof(struct rndis_message) - \
sizeof(union rndis_message_container))
+#define RNDIS_AND_PPI_SIZE (sizeof(struct rndis_message) + NDIS_ALL_PPI_SIZE)
+
#define NDIS_PACKET_TYPE_DIRECTED 0x00000001
#define NDIS_PACKET_TYPE_MULTICAST 0x00000002
#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index f9db6bc..73f8fba 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -401,10 +401,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
return NETDEV_TX_OK;
}
- pkt_sz = sizeof(struct hv_netvsc_packet) +
- sizeof(struct rndis_message) +
- NDIS_VLAN_PPI_SIZE + NDIS_CSUM_PPI_SIZE +
- NDIS_LSO_PPI_SIZE + NDIS_HASH_PPI_SIZE;
+ pkt_sz = sizeof(struct hv_netvsc_packet) + RNDIS_AND_PPI_SIZE;
if (head_room < pkt_sz) {
packet = kmalloc(pkt_sz, GFP_ATOMIC);
@@ -436,11 +433,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
packet->rndis_msg = (struct rndis_message *)((unsigned long)packet +
sizeof(struct hv_netvsc_packet));
- memset(packet->rndis_msg, 0, sizeof(struct rndis_message) +
- NDIS_VLAN_PPI_SIZE +
- NDIS_CSUM_PPI_SIZE +
- NDIS_LSO_PPI_SIZE +
- NDIS_HASH_PPI_SIZE);
+ memset(packet->rndis_msg, 0, RNDIS_AND_PPI_SIZE);
/* Set the completion routine */
packet->send_completion = netvsc_xmit_completion;
@@ -872,9 +865,7 @@ static int netvsc_probe(struct hv_device *dev,
return -ENOMEM;
max_needed_headroom = sizeof(struct hv_netvsc_packet) +
- sizeof(struct rndis_message) +
- NDIS_VLAN_PPI_SIZE + NDIS_CSUM_PPI_SIZE +
- NDIS_LSO_PPI_SIZE + NDIS_HASH_PPI_SIZE;
+ RNDIS_AND_PPI_SIZE;
netif_carrier_off(net);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next,3/3] hv_netvsc: Fix the packet free when it is in skb headroom
2015-04-06 22:22 [PATCH net-next,1/3] hv_netvsc: Clean up two unused variables Haiyang Zhang
2015-04-06 22:22 ` [PATCH net-next,2/3] hv_netvsc: Define a macro RNDIS_AND_PPI_SIZE Haiyang Zhang
@ 2015-04-06 22:22 ` Haiyang Zhang
2015-04-07 22:45 ` David Miller
2015-04-07 22:45 ` [PATCH net-next,1/3] hv_netvsc: Clean up two unused variables David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Haiyang Zhang @ 2015-04-06 22:22 UTC (permalink / raw)
To: davem, netdev
Cc: haiyangz, kys, olaf, jasowang, linux-kernel, driverdev-devel
In the two places changed, we now use netvsc_xmit_completion() which properly
frees hv_netvsc_packet in or not in skb headroom.
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/net/hyperv/hyperv_net.h | 1 +
drivers/net/hyperv/netvsc.c | 6 ++++--
drivers/net/hyperv/netvsc_drv.c | 2 +-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 80bc52e..f0b8b3e 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -188,6 +188,7 @@ int netvsc_send(struct hv_device *device,
struct hv_netvsc_packet *packet);
void netvsc_linkstatus_callback(struct hv_device *device_obj,
struct rndis_message *resp);
+void netvsc_xmit_completion(void *context);
int netvsc_recv_callback(struct hv_device *device_obj,
struct hv_netvsc_packet *packet,
struct ndis_tcp_ip_checksum_info *csum_info);
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index 7e83c6a..4d4d497 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -878,7 +878,9 @@ int netvsc_send(struct hv_device *device,
packet->send_buf_index = section_index;
packet->total_data_buflen += msd_len;
- kfree(msdp->pkt);
+ if (msdp->pkt)
+ netvsc_xmit_completion(msdp->pkt);
+
if (packet->xmit_more) {
msdp->pkt = packet;
msdp->count++;
@@ -902,7 +904,7 @@ int netvsc_send(struct hv_device *device,
if (m_ret != 0) {
netvsc_free_send_slot(net_device,
msd_send->send_buf_index);
- kfree(msd_send);
+ netvsc_xmit_completion(msd_send);
}
}
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 73f8fba..e5fa094 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -229,7 +229,7 @@ static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb,
return q_idx;
}
-static void netvsc_xmit_completion(void *context)
+void netvsc_xmit_completion(void *context)
{
struct hv_netvsc_packet *packet = (struct hv_netvsc_packet *)context;
struct sk_buff *skb = (struct sk_buff *)
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next,1/3] hv_netvsc: Clean up two unused variables
2015-04-06 22:22 [PATCH net-next,1/3] hv_netvsc: Clean up two unused variables Haiyang Zhang
2015-04-06 22:22 ` [PATCH net-next,2/3] hv_netvsc: Define a macro RNDIS_AND_PPI_SIZE Haiyang Zhang
2015-04-06 22:22 ` [PATCH net-next,3/3] hv_netvsc: Fix the packet free when it is in skb headroom Haiyang Zhang
@ 2015-04-07 22:45 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2015-04-07 22:45 UTC (permalink / raw)
To: haiyangz; +Cc: netdev, kys, olaf, jasowang, linux-kernel, driverdev-devel
From: Haiyang Zhang <haiyangz@microsoft.com>
Date: Mon, 6 Apr 2015 15:22:52 -0700
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next,2/3] hv_netvsc: Define a macro RNDIS_AND_PPI_SIZE
2015-04-06 22:22 ` [PATCH net-next,2/3] hv_netvsc: Define a macro RNDIS_AND_PPI_SIZE Haiyang Zhang
@ 2015-04-07 22:45 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2015-04-07 22:45 UTC (permalink / raw)
To: haiyangz; +Cc: netdev, kys, olaf, jasowang, linux-kernel, driverdev-devel
From: Haiyang Zhang <haiyangz@microsoft.com>
Date: Mon, 6 Apr 2015 15:22:53 -0700
> The sum of RNDIS msg and PPI struct sizes is used in multiple places, so we define
> a macro for them.
>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next,3/3] hv_netvsc: Fix the packet free when it is in skb headroom
2015-04-06 22:22 ` [PATCH net-next,3/3] hv_netvsc: Fix the packet free when it is in skb headroom Haiyang Zhang
@ 2015-04-07 22:45 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2015-04-07 22:45 UTC (permalink / raw)
To: haiyangz; +Cc: netdev, kys, olaf, jasowang, linux-kernel, driverdev-devel
From: Haiyang Zhang <haiyangz@microsoft.com>
Date: Mon, 6 Apr 2015 15:22:54 -0700
> In the two places changed, we now use netvsc_xmit_completion() which properly
> frees hv_netvsc_packet in or not in skb headroom.
>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-04-07 22:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-06 22:22 [PATCH net-next,1/3] hv_netvsc: Clean up two unused variables Haiyang Zhang
2015-04-06 22:22 ` [PATCH net-next,2/3] hv_netvsc: Define a macro RNDIS_AND_PPI_SIZE Haiyang Zhang
2015-04-07 22:45 ` David Miller
2015-04-06 22:22 ` [PATCH net-next,3/3] hv_netvsc: Fix the packet free when it is in skb headroom Haiyang Zhang
2015-04-07 22:45 ` David Miller
2015-04-07 22:45 ` [PATCH net-next,1/3] hv_netvsc: Clean up two unused variables David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).