Bug 255309

Summary: ice(4) driver doesn't use RSS option correctly
Product: Base System Reporter: Brian Poole <brian90013>
Component: kernAssignee: Mitchell Horne <mhorne>
Status: Closed FIXED    
Severity: Affects Only Me CC: erj, mhorne, net
Priority: --- Keywords: IntelNetworking
Version: 12.2-RELEASE   
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
patch to properly support rss option none

Description Brian Poole 2021-04-21 17:23:16 UTC
Created attachment 224335 [details]
patch to properly support rss option

Hello,

I am testing the Intel E810 NIC using the ice driver on both FreeBSD-12.2 and FreeBSD-13.0. During testing, I enabled the RSS kernel configuration option so the driver would use the system-wide standard RSS key instead of the custom ice key. I was surprised to see even after rebooting, the driver was still using the ice key.

My debugging led me to ice_lib.h where ice_rss.h is included. However, I don't believe there is a prior include of ice_opts.h, so when ice_rss.h is parsed, RSS is not defined causing ice-specific definitions to be used. I added ice_opts.h to the include list above ice_rss.h and re-compiled.

I hit a second problem within ice_rss.h where ICE_DEFAULT_RSS_HASH_CONFIG is only defined inside the !RSS block. I believe this is an oversight, probably hidden by the previous bug. That variable is used in ice_lib.c so it cannot depend on the state of the RSS option. Therefore, I moved the definition outside of the RSS/!RSS blocks.

With these two changes, in the included patch file, I observed the ice driver using RSS settings from the kernel, not ice-specific values. Looking at the FreeBSD-13.0 and HEAD branches, it looks like the same problems are present.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2021-05-11 14:59:06 UTC
^Triage: assign to correct mailing list.
^Triage: note that the "patch" keyword is obsolete (now inferred from attachment metadata).
Comment 2 Eric Joyner freebsd_committer freebsd_triage 2021-06-24 18:44:04 UTC
This patch looks valid to me. I'll get it in after this update: https://reviews.freebsd.org/D30888.
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2024-10-10 20:46:23 UTC
^Triage: committer's bit was taken into safekeeping.

To net@: is this PR still relevant?
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-11-04 15:02:38 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=6e5650896fe47398e49e3d81af60cc60dbb09e6e

commit 6e5650896fe47398e49e3d81af60cc60dbb09e6e
Author:     Brian Poole <brian90013@gmail.com>
AuthorDate: 2024-10-11 19:57:52 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-11-04 15:01:37 +0000

    ice(4): properly use kernel option RSS

    Header ice_rss.h uses the kernel RSS interface if option RSS is defined.
    However when ice_rss.h is included by ice_lib.h there is no prior
    inclusion of ice_opts.h to set RSS causing ifdef RSS to always fail. Add
    ice_opts.h to the top of ice_lib.h (like ice_iflib.h) so RSS can be
    defined when ice_rss.h is parsed.

    With that in place, compilation fails due to a missing defintion of
    ICE_DEFAULT_RSS_HASH_CONFIG. It is defined in ice_rss.h only when RSS is
    not defined. Since this define is not part of the kernel RSS interface
    but ice-specific, it should always be defined. Move its definition
    outside of ifdef RSS.

    PR:             255309
    Reviewed by:    mhorne, erj (earlier version)
    MFC after:      3 days
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1460

 sys/dev/ice/ice_lib.h |  3 +++
 sys/dev/ice/ice_rss.h | 16 ++++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2024-11-13 15:48:14 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=23173329b096499f818adaa35255c033e9ee78bc

commit 23173329b096499f818adaa35255c033e9ee78bc
Author:     Brian Poole <brian90013@gmail.com>
AuthorDate: 2024-10-11 19:57:52 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-11-13 15:47:28 +0000

    ice(4): properly use kernel option RSS

    Header ice_rss.h uses the kernel RSS interface if option RSS is defined.
    However when ice_rss.h is included by ice_lib.h there is no prior
    inclusion of ice_opts.h to set RSS causing ifdef RSS to always fail. Add
    ice_opts.h to the top of ice_lib.h (like ice_iflib.h) so RSS can be
    defined when ice_rss.h is parsed.

    With that in place, compilation fails due to a missing defintion of
    ICE_DEFAULT_RSS_HASH_CONFIG. It is defined in ice_rss.h only when RSS is
    not defined. Since this define is not part of the kernel RSS interface
    but ice-specific, it should always be defined. Move its definition
    outside of ifdef RSS.

    PR:             255309
    Reviewed by:    mhorne, erj (earlier version)
    MFC after:      3 days
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1460

    (cherry picked from commit 6e5650896fe47398e49e3d81af60cc60dbb09e6e)

 sys/dev/ice/ice_lib.h |  3 +++
 sys/dev/ice/ice_rss.h | 16 ++++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2024-11-13 15:50:16 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=2c6edd6dc94e7d429ce022262b9e25d159ce61e5

commit 2c6edd6dc94e7d429ce022262b9e25d159ce61e5
Author:     Brian Poole <brian90013@gmail.com>
AuthorDate: 2024-10-11 19:57:52 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-11-13 15:49:33 +0000

    ice(4): properly use kernel option RSS

    Header ice_rss.h uses the kernel RSS interface if option RSS is defined.
    However when ice_rss.h is included by ice_lib.h there is no prior
    inclusion of ice_opts.h to set RSS causing ifdef RSS to always fail. Add
    ice_opts.h to the top of ice_lib.h (like ice_iflib.h) so RSS can be
    defined when ice_rss.h is parsed.

    With that in place, compilation fails due to a missing defintion of
    ICE_DEFAULT_RSS_HASH_CONFIG. It is defined in ice_rss.h only when RSS is
    not defined. Since this define is not part of the kernel RSS interface
    but ice-specific, it should always be defined. Move its definition
    outside of ifdef RSS.

    PR:             255309
    Reviewed by:    mhorne, erj (earlier version)
    MFC after:      3 days
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1460

    (cherry picked from commit 6e5650896fe47398e49e3d81af60cc60dbb09e6e)

 sys/dev/ice/ice_lib.h |  3 +++
 sys/dev/ice/ice_rss.h | 16 ++++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)