linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] sfc: farch: fix compile warning in efx_farch_dimension_resources()
@ 2021-05-18 13:17 Yang Yingliang
  2021-05-18 14:26 ` Edward Cree
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2021-05-18 13:17 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: davem, ecree.xilinx

Fix the following kernel build warning when CONFIG_SFC_SRIOV is disabled:

  drivers/net/ethernet/sfc/farch.c: In function ‘efx_farch_dimension_resources’:
  drivers/net/ethernet/sfc/farch.c:1671:21: warning: variable ‘buftbl_min’ set but not used [-Wunused-but-set-variable]
    unsigned vi_count, buftbl_min, total_tx_channels;

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/net/ethernet/sfc/farch.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c
index 49df02ecee91..0bd879bd73c7 100644
--- a/drivers/net/ethernet/sfc/farch.c
+++ b/drivers/net/ethernet/sfc/farch.c
@@ -1668,13 +1668,17 @@ void efx_farch_rx_pull_indir_table(struct efx_nic *efx)
  */
 void efx_farch_dimension_resources(struct efx_nic *efx, unsigned sram_lim_qw)
 {
-	unsigned vi_count, buftbl_min, total_tx_channels;
+	unsigned vi_count, total_tx_channels;
 
 #ifdef CONFIG_SFC_SRIOV
+	unsigned buftbl_min;
 	struct siena_nic_data *nic_data = efx->nic_data;
 #endif
 
 	total_tx_channels = efx->n_tx_channels + efx->n_extra_tx_channels;
+	vi_count = max(efx->n_channels, total_tx_channels * EFX_MAX_TXQ_PER_CHANNEL);
+
+#ifdef CONFIG_SFC_SRIOV
 	/* Account for the buffer table entries backing the datapath channels
 	 * and the descriptor caches for those channels.
 	 */
@@ -1682,9 +1686,6 @@ void efx_farch_dimension_resources(struct efx_nic *efx, unsigned sram_lim_qw)
 		       total_tx_channels * EFX_MAX_TXQ_PER_CHANNEL * EFX_MAX_DMAQ_SIZE +
 		       efx->n_channels * EFX_MAX_EVQ_SIZE)
 		      * sizeof(efx_qword_t) / EFX_BUF_SIZE);
-	vi_count = max(efx->n_channels, total_tx_channels * EFX_MAX_TXQ_PER_CHANNEL);
-
-#ifdef CONFIG_SFC_SRIOV
 	if (efx->type->sriov_wanted) {
 		if (efx->type->sriov_wanted(efx)) {
 			unsigned vi_dc_entries, buftbl_free;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] sfc: farch: fix compile warning in efx_farch_dimension_resources()
  2021-05-18 13:17 [PATCH net-next] sfc: farch: fix compile warning in efx_farch_dimension_resources() Yang Yingliang
@ 2021-05-18 14:26 ` Edward Cree
  0 siblings, 0 replies; 2+ messages in thread
From: Edward Cree @ 2021-05-18 14:26 UTC (permalink / raw)
  To: Yang Yingliang, linux-kernel, netdev; +Cc: davem

On 18/05/2021 14:17, Yang Yingliang wrote:
> Fix the following kernel build warning when CONFIG_SFC_SRIOV is disabled:
> 
>   drivers/net/ethernet/sfc/farch.c: In function ‘efx_farch_dimension_resources’:
>   drivers/net/ethernet/sfc/farch.c:1671:21: warning: variable ‘buftbl_min’ set but not used [-Wunused-but-set-variable]
>     unsigned vi_count, buftbl_min, total_tx_channels;
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/net/ethernet/sfc/farch.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c
> index 49df02ecee91..0bd879bd73c7 100644
> --- a/drivers/net/ethernet/sfc/farch.c
> +++ b/drivers/net/ethernet/sfc/farch.c
> @@ -1668,13 +1668,17 @@ void efx_farch_rx_pull_indir_table(struct efx_nic *efx)
>   */
>  void efx_farch_dimension_resources(struct efx_nic *efx, unsigned sram_lim_qw)
>  {
> -	unsigned vi_count, buftbl_min, total_tx_channels;
> +	unsigned vi_count, total_tx_channels;
>  
>  #ifdef CONFIG_SFC_SRIOV
> +	unsigned buftbl_min;
>  	struct siena_nic_data *nic_data = efx->nic_data;
>  #endif
Reverse xmas tree is messed up here, please fix.
Apart from that, LGTM.

-ed

>  
>  	total_tx_channels = efx->n_tx_channels + efx->n_extra_tx_channels;
> +	vi_count = max(efx->n_channels, total_tx_channels * EFX_MAX_TXQ_PER_CHANNEL);
> +
> +#ifdef CONFIG_SFC_SRIOV
>  	/* Account for the buffer table entries backing the datapath channels
>  	 * and the descriptor caches for those channels.
>  	 */
> @@ -1682,9 +1686,6 @@ void efx_farch_dimension_resources(struct efx_nic *efx, unsigned sram_lim_qw)
>  		       total_tx_channels * EFX_MAX_TXQ_PER_CHANNEL * EFX_MAX_DMAQ_SIZE +
>  		       efx->n_channels * EFX_MAX_EVQ_SIZE)
>  		      * sizeof(efx_qword_t) / EFX_BUF_SIZE);
> -	vi_count = max(efx->n_channels, total_tx_channels * EFX_MAX_TXQ_PER_CHANNEL);
> -
> -#ifdef CONFIG_SFC_SRIOV
>  	if (efx->type->sriov_wanted) {
>  		if (efx->type->sriov_wanted(efx)) {
>  			unsigned vi_dc_entries, buftbl_free;
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-18 14:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 13:17 [PATCH net-next] sfc: farch: fix compile warning in efx_farch_dimension_resources() Yang Yingliang
2021-05-18 14:26 ` Edward Cree

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).