lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bc56b9e8-73ea-448c-b006-c9b5b73940ca@davidwei.uk>
Date: Sun, 5 May 2024 17:42:11 -0700
From: David Wei <dw@...idwei.uk>
To: Simon Horman <horms@...nel.org>
Cc: netdev@...r.kernel.org, Michael Chan <michael.chan@...adcom.com>,
 Pavan Chebbi <pavan.chebbi@...adcom.com>,
 Andy Gospodarek <andrew.gospodarek@...adcom.com>,
 Adrian Alvarado <adrian.alvarado@...adcom.com>,
 Mina Almasry <almasrymina@...gle.com>, Shailend Chand <shailend@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, "David S. Miller" <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [RFC PATCH net-next v2 7/9] bnxt: add helpers for allocating rx
 ring mem

On 2024-05-04 05:34, Simon Horman wrote:
> On Wed, May 01, 2024 at 09:54:08PM -0700, David Wei wrote:
>> Add several helper functions for allocating rx ring memory. These are
>> mostly taken from existing functions, but with unnecessary bits stripped
>> out such that only allocations are done.
>>
>> Signed-off-by: David Wei <dw@...idwei.uk>
>> ---
>>  drivers/net/ethernet/broadcom/bnxt/bnxt.c | 87 +++++++++++++++++++++++
>>  1 file changed, 87 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
>> index b0a8d14b7319..21c1a7cb70ab 100644
>> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
>> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
>> @@ -14845,6 +14845,93 @@ static const struct netdev_stat_ops bnxt_stat_ops = {
>>  	.get_base_stats		= bnxt_get_base_stats,
>>  };
>>  
>> +static int __bnxt_alloc_rx_desc_ring(struct pci_dev *pdev, struct bnxt_ring_mem_info *rmem)
>> +{
>> +	int i, rc;
>> +
>> +	for (i = 0; i < rmem->nr_pages; i++) {
>> +		rmem->pg_arr[i] = dma_alloc_coherent(&pdev->dev,
>> +						     rmem->page_size,
>> +						     &rmem->dma_arr[i],
>> +						     GFP_KERNEL);
>> +		if (!rmem->pg_arr[i]) {
>> +			rc = -ENOMEM;
>> +			goto err_free;
>> +		}
>> +	}
>> +
>> +	return 0;
>> +
>> +err_free:
>> +	while (i--) {
>> +		dma_free_coherent(&pdev->dev, rmem->page_size,
>> +				  rmem->pg_arr[i], rmem->dma_arr[i]);
>> +		rmem->pg_arr[i] = NULL;
>> +	}
>> +	return rc;
>> +}
>> +
>> +static int bnxt_alloc_rx_ring_struct(struct bnxt *bp, struct bnxt_ring_struct *ring)
> 
> Hi David,
> 
> W=1 builds fail because this and other functions introduced by
> this patch are unused. I agree that it is nice to split up changes
> into discrete patches. But in this case the change isn't really discrete.
> So perhaps it is best to add helper functions in the same patch
> where they are first used.

Okay, I'll squash it with the patch that uses these functions. Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ