From: "Michael Kelley (EOSG)" <Michael.H.Kelley@microsoft.com> To: Long Li <longli@microsoft.com>, KY Srinivasan <kys@microsoft.com>, Haiyang Zhang <haiyangz@microsoft.com>, Stephen Hemminger <sthemmin@microsoft.com>, "James E . J . Bottomley" <JBottomley@odin.com>, "Martin K . Petersen" <martin.petersen@oracle.com>, "devel@linuxdriverproject.org" <devel@linuxdriverproject.org>, "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "netdev@vger.kernel.org" <netdev@vger.kernel.org> Subject: RE: [Resend Patch 2/3] Netvsc: Use the vmbus functiton to calculate ring buffer percentage Date: Fri, 13 Apr 2018 23:39:58 +0000 [thread overview] Message-ID: <DM5PR2101MB103001D09986D57D8E0EF124DCB30@DM5PR2101MB1030.namprd21.prod.outlook.com> (raw) In-Reply-To: <20180328004840.22787-2-longli@linuxonhyperv.com> > -----Original Message----- > From: linux-kernel-owner@vger.kernel.org <linux-kernel-owner@vger.kernel.org> On Behalf > Of Long Li > Sent: Tuesday, March 27, 2018 5:49 PM > To: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang <haiyangz@microsoft.com>; Stephen > Hemminger <sthemmin@microsoft.com>; James E . J . Bottomley <JBottomley@odin.com>; > Martin K . Petersen <martin.petersen@oracle.com>; devel@linuxdriverproject.org; linux- > scsi@vger.kernel.org; linux-kernel@vger.kernel.org; netdev@vger.kernel.org > Cc: Long Li <longli@microsoft.com> > Subject: [Resend Patch 2/3] Netvsc: Use the vmbus functiton to calculate ring buffer > percentage > > From: Long Li <longli@microsoft.com> > > In Vmbus, we have defined a function to calculate available ring buffer > percentage to write. > > Use that function and remove netvsc's private version. > > Signed-off-by: Long Li <longli@microsoft.com> Reviewed-by: Michael Kelley <mikelley@microsoft.com> > --- > drivers/net/hyperv/hyperv_net.h | 1 - > drivers/net/hyperv/netvsc.c | 17 +++-------------- > drivers/net/hyperv/netvsc_drv.c | 3 --- > 3 files changed, 3 insertions(+), 18 deletions(-) > > diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h > index cd538d5a7986..a0199ab13d67 100644 > --- a/drivers/net/hyperv/hyperv_net.h > +++ b/drivers/net/hyperv/hyperv_net.h > @@ -189,7 +189,6 @@ struct netvsc_device; > struct net_device_context; > > extern u32 netvsc_ring_bytes; > -extern struct reciprocal_value netvsc_ring_reciprocal; > > struct netvsc_device *netvsc_device_add(struct hv_device *device, > const struct netvsc_device_info *info); > 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) > -- > 2.14.1 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
WARNING: multiple messages have this Message-ID (diff)
From: "Michael Kelley (EOSG)" <Michael.H.Kelley@microsoft.com> To: Long Li <longli@microsoft.com>, KY Srinivasan <kys@microsoft.com>, Haiyang Zhang <haiyangz@microsoft.com>, Stephen Hemminger <sthemmin@microsoft.com>, "James E . J . Bottomley" <JBottomley@odin.com>, "Martin K . Petersen" <martin.petersen@oracle.com>, "devel@linuxdriverproject.org" <devel@linuxdriverproject.org>, "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "netdev@vger.kernel.org" <netdev@vger.kernel.org> Subject: RE: [Resend Patch 2/3] Netvsc: Use the vmbus functiton to calculate ring buffer percentage Date: Fri, 13 Apr 2018 23:39:58 +0000 [thread overview] Message-ID: <DM5PR2101MB103001D09986D57D8E0EF124DCB30@DM5PR2101MB1030.namprd21.prod.outlook.com> (raw) In-Reply-To: <20180328004840.22787-2-longli@linuxonhyperv.com> > -----Original Message----- > From: linux-kernel-owner@vger.kernel.org <linux-kernel-owner@vger.kernel.org> On Behalf > Of Long Li > Sent: Tuesday, March 27, 2018 5:49 PM > To: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang <haiyangz@microsoft.com>; Stephen > Hemminger <sthemmin@microsoft.com>; James E . J . Bottomley <JBottomley@odin.com>; > Martin K . Petersen <martin.petersen@oracle.com>; devel@linuxdriverproject.org; linux- > scsi@vger.kernel.org; linux-kernel@vger.kernel.org; netdev@vger.kernel.org > Cc: Long Li <longli@microsoft.com> > Subject: [Resend Patch 2/3] Netvsc: Use the vmbus functiton to calculate ring buffer > percentage > > From: Long Li <longli@microsoft.com> > > In Vmbus, we have defined a function to calculate available ring buffer > percentage to write. > > Use that function and remove netvsc's private version. > > Signed-off-by: Long Li <longli@microsoft.com> Reviewed-by: Michael Kelley <mikelley@microsoft.com> > --- > drivers/net/hyperv/hyperv_net.h | 1 - > drivers/net/hyperv/netvsc.c | 17 +++-------------- > drivers/net/hyperv/netvsc_drv.c | 3 --- > 3 files changed, 3 insertions(+), 18 deletions(-) > > diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h > index cd538d5a7986..a0199ab13d67 100644 > --- a/drivers/net/hyperv/hyperv_net.h > +++ b/drivers/net/hyperv/hyperv_net.h > @@ -189,7 +189,6 @@ struct netvsc_device; > struct net_device_context; > > extern u32 netvsc_ring_bytes; > -extern struct reciprocal_value netvsc_ring_reciprocal; > > struct netvsc_device *netvsc_device_add(struct hv_device *device, > const struct netvsc_device_info *info); > 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) > -- > 2.14.1
next prev parent reply other threads:[~2018-04-13 23:39 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-03-28 0:48 [Resend Patch 1/3] Vmbus: Add function to report available ring buffer to write in total ring size percentage Long Li 2018-03-28 0:48 ` Long Li 2018-03-28 0:48 ` [Resend Patch 2/3] Netvsc: Use the vmbus functiton to calculate ring buffer percentage Long Li 2018-03-28 0:48 ` Long Li 2018-04-13 23:39 ` Michael Kelley (EOSG) [this message] 2018-04-13 23:39 ` Michael Kelley (EOSG) 2018-03-28 0:48 ` [Resend Patch 3/3] Storvsc: Select channel based on available percentage of ring buffer to write Long Li 2018-03-28 0:48 ` Long Li 2018-04-13 23:28 ` Michael Kelley (EOSG) 2018-04-13 23:28 ` Michael Kelley (EOSG) 2018-04-14 0:25 ` Long Li 2018-04-14 0:25 ` Long Li 2018-03-28 22:00 ` [Resend Patch 1/3] Vmbus: Add function to report available ring buffer to write in total ring size percentage Martin K. Petersen 2018-03-28 22:00 ` Martin K. Petersen 2018-03-28 22:42 ` Long Li 2018-03-28 22:42 ` Long Li 2018-03-28 23:22 ` Stephen Hemminger 2018-03-28 23:22 ` Stephen Hemminger 2018-04-10 2:58 ` Martin K. Petersen 2018-04-10 2:58 ` Martin K. Petersen
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=DM5PR2101MB103001D09986D57D8E0EF124DCB30@DM5PR2101MB1030.namprd21.prod.outlook.com \ --to=michael.h.kelley@microsoft.com \ --cc=JBottomley@odin.com \ --cc=devel@linuxdriverproject.org \ --cc=haiyangz@microsoft.com \ --cc=kys@microsoft.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-scsi@vger.kernel.org \ --cc=longli@microsoft.com \ --cc=martin.petersen@oracle.com \ --cc=netdev@vger.kernel.org \ --cc=sthemmin@microsoft.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.