RE: [PATCH net-next,1/2] hyperv: Remove recv_pkt_list and lock

2014-04-21 Thread Haiyang Zhang


> -Original Message-
> From: David Miller [mailto:da...@davemloft.net]
> Sent: Monday, April 21, 2014 2:57 PM
> To: Haiyang Zhang
> Cc: net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de;
> jasow...@redhat.com; linux-kernel@vger.kernel.org; driverdev-
> de...@linuxdriverproject.org
> Subject: Re: [PATCH net-next,1/2] hyperv: Remove recv_pkt_list and lock
> 
> From: Haiyang Zhang 
> Date: Mon, 21 Apr 2014 12:26:15 -0700
> 
> > @@ -401,8 +401,6 @@ static void rndis_filter_receive_data(struct
> rndis_device *dev,
> > pkt->total_data_buflen = rndis_pkt->data_len;
> > pkt->data = (void *)((unsigned long)pkt->data + data_offset);
> >
> > -   pkt->is_data_pkt = true;
> > -
> > vlan = rndis_get_ppi(rndis_pkt, IEEE_8021Q_INFO);
> > if (vlan) {
> > pkt->vlan_tci = VLAN_TAG_PRESENT | vlan->vlanid |
> 
> This part of your change is not explained at all in your commit message.
> 
> Please resubmit this series with this hunk properly described and accounted 
> for.

I have updated the description and re-send them.

Thanks,
- Haiyang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH net-next,1/2] hyperv: Remove recv_pkt_list and lock

2014-04-21 Thread David Miller
From: Haiyang Zhang 
Date: Mon, 21 Apr 2014 12:26:15 -0700

> @@ -401,8 +401,6 @@ static void rndis_filter_receive_data(struct rndis_device 
> *dev,
>   pkt->total_data_buflen = rndis_pkt->data_len;
>   pkt->data = (void *)((unsigned long)pkt->data + data_offset);
>  
> - pkt->is_data_pkt = true;
> -
>   vlan = rndis_get_ppi(rndis_pkt, IEEE_8021Q_INFO);
>   if (vlan) {
>   pkt->vlan_tci = VLAN_TAG_PRESENT | vlan->vlanid |

This part of your change is not explained at all in your commit message.

Please resubmit this series with this hunk properly described and
accounted for.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH net-next,1/2] hyperv: Remove recv_pkt_list and lock

2014-04-21 Thread Haiyang Zhang
Removed recv_pkt_list and lock, and updated related code, so that
the locking overhead is reduced especially when multiple channels
are in use.

The recv_pkt_list isn't actually necessary because the packets are
processed sequentially in each channel. It has been replaced by a
local variable, and the related lock for this list is also removed.

Signed-off-by: Haiyang Zhang 
Reviewed-by: K. Y. Srinivasan 
---
 drivers/net/hyperv/hyperv_net.h   |   33 ---
 drivers/net/hyperv/netvsc.c   |  174 +++--
 drivers/net/hyperv/netvsc_drv.c   |2 +-
 drivers/net/hyperv/rndis_filter.c |2 -
 4 files changed, 13 insertions(+), 198 deletions(-)

diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 57eb3f9..a1af0f7 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -119,27 +119,14 @@ struct ndis_recv_scale_param { /* 
NDIS_RECEIVE_SCALE_PARAMETERS */
 };
 
 /* Fwd declaration */
-struct hv_netvsc_packet;
 struct ndis_tcp_ip_checksum_info;
 
-/* Represent the xfer page packet which contains 1 or more netvsc packet */
-struct xferpage_packet {
-   struct list_head list_ent;
-   u32 status;
-
-   /* # of netvsc packets this xfer packet contains */
-   u32 count;
-
-   struct vmbus_channel *channel;
-};
-
 /*
  * Represent netvsc packet which contains 1 RNDIS and 1 ethernet frame
  * within the RNDIS
  */
 struct hv_netvsc_packet {
/* Bookkeeping stuff */
-   struct list_head list_ent;
u32 status;
 
struct hv_device *device;
@@ -149,19 +136,8 @@ struct hv_netvsc_packet {
u16 q_idx;
struct vmbus_channel *channel;
 
-   /*
-* Valid only for receives when we break a xfer page packet
-* into multiple netvsc packets
-*/
-   struct xferpage_packet *xfer_page_pkt;
-
union {
struct {
-   u64 recv_completion_tid;
-   void *recv_completion_ctx;
-   void (*recv_completion)(void *context);
-   } recv;
-   struct {
u64 send_completion_tid;
void *send_completion_ctx;
void (*send_completion)(void *context);
@@ -613,9 +589,6 @@ struct nvsp_message {
 
 #define NETVSC_RECEIVE_BUFFER_ID   0xcafe
 
-/* Preallocated receive packets */
-#define NETVSC_RECEIVE_PACKETLIST_COUNT256
-
 #define NETVSC_PACKET_SIZE  2048
 
 #define VRSS_SEND_TAB_SIZE 16
@@ -630,12 +603,6 @@ struct netvsc_device {
wait_queue_head_t wait_drain;
bool start_remove;
bool destroy;
-   /*
-* List of free preallocated hv_netvsc_packet to represent receive
-* packet
-*/
-   struct list_head recv_pkt_list;
-   spinlock_t recv_pkt_list_lock;
 
/* Receive buffer allocated by us but manages by NetVSP */
void *recv_buf;
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index e7e77f1..b103347 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -387,7 +387,6 @@ static void netvsc_disconnect_vsp(struct netvsc_device 
*net_device)
 int netvsc_device_remove(struct hv_device *device)
 {
struct netvsc_device *net_device;
-   struct hv_netvsc_packet *netvsc_packet, *pos;
unsigned long flags;
 
net_device = hv_get_drvdata(device);
@@ -416,12 +415,6 @@ int netvsc_device_remove(struct hv_device *device)
vmbus_close(device->channel);
 
/* Release all resources */
-   list_for_each_entry_safe(netvsc_packet, pos,
-_device->recv_pkt_list, list_ent) {
-   list_del(_packet->list_ent);
-   kfree(netvsc_packet);
-   }
-
if (net_device->sub_cb_buf)
vfree(net_device->sub_cb_buf);
 
@@ -641,62 +634,6 @@ retry_send_cmplt:
}
 }
 
-/* Send a receive completion packet to RNDIS device (ie NetVsp) */
-static void netvsc_receive_completion(void *context)
-{
-   struct hv_netvsc_packet *packet = context;
-   struct hv_device *device = packet->device;
-   struct vmbus_channel *channel;
-   struct netvsc_device *net_device;
-   u64 transaction_id = 0;
-   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
-* send out receive completion, we are using GetInboundNetDevice()
-* since we may have disable outbound traffic already.
-*/
-   net_device = get_inbound_net_device(device);
-   if (!net_device)
-   return;
-   ndev = net_device->ndev;
-
-   /* Overloading use of the lock. */
-   spin_lock_irqsave(_device->recv_pkt_list_lock, flags);
-
-   if (packet->status != 

[PATCH net-next,1/2] hyperv: Remove recv_pkt_list and lock

2014-04-21 Thread Haiyang Zhang
Removed recv_pkt_list and lock, and updated related code, so that
the locking overhead is reduced especially when multiple channels
are in use.

The recv_pkt_list isn't actually necessary because the packets are
processed sequentially in each channel. It has been replaced by a
local variable, and the related lock for this list is also removed.

Signed-off-by: Haiyang Zhang haiya...@microsoft.com
Reviewed-by: K. Y. Srinivasan k...@microsoft.com
---
 drivers/net/hyperv/hyperv_net.h   |   33 ---
 drivers/net/hyperv/netvsc.c   |  174 +++--
 drivers/net/hyperv/netvsc_drv.c   |2 +-
 drivers/net/hyperv/rndis_filter.c |2 -
 4 files changed, 13 insertions(+), 198 deletions(-)

diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 57eb3f9..a1af0f7 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -119,27 +119,14 @@ struct ndis_recv_scale_param { /* 
NDIS_RECEIVE_SCALE_PARAMETERS */
 };
 
 /* Fwd declaration */
-struct hv_netvsc_packet;
 struct ndis_tcp_ip_checksum_info;
 
-/* Represent the xfer page packet which contains 1 or more netvsc packet */
-struct xferpage_packet {
-   struct list_head list_ent;
-   u32 status;
-
-   /* # of netvsc packets this xfer packet contains */
-   u32 count;
-
-   struct vmbus_channel *channel;
-};
-
 /*
  * Represent netvsc packet which contains 1 RNDIS and 1 ethernet frame
  * within the RNDIS
  */
 struct hv_netvsc_packet {
/* Bookkeeping stuff */
-   struct list_head list_ent;
u32 status;
 
struct hv_device *device;
@@ -149,19 +136,8 @@ struct hv_netvsc_packet {
u16 q_idx;
struct vmbus_channel *channel;
 
-   /*
-* Valid only for receives when we break a xfer page packet
-* into multiple netvsc packets
-*/
-   struct xferpage_packet *xfer_page_pkt;
-
union {
struct {
-   u64 recv_completion_tid;
-   void *recv_completion_ctx;
-   void (*recv_completion)(void *context);
-   } recv;
-   struct {
u64 send_completion_tid;
void *send_completion_ctx;
void (*send_completion)(void *context);
@@ -613,9 +589,6 @@ struct nvsp_message {
 
 #define NETVSC_RECEIVE_BUFFER_ID   0xcafe
 
-/* Preallocated receive packets */
-#define NETVSC_RECEIVE_PACKETLIST_COUNT256
-
 #define NETVSC_PACKET_SIZE  2048
 
 #define VRSS_SEND_TAB_SIZE 16
@@ -630,12 +603,6 @@ struct netvsc_device {
wait_queue_head_t wait_drain;
bool start_remove;
bool destroy;
-   /*
-* List of free preallocated hv_netvsc_packet to represent receive
-* packet
-*/
-   struct list_head recv_pkt_list;
-   spinlock_t recv_pkt_list_lock;
 
/* Receive buffer allocated by us but manages by NetVSP */
void *recv_buf;
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index e7e77f1..b103347 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -387,7 +387,6 @@ static void netvsc_disconnect_vsp(struct netvsc_device 
*net_device)
 int netvsc_device_remove(struct hv_device *device)
 {
struct netvsc_device *net_device;
-   struct hv_netvsc_packet *netvsc_packet, *pos;
unsigned long flags;
 
net_device = hv_get_drvdata(device);
@@ -416,12 +415,6 @@ int netvsc_device_remove(struct hv_device *device)
vmbus_close(device-channel);
 
/* Release all resources */
-   list_for_each_entry_safe(netvsc_packet, pos,
-net_device-recv_pkt_list, list_ent) {
-   list_del(netvsc_packet-list_ent);
-   kfree(netvsc_packet);
-   }
-
if (net_device-sub_cb_buf)
vfree(net_device-sub_cb_buf);
 
@@ -641,62 +634,6 @@ retry_send_cmplt:
}
 }
 
-/* Send a receive completion packet to RNDIS device (ie NetVsp) */
-static void netvsc_receive_completion(void *context)
-{
-   struct hv_netvsc_packet *packet = context;
-   struct hv_device *device = packet-device;
-   struct vmbus_channel *channel;
-   struct netvsc_device *net_device;
-   u64 transaction_id = 0;
-   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
-* send out receive completion, we are using GetInboundNetDevice()
-* since we may have disable outbound traffic already.
-*/
-   net_device = get_inbound_net_device(device);
-   if (!net_device)
-   return;
-   ndev = net_device-ndev;
-
-   /* Overloading use of the lock. */
-   spin_lock_irqsave(net_device-recv_pkt_list_lock, flags);

Re: [PATCH net-next,1/2] hyperv: Remove recv_pkt_list and lock

2014-04-21 Thread David Miller
From: Haiyang Zhang haiya...@microsoft.com
Date: Mon, 21 Apr 2014 12:26:15 -0700

 @@ -401,8 +401,6 @@ static void rndis_filter_receive_data(struct rndis_device 
 *dev,
   pkt-total_data_buflen = rndis_pkt-data_len;
   pkt-data = (void *)((unsigned long)pkt-data + data_offset);
  
 - pkt-is_data_pkt = true;
 -
   vlan = rndis_get_ppi(rndis_pkt, IEEE_8021Q_INFO);
   if (vlan) {
   pkt-vlan_tci = VLAN_TAG_PRESENT | vlan-vlanid |

This part of your change is not explained at all in your commit message.

Please resubmit this series with this hunk properly described and
accounted for.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH net-next,1/2] hyperv: Remove recv_pkt_list and lock

2014-04-21 Thread Haiyang Zhang


 -Original Message-
 From: David Miller [mailto:da...@davemloft.net]
 Sent: Monday, April 21, 2014 2:57 PM
 To: Haiyang Zhang
 Cc: net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de;
 jasow...@redhat.com; linux-kernel@vger.kernel.org; driverdev-
 de...@linuxdriverproject.org
 Subject: Re: [PATCH net-next,1/2] hyperv: Remove recv_pkt_list and lock
 
 From: Haiyang Zhang haiya...@microsoft.com
 Date: Mon, 21 Apr 2014 12:26:15 -0700
 
  @@ -401,8 +401,6 @@ static void rndis_filter_receive_data(struct
 rndis_device *dev,
  pkt-total_data_buflen = rndis_pkt-data_len;
  pkt-data = (void *)((unsigned long)pkt-data + data_offset);
 
  -   pkt-is_data_pkt = true;
  -
  vlan = rndis_get_ppi(rndis_pkt, IEEE_8021Q_INFO);
  if (vlan) {
  pkt-vlan_tci = VLAN_TAG_PRESENT | vlan-vlanid |
 
 This part of your change is not explained at all in your commit message.
 
 Please resubmit this series with this hunk properly described and accounted 
 for.

I have updated the description and re-send them.

Thanks,
- Haiyang
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/