[v5,13/40] net/ena: check RSS hash algorithms

Message ID 20231011092805.693171-14-haijie1@huawei.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series support setting and querying RSS algorithms |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Jie Hai Oct. 11, 2023, 9:27 a.m. UTC
  A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.

Signed-off-by: Jie Hai <haijie1@huawei.com>
---
 drivers/net/ena/ena_rss.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Ferruh Yigit Oct. 11, 2023, 5:27 p.m. UTC | #1
On 10/11/2023 10:27 AM, Jie Hai wrote:
> A new field 'algorithm' has been added to rss_conf, check it
> in case of ignoring unsupported values.
> 
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
>  drivers/net/ena/ena_rss.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/ena/ena_rss.c b/drivers/net/ena/ena_rss.c
> index d0ba9d5c0a14..06aff9f3bd49 100644
> --- a/drivers/net/ena/ena_rss.c
> +++ b/drivers/net/ena/ena_rss.c
> @@ -398,6 +398,9 @@ static int ena_rss_hash_set(struct ena_com_dev *ena_dev,
>  	uint8_t *rss_key;
>  	int rc;
>  
> +	if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
> +		return -EINVAL;
> +
>  	if (rss_conf->rss_key != NULL) {
>  		/* Reorder the RSS key bytes for the hardware requirements. */
>  		ena_reorder_rss_hash_key(hw_rss_key, rss_conf->rss_key,

I can see in some drivers configure() ops is not updated, I assume these
are the ones don't have any RSS related config in it, it is not clear
still to add check, but I guess what you are doing is reasonable, I am
OK with this approach.
  
Jie Hai Oct. 12, 2023, 2:35 a.m. UTC | #2
On 2023/10/12 1:27, Ferruh Yigit wrote:
> On 10/11/2023 10:27 AM, Jie Hai wrote:
>> A new field 'algorithm' has been added to rss_conf, check it
>> in case of ignoring unsupported values.
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> ---
>>   drivers/net/ena/ena_rss.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/net/ena/ena_rss.c b/drivers/net/ena/ena_rss.c
>> index d0ba9d5c0a14..06aff9f3bd49 100644
>> --- a/drivers/net/ena/ena_rss.c
>> +++ b/drivers/net/ena/ena_rss.c
>> @@ -398,6 +398,9 @@ static int ena_rss_hash_set(struct ena_com_dev *ena_dev,
>>   	uint8_t *rss_key;
>>   	int rc;
>>   
>> +	if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
>> +		return -EINVAL;
>> +
>>   	if (rss_conf->rss_key != NULL) {
>>   		/* Reorder the RSS key bytes for the hardware requirements. */
>>   		ena_reorder_rss_hash_key(hw_rss_key, rss_conf->rss_key,
> 
> I can see in some drivers configure() ops is not updated, I assume these
> are the ones don't have any RSS related config in it, it is not clear
> still to add check, but I guess what you are doing is reasonable, I am
> OK with this approach.
> .

It's true that these drivers support RSS configuration and check it in
their own setup function instead of in dev_configure ops.
Some drivers calls the setup function in dev_configure,
and some in dev_start. It's better to check the configuration in these
setup function for the latter case.
  

Patch

diff --git a/drivers/net/ena/ena_rss.c b/drivers/net/ena/ena_rss.c
index d0ba9d5c0a14..06aff9f3bd49 100644
--- a/drivers/net/ena/ena_rss.c
+++ b/drivers/net/ena/ena_rss.c
@@ -398,6 +398,9 @@  static int ena_rss_hash_set(struct ena_com_dev *ena_dev,
 	uint8_t *rss_key;
 	int rc;
 
+	if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+		return -EINVAL;
+
 	if (rss_conf->rss_key != NULL) {
 		/* Reorder the RSS key bytes for the hardware requirements. */
 		ena_reorder_rss_hash_key(hw_rss_key, rss_conf->rss_key,