diff mbox series

[-next,resend] sfc: farch: fix compile warning in efx_farch_dimension_resources()

Message ID 20210519021136.1638370-1-yangyingliang@huawei.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [-next,resend] sfc: farch: fix compile warning in efx_farch_dimension_resources() | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers warning 2 maintainers not CCed: habetsm.xilinx@gmail.com kuba@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning WARNING: Prefer 'unsigned int' to bare use of 'unsigned' WARNING: line length of 85 exceeds 80 columns
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Yang Yingliang May 19, 2021, 2:11 a.m. UTC
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(-)

Comments

Edward Cree May 19, 2021, 2:40 p.m. UTC | #1
On 19/05/2021 03:11, 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..6048b08b89ec 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
>  	struct siena_nic_data *nic_data = efx->nic_data;
> +	unsigned buftbl_min;
>  #endif
As I said the first time you sent this:
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;
>
Yang Yingliang May 20, 2021, 2:13 a.m. UTC | #2
Hi,

On 2021/5/19 22:40, Edward Cree wrote:
> On 19/05/2021 03:11, 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..6048b08b89ec 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
>>   	struct siena_nic_data *nic_data = efx->nic_data;
>> +	unsigned buftbl_min;
>>   #endif
> As I said the first time you sent this:
> Reverse xmas tree is messed up here, please fix.
> Apart from that, LGTM.

Do you mean like this:

diff --git a/drivers/net/ethernet/sfc/farch.c 
b/drivers/net/ethernet/sfc/farch.c

index 6048b08b89ec..b16f04cf7223 100644
--- a/drivers/net/ethernet/sfc/farch.c
+++ b/drivers/net/ethernet/sfc/farch.c
@@ -1668,10 +1668,10 @@ 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, total_tx_channels;
+    unsigned total_tx_channels, vi_count;

  #ifdef CONFIG_SFC_SRIOV
-    struct siena_nic_data *nic_data = efx->nic_data;
+    struct siena_nic_data *nic_data;
      unsigned buftbl_min;
  #endif

@@ -1679,6 +1679,7 @@ void efx_farch_dimension_resources(struct efx_nic 
*efx, unsigned sram_lim_qw)
      vi_count = max(efx->n_channels, total_tx_channels * 
EFX_MAX_TXQ_PER_CHANNEL);

  #ifdef CONFIG_SFC_SRIOV
+    nic_data = efx->nic_data;
      /* Account for the buffer table entries backing the datapath channels
       * and the descriptor caches for those channels.
       */


Thanks,

Yang

>
> -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;
>>
> .
Edward Cree May 20, 2021, 11:52 a.m. UTC | #3
On 20/05/2021 03:13, Yang Yingliang wrote:
> On 2021/5/19 22:40, Edward Cree wrote:
>> As I said the first time you sent this:
>> Reverse xmas tree is messed up here, please fix.
>> Apart from that, LGTM.
> 
> Do you mean like this:
That's one way to do it.  But, a couple of nits:

> diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c
> 
> index 6048b08b89ec..b16f04cf7223 100644
> --- a/drivers/net/ethernet/sfc/farch.c
> +++ b/drivers/net/ethernet/sfc/farch.c
> @@ -1668,10 +1668,10 @@ 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, total_tx_channels;
> +    unsigned total_tx_channels, vi_count;
No need to change the order of decls within a line.
> 
Probably this blank line should be removed while we're at it.
>  #ifdef CONFIG_SFC_SRIOV
> -    struct siena_nic_data *nic_data = efx->nic_data;
> +    struct siena_nic_data *nic_data;
>      unsigned buftbl_min;
>  #endif
> 
> @@ -1679,6 +1679,7 @@ void efx_farch_dimension_resources(struct efx_nic *efx, unsigned sram_lim_qw)
>      vi_count = max(efx->n_channels, total_tx_channels * EFX_MAX_TXQ_PER_CHANNEL);
> 
>  #ifdef CONFIG_SFC_SRIOV
> +    nic_data = efx->nic_data;
>      /* Account for the buffer table entries backing the datapath channels
>       * and the descriptor caches for those channels.
>       */
Otherwise, looks fine.
-ed
diff mbox series

Patch

diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c
index 49df02ecee91..6048b08b89ec 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
 	struct siena_nic_data *nic_data = efx->nic_data;
+	unsigned buftbl_min;
 #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;