Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1722094

Re: [PATCH] be2net: Fix some u16 fields appropriately

From 严海双 <yanhaishuang@cmss.chinamobile.com>
Newsgroups linux.kernel
Subject Re: [PATCH] be2net: Fix some u16 fields appropriately
Date 2017-08-29 03:10 +0200
Message-ID <ujDcu-4ow-11@gated-at.bofh.it> (permalink)
References <uj0kO-4xU-13@gated-at.bofh.it> <ujBu1-3iy-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> On 2017年8月29日, at 上午7:19, David Miller <davem@davemloft.net> wrote:
> 
> From: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
> Date: Sun, 27 Aug 2017 15:24:45 +0800
> 
>> In be_tx_compl_process, frag_index declared as u32, so it's better to
>> declare last_index as u32 also.
>> 
>> CC: Ajit Khaparde <ajit.khaparde@broadcom.com>
>> Fixes: b0fd2eb28bd4 ("be2net: Declare some u16 fields as u32 to improve
>> performance")
>> Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
> 
> That is not a legitimate reason for making this change.
> 
>> @@ -255,7 +255,7 @@ struct be_tx_stats {
>> /* Structure to hold some data of interest obtained from a TX CQE */
>> struct be_tx_compl_info {
>> 	u8 status;		/* Completion status */
>> -	u16 end_index;		/* Completed TXQ Index */
>> +	u32 end_index;		/* Completed TXQ Index */
>> };
>> 
>> struct be_tx_obj {
> 
> The ->end_index comes solely from:
> 
> 	txcp->end_index = GET_TX_COMPL_BITS(wrb_index, compl);
> 
> Which is precisely a 16-bit value.
> 
> I'm not applying this, sorry.
> 

Hi David,

The GET_TX_COMPL_BITS comes from amap_get which also returns a 32-bit value:

  6 static inline u32 amap_get(void *ptr, u32 dw_offset, u32 mask, u32 offset)
  5 {
  4     u32 *dw = (u32 *) ptr;
  3     return mask & (*(dw + dw_offset) >> offset);
  2 }
  1
869 #define AMAP_GET_BITS(_struct, field, ptr)              \
  1         amap_get(ptr,                       \
  2             offsetof(_struct, field)/32,            \
  3             amap_mask(sizeof(((_struct *)0)->field)),   \
  4             AMAP_BIT_OFFSET(_struct, field))

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] be2net: Fix some u16 fields appropriately Haishuang Yan <yanhaishuang@cmss.chinamobile.com> - 2017-08-27 09:40 +0200
  Re: [PATCH] be2net: Fix some u16 fields appropriately David Miller <davem@davemloft.net> - 2017-08-29 01:20 +0200
    Re: [PATCH] be2net: Fix some u16 fields appropriately 严海双 <yanhaishuang@cmss.chinamobile.com> - 2017-08-29 03:10 +0200
      Re: [PATCH] be2net: Fix some u16 fields appropriately David Miller <davem@davemloft.net> - 2017-08-29 06:30 +0200

csiph-web