[v5,13/40] net/ena: check RSS hash algorithms
Checks
Commit Message
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
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.
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.
@@ -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,