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]
Date: Wed, 19 Jun 2024 12:59:40 +0100
From: Edward Cree <ecree.xilinx@...il.com>
To: David Wei <dw@...idwei.uk>, edward.cree@....com,
 linux-net-drivers@....com, davem@...emloft.net, kuba@...nel.org,
 edumazet@...gle.com, pabeni@...hat.com
Cc: netdev@...r.kernel.org, habetsm.xilinx@...il.com,
 sudheer.mogilappagari@...el.com, jdamato@...tly.com, mw@...ihalf.com,
 linux@...linux.org.uk, sgoutham@...vell.com, gakula@...vell.com,
 sbhatta@...vell.com, hkelam@...vell.com, saeedm@...dia.com, leon@...nel.org,
 jacob.e.keller@...el.com, andrew@...n.ch, ahmed.zaki@...el.com
Subject: Re: [PATCH v5 net-next 3/7] net: ethtool: record custom RSS contexts
 in the XArray

On 19/06/2024 01:46, David Wei wrote:
> On 2024-06-18 15:44, edward.cree@....com wrote:
>> From: Edward Cree <ecree.xilinx@...il.com>
>>
>> Since drivers are still choosing the context IDs, we have to force the
>>  XArray to use the ID they've chosen rather than picking one ourselves,
>>  and handle the case where they give us an ID that's already in use.
>>
>> Signed-off-by: Edward Cree <ecree.xilinx@...il.com>
>> ---
>>  include/linux/ethtool.h | 14 ++++++++
>>  net/ethtool/ioctl.c     | 74 ++++++++++++++++++++++++++++++++++++++++-
>>  2 files changed, 87 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
>> index a68b83a6d61f..5bef46fdcb94 100644
>> --- a/include/linux/ethtool.h
>> +++ b/include/linux/ethtool.h
>> @@ -199,6 +199,17 @@ static inline u8 *ethtool_rxfh_context_key(struct ethtool_rxfh_context *ctx)
>>  	return (u8 *)(ethtool_rxfh_context_indir(ctx) + ctx->indir_size);
>>  }
>>  
>> +static inline size_t ethtool_rxfh_context_size(u32 indir_size, u32 key_size,
>> +					       u16 priv_size)
>> +{
>> +	size_t indir_bytes = array_size(indir_size, sizeof(u32));
>> +	size_t flex_len;
>> +
>> +	flex_len = size_add(size_add(indir_bytes, key_size),
>> +			    ALIGN(priv_size, sizeof(u32)));
>> +	return struct_size((struct ethtool_rxfh_context *)0, data, flex_len);
> 
> ctx->data is [ priv | indir_tbl | key ] but only priv and indir_tbl are
> aligned to sizeof(u32). Why does key not need to be aligned?

Because it's a u8[], whereas indir_tbl is a u32[].
(And priv is aligned to sizeof(void *), so that drivers can put
 whatever struct they like there and have proper alignment.)

> Is it guaranteed to be 40 bytes?

Not AFAIK, though that certainly is a popular size.

-ed

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ