Re: git: 98f6f6e4f4bb - main - cxgbe(4): Enable IFCAP_NV and implement SIOCGIFCAPNV/SIOCSIFCAPNV
Date: Wed, 26 Nov 2025 13:06:45 UTC
I really wish we would have just expanded if capa to 64 bits. Having 2 sets of bits for caps is incredibly awkward and error prone. I'm reminded of that every time a driver is converted..
Drew
On Tue, Nov 25, 2025, at 4:17 PM, Navdeep Parhar wrote:
> The branch main has been updated by np:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=98f6f6e4f4bb7b19e12de89fc8cc034915f7a759
>
> commit 98f6f6e4f4bb7b19e12de89fc8cc034915f7a759
> Author: Navdeep Parhar <np@FreeBSD.org>
> AuthorDate: 2025-11-25 19:04:30 +0000
> Commit: Navdeep Parhar <np@FreeBSD.org>
> CommitDate: 2025-11-25 21:08:03 +0000
>
> cxgbe(4): Enable IFCAP_NV and implement SIOCGIFCAPNV/SIOCSIFCAPNV
>
> MFC after: 1 week
> Sponsored by: Chelsio Communications
> ---
> sys/dev/cxgbe/t4_main.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
> index 946eb84457a3..5e02b47da8d9 100644
> --- a/sys/dev/cxgbe/t4_main.c
> +++ b/sys/dev/cxgbe/t4_main.c
> @@ -2817,7 +2817,7 @@ cxgbe_probe(device_t dev)
> #define T4_CAP (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | \
> IFCAP_VLAN_HWCSUM | IFCAP_TSO | IFCAP_JUMBO_MTU | IFCAP_LRO | \
> IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE | IFCAP_HWCSUM_IPV6 | IFCAP_HWSTATS | \
> - IFCAP_HWRXTSTMP | IFCAP_MEXTPG)
> + IFCAP_HWRXTSTMP | IFCAP_MEXTPG | IFCAP_NV)
> #define T4_CAP_ENABLE (T4_CAP)
>
> static void
> @@ -3065,7 +3065,7 @@ cxgbe_ioctl(if_t ifp, unsigned long cmd, caddr_t data)
> struct port_info *pi = vi->pi;
> struct adapter *sc = pi->adapter;
> struct ifreq *ifr = (struct ifreq *)data;
> - uint32_t mask;
> + uint32_t mask, mask2;
>
> switch (cmd) {
> case SIOCSIFMTU:
> @@ -3124,12 +3124,24 @@ cxgbe_ioctl(if_t ifp, unsigned long cmd, caddr_t data)
> end_synchronized_op(sc, 0);
> break;
>
> + case SIOCGIFCAPNV:
> + break;
> + case SIOCSIFCAPNV:
> case SIOCSIFCAP:
> rc = begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4cap");
> if (rc)
> return (rc);
>
> - mask = ifr->ifr_reqcap ^ if_getcapenable(ifp);
> + if (cmd == SIOCSIFCAPNV) {
> + const struct siocsifcapnv_driver_data *ifr_nv =
> + (struct siocsifcapnv_driver_data *)data;
> +
> + mask = ifr_nv->reqcap ^ if_getcapenable(ifp);
> + mask2 = ifr_nv->reqcap2 ^ if_getcapenable2(ifp);
> + } else {
> + mask = ifr->ifr_reqcap ^ if_getcapenable(ifp);
> + mask2 = 0;
> + }
> if (mask & IFCAP_TXCSUM) {
> if_togglecapenable(ifp, IFCAP_TXCSUM);
> if_togglehwassist(ifp, CSUM_TCP | CSUM_UDP | CSUM_IP);
> @@ -3264,6 +3276,9 @@ cxgbe_ioctl(if_t ifp, unsigned long cmd, caddr_t data)
> CSUM_INNER_IP_TSO);
> }
>
> + MPASS(mask2 == 0);
> + (void)mask2;
> +
> #ifdef VLAN_CAPABILITIES
> VLAN_CAPABILITIES(ifp);
> #endif
>
>