From: Dany Madden <drt@linux.ibm.com>
To: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Cc: netdev@vger.kernel.org, Brian King <brking@linux.ibm.com>,
cforno12@linux.ibm.com, Rick Lindsley <ricklind@linux.ibm.com>
Subject: Re: [PATCH net-next 3/9] ibmvnic: Use/rename local vars in init_rx_pools
Date: Tue, 31 Aug 2021 18:28:53 -0700 [thread overview]
Message-ID: <14ea9cf78d64c41df252425ff04a947b@imap.linux.ibm.com> (raw)
In-Reply-To: <20210901000812.120968-4-sukadev@linux.ibm.com>
On 2021-08-31 17:08, Sukadev Bhattiprolu wrote:
> To make the code more readable, use/rename some local variables.
> Basically we have a set of pools, num_pools. Each pool has a set of
> buffers, pool_size and each buffer is of size buff_size.
>
> pool_size is a bit ambiguous (whether size in bytes or buffers). Add
> a comment in the header file to make it explicit.
>
> Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Reviewed-by: Dany Madden <drt@linux.ibm.com>
> ---
> drivers/net/ethernet/ibm/ibmvnic.c | 17 +++++++++--------
> drivers/net/ethernet/ibm/ibmvnic.h | 2 +-
> 2 files changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c
> b/drivers/net/ethernet/ibm/ibmvnic.c
> index 911315b10731..a611bd3f2539 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -618,14 +618,16 @@ static int init_rx_pools(struct net_device
> *netdev)
> struct ibmvnic_adapter *adapter = netdev_priv(netdev);
> struct device *dev = &adapter->vdev->dev;
> struct ibmvnic_rx_pool *rx_pool;
> - int rxadd_subcrqs;
> + u64 num_pools;
> + u64 pool_size; /* # of buffers in one pool */
> u64 buff_size;
> int i, j;
>
> - rxadd_subcrqs = adapter->num_active_rx_scrqs;
> + num_pools = adapter->num_active_rx_scrqs;
> + pool_size = adapter->req_rx_add_entries_per_subcrq;
> buff_size = adapter->cur_rx_buf_sz;
>
> - adapter->rx_pool = kcalloc(rxadd_subcrqs,
> + adapter->rx_pool = kcalloc(num_pools,
> sizeof(struct ibmvnic_rx_pool),
> GFP_KERNEL);
> if (!adapter->rx_pool) {
> @@ -636,17 +638,16 @@ static int init_rx_pools(struct net_device
> *netdev)
> /* Set num_active_rx_pools early. If we fail below after partial
> * allocation, release_rx_pools() will know how many to look for.
> */
> - adapter->num_active_rx_pools = rxadd_subcrqs;
> + adapter->num_active_rx_pools = num_pools;
>
> - for (i = 0; i < rxadd_subcrqs; i++) {
> + for (i = 0; i < num_pools; i++) {
> rx_pool = &adapter->rx_pool[i];
>
> netdev_dbg(adapter->netdev,
> "Initializing rx_pool[%d], %lld buffs, %lld bytes each\n",
> - i, adapter->req_rx_add_entries_per_subcrq,
> - buff_size);
> + i, pool_size, buff_size);
>
> - rx_pool->size = adapter->req_rx_add_entries_per_subcrq;
> + rx_pool->size = pool_size;
> rx_pool->index = i;
> rx_pool->buff_size = ALIGN(buff_size, L1_CACHE_BYTES);
> rx_pool->active = 1;
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.h
> b/drivers/net/ethernet/ibm/ibmvnic.h
> index 22df602323bc..5652566818fb 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.h
> +++ b/drivers/net/ethernet/ibm/ibmvnic.h
> @@ -827,7 +827,7 @@ struct ibmvnic_rx_buff {
>
> struct ibmvnic_rx_pool {
> struct ibmvnic_rx_buff *rx_buff;
> - int size;
> + int size; /* # of buffers in the pool */
> int index;
> int buff_size;
> atomic_t available;
next prev parent reply other threads:[~2021-09-01 1:28 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-01 0:08 [PATCH net-next 0/9] ibmvnic: Reuse ltb, rx, tx pools Sukadev Bhattiprolu
2021-09-01 0:08 ` [PATCH net-next 1/9] ibmvnic: Consolidate code in replenish_rx_pool() Sukadev Bhattiprolu
2021-09-01 1:26 ` Dany Madden
2021-09-01 0:08 ` [PATCH net-next 2/9] ibmvnic: Fix up some comments and messages Sukadev Bhattiprolu
2021-09-01 1:28 ` Dany Madden
2021-09-01 8:58 ` kernel test robot
2021-09-01 8:58 ` kernel test robot
2021-09-01 0:08 ` [PATCH net-next 3/9] ibmvnic: Use/rename local vars in init_rx_pools Sukadev Bhattiprolu
2021-09-01 1:28 ` Dany Madden [this message]
2021-09-01 0:08 ` [PATCH net-next 4/9] ibmvnic: Use/rename local vars in init_tx_pools Sukadev Bhattiprolu
2021-09-01 1:30 ` Dany Madden
2021-09-01 0:08 ` [PATCH net-next 5/9] ibmvnic: init_tx_pools move loop-invariant code out Sukadev Bhattiprolu
2021-09-01 1:32 ` Dany Madden
2021-09-01 0:08 ` [PATCH net-next 6/9] ibmvnic: Use bitmap for LTB map_ids Sukadev Bhattiprolu
2021-09-01 1:33 ` Dany Madden
2021-09-01 0:08 ` [PATCH net-next 7/9] ibmvnic: Reuse LTB when possible Sukadev Bhattiprolu
2021-09-01 1:34 ` Dany Madden
2021-09-01 0:08 ` [PATCH net-next 8/9] ibmvnic: Reuse rx pools " Sukadev Bhattiprolu
2021-09-01 1:35 ` Dany Madden
2021-09-01 0:08 ` [PATCH net-next 9/9] ibmvnic: Reuse tx " Sukadev Bhattiprolu
2021-09-01 1:36 ` Dany Madden
2021-09-01 1:21 ` [PATCH net-next 0/9] ibmvnic: Reuse ltb, rx, tx pools Rick Lindsley
2021-09-01 2:35 ` Jakub Kicinski
2021-09-01 18:07 ` Sukadev Bhattiprolu
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=14ea9cf78d64c41df252425ff04a947b@imap.linux.ibm.com \
--to=drt@linux.ibm.com \
--cc=brking@linux.ibm.com \
--cc=cforno12@linux.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=ricklind@linux.ibm.com \
--cc=sukadev@linux.ibm.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: link
Be 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.