mirror of
https://github.com/opnsense/src.git
synced 2026-04-22 14:49:36 -04:00
ifcapnv: fix IFCAP2 usage
IFCAP2_XXX constants are integers, they do not need shift for the definition. But their usage as bitmask for if_capenable2 does require shift. Add convenience macro IFCAP2_BIT() for consumers. Fix the only existing consumer, mlx5(4) RXTLS enable bits. Reported by: jhb Reviewed by: jhb, jhibbits, hselasky Coverity CID: 1501659 Sponsored by: NVIDIA networking Differential revision: https://reviews.freebsd.org/D37862
This commit is contained in:
parent
17edacfb6e
commit
01143ba118
2 changed files with 10 additions and 8 deletions
|
|
@ -3664,10 +3664,10 @@ siocsifcap_driver:
|
|||
}
|
||||
}
|
||||
mask = drv_ioctl_data->reqcap2 ^ ifp->if_capenable2;
|
||||
if (mask & IFCAP2_RXTLS4)
|
||||
ifp->if_capenable2 ^= IFCAP2_RXTLS4;
|
||||
if (mask & IFCAP2_RXTLS6)
|
||||
ifp->if_capenable2 ^= IFCAP2_RXTLS6;
|
||||
if ((mask & IFCAP2_BIT(IFCAP2_RXTLS4)) != 0)
|
||||
ifp->if_capenable2 ^= IFCAP2_BIT(IFCAP2_RXTLS4);
|
||||
if ((mask & IFCAP2_BIT(IFCAP2_RXTLS6)) != 0)
|
||||
ifp->if_capenable2 ^= IFCAP2_BIT(IFCAP2_RXTLS6);
|
||||
out:
|
||||
PRIV_UNLOCK(priv);
|
||||
break;
|
||||
|
|
@ -4550,7 +4550,8 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev)
|
|||
ifp->if_capabilities |= IFCAP_TXRTLMT | IFCAP_TXTLS_RTLMT;
|
||||
#endif
|
||||
ifp->if_capabilities |= IFCAP_VXLAN_HWCSUM | IFCAP_VXLAN_HWTSO;
|
||||
ifp->if_capabilities2 |= IFCAP2_RXTLS4 | IFCAP2_RXTLS6;
|
||||
ifp->if_capabilities2 |= IFCAP2_BIT(IFCAP2_RXTLS4) |
|
||||
IFCAP2_BIT(IFCAP2_RXTLS6);
|
||||
ifp->if_snd_tag_alloc = mlx5e_snd_tag_alloc;
|
||||
#ifdef RATELIMIT
|
||||
ifp->if_ratelimit_query = mlx5e_ratelimit_query;
|
||||
|
|
|
|||
|
|
@ -255,8 +255,10 @@ struct if_data {
|
|||
#define IFCAP_TXTLS_RTLMT 0x80000000 /* can do TLS with rate limiting */
|
||||
|
||||
/* IFCAP2_* are integers, not bits. */
|
||||
#define IFCAP2_RXTLS4 (0x00001ULL << 32)
|
||||
#define IFCAP2_RXTLS6 (0x00002ULL << 32)
|
||||
#define IFCAP2_RXTLS4 0
|
||||
#define IFCAP2_RXTLS6 1
|
||||
|
||||
#define IFCAP2_BIT(x) (1UL << (x))
|
||||
|
||||
#define IFCAP_HWCSUM_IPV6 (IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6)
|
||||
|
||||
|
|
@ -265,7 +267,6 @@ struct if_data {
|
|||
#define IFCAP_WOL (IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | IFCAP_WOL_MAGIC)
|
||||
#define IFCAP_TOE (IFCAP_TOE4 | IFCAP_TOE6)
|
||||
#define IFCAP_TXTLS (IFCAP_TXTLS4 | IFCAP_TXTLS6)
|
||||
#define IFCAP2_RXTLS (IFCAP2_RXTLS4 | IFCAP2_RXTLS6)
|
||||
|
||||
#define IFCAP_CANTCHANGE (IFCAP_NETMAP | IFCAP_NV)
|
||||
#define IFCAP_ALLCAPS 0xffffffff
|
||||
|
|
|
|||
Loading…
Reference in a new issue