[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM5PR2101MB0888F3389A0EB587EE85CC8CA0A80@DM5PR2101MB0888.namprd21.prod.outlook.com>
Date: Fri, 23 Mar 2018 15:12:12 +0000
From: KY Srinivasan <kys@...rosoft.com>
To: Haiyang Zhang <haiyangz@...rosoft.com>,
Long Li <longli@...uxonhyperv.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
"James E . J . Bottomley" <JBottomley@...n.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
"devel@...uxdriverproject.org" <devel@...uxdriverproject.org>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: Long Li <longli@...rosoft.com>
Subject: RE: [PATCH 2/3] Netvsc: Use the vmbus functiton to calculate ring
buffer percentage
> -----Original Message-----
> From: Haiyang Zhang
> Sent: Friday, March 23, 2018 8:01 AM
> To: Long Li <longli@...uxonhyperv.com>; KY Srinivasan
> <kys@...rosoft.com>; Stephen Hemminger <sthemmin@...rosoft.com>;
> James E . J . Bottomley <JBottomley@...n.com>; Martin K . Petersen
> <martin.petersen@...cle.com>; devel@...uxdriverproject.org; linux-
> scsi@...r.kernel.org; linux-kernel@...r.kernel.org
> Cc: Long Li <longli@...rosoft.com>
> Subject: RE: [PATCH 2/3] Netvsc: Use the vmbus functiton to calculate ring
> buffer percentage
>
>
>
> > -----Original Message-----
> > From: Long Li <longli@...uxonhyperv.com>
> > Sent: Thursday, March 22, 2018 8:16 PM
> > To: KY Srinivasan <kys@...rosoft.com>; Haiyang Zhang
> > <haiyangz@...rosoft.com>; Stephen Hemminger
> <sthemmin@...rosoft.com>;
> > James E . J . Bottomley <JBottomley@...n.com>; Martin K . Petersen
> > <martin.petersen@...cle.com>; devel@...uxdriverproject.org; linux-
> > scsi@...r.kernel.org; linux-kernel@...r.kernel.org
> > Cc: Long Li <longli@...rosoft.com>
> > Subject: [PATCH 2/3] Netvsc: Use the vmbus functiton to calculate ring
> buffer
> > percentage
> >
> > From: Long Li <longli@...rosoft.com>
> >
> > In Vmbus, we have defined a function to calculate available ring buffer
> > percentage to write.
> >
> > Use that function and remove duplicate netvsc code.
> >
> > Signed-off-by: Long Li <longli@...rosoft.com>
> > ---
> > drivers/net/hyperv/netvsc.c | 17 +++--------------
> > drivers/net/hyperv/netvsc_drv.c | 3 ---
> > 2 files changed, 3 insertions(+), 17 deletions(-)
Why is the patch being sent to the scsi list and not to the network mailing list and
Dave Miller.
K. Y
> >
> > diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
> index
> > 0265d703eb03..8af0069e4d8c 100644
> > --- a/drivers/net/hyperv/netvsc.c
> > +++ b/drivers/net/hyperv/netvsc.c
> > @@ -31,7 +31,6 @@
> > #include <linux/vmalloc.h>
> > #include <linux/rtnetlink.h>
> > #include <linux/prefetch.h>
> > -#include <linux/reciprocal_div.h>
> >
> > #include <asm/sync_bitops.h>
> >
> > @@ -590,17 +589,6 @@ void netvsc_device_remove(struct hv_device
> *device)
> > #define RING_AVAIL_PERCENT_HIWATER 20 #define
> > RING_AVAIL_PERCENT_LOWATER 10
> >
> > -/*
> > - * Get the percentage of available bytes to write in the ring.
> > - * The return value is in range from 0 to 100.
> > - */
> > -static u32 hv_ringbuf_avail_percent(const struct hv_ring_buffer_info
> > *ring_info) -{
> > - u32 avail_write = hv_get_bytes_to_write(ring_info);
> > -
> > - return reciprocal_divide(avail_write * 100, netvsc_ring_reciprocal);
> > -}
> > -
> > static inline void netvsc_free_send_slot(struct netvsc_device
> *net_device,
> > u32 index)
> > {
> > @@ -649,7 +637,8 @@ static void netvsc_send_tx_complete(struct
> > netvsc_device *net_device,
> > wake_up(&net_device->wait_drain);
> >
> > if (netif_tx_queue_stopped(netdev_get_tx_queue(ndev, q_idx))
> &&
> > - (hv_ringbuf_avail_percent(&channel->outbound) >
> > RING_AVAIL_PERCENT_HIWATER ||
> > + (hv_get_avail_to_write_percent(&channel->outbound) >
> > + RING_AVAIL_PERCENT_HIWATER ||
> > queue_sends < 1)) {
> > netif_tx_wake_queue(netdev_get_tx_queue(ndev, q_idx));
> > ndev_ctx->eth_stats.wake_queue++;
> > @@ -757,7 +746,7 @@ static inline int netvsc_send_pkt(
> > struct netdev_queue *txq = netdev_get_tx_queue(ndev, packet-
> >q_idx);
> > u64 req_id;
> > int ret;
> > - u32 ring_avail = hv_ringbuf_avail_percent(&out_channel-
> >outbound);
> > + u32 ring_avail =
> > +hv_get_avail_to_write_percent(&out_channel->outbound);
> >
> > nvmsg.hdr.msg_type = NVSP_MSG1_TYPE_SEND_RNDIS_PKT;
> > if (skb)
> > diff --git a/drivers/net/hyperv/netvsc_drv.c
> b/drivers/net/hyperv/netvsc_drv.c
> > index faea0be18924..b0b1c2fd2b7b 100644
> > --- a/drivers/net/hyperv/netvsc_drv.c
> > +++ b/drivers/net/hyperv/netvsc_drv.c
> > @@ -35,7 +35,6 @@
> > #include <linux/slab.h>
> > #include <linux/rtnetlink.h>
> > #include <linux/netpoll.h>
> > -#include <linux/reciprocal_div.h>
> >
> > #include <net/arp.h>
> > #include <net/route.h>
> > @@ -55,7 +54,6 @@ static unsigned int ring_size __ro_after_init = 128;
> > module_param(ring_size, uint, S_IRUGO);
> MODULE_PARM_DESC(ring_size,
> > "Ring buffer size (# of pages)"); unsigned int netvsc_ring_bytes
> __ro_after_init;
> > -struct reciprocal_value netvsc_ring_reciprocal __ro_after_init;
> >
> > static const u32 default_msg = NETIF_MSG_DRV | NETIF_MSG_PROBE |
> > NETIF_MSG_LINK | NETIF_MSG_IFUP |
> > @@ -2186,7 +2184,6 @@ static int __init netvsc_drv_init(void)
> > ring_size);
> > }
> > netvsc_ring_bytes = ring_size * PAGE_SIZE;
> > - netvsc_ring_reciprocal = reciprocal_value(netvsc_ring_bytes);
> >
> > ret = vmbus_driver_register(&netvsc_drv);
> > if (ret)
> > --
>
>
> Please also remove netvsc_ring_reciprocal from hyperv_net.h
> Thanks.
>
> Reviewed-by: Haiyang Zhang <haiyangz@...rosoft.com>
Powered by blists - more mailing lists