Index: head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c =================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c @@ -396,7 +396,7 @@ goto failure; } - error = ifp->if_snd_tag_alloc(ifp, &rl_params, &ptag->rl_tag); + error = m_snd_tag_alloc(ifp, &rl_params, &ptag->rl_tag); if (error) goto failure; Index: head/sys/kern/kern_mbuf.c =================================================================== --- head/sys/kern/kern_mbuf.c +++ head/sys/kern/kern_mbuf.c @@ -1525,6 +1525,16 @@ mb = m_free(mb); } +int +m_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, + struct m_snd_tag **mstp) +{ + + if (ifp->if_snd_tag_alloc == NULL) + return (EOPNOTSUPP); + return (ifp->if_snd_tag_alloc(ifp, params, mstp)); +} + void m_snd_tag_init(struct m_snd_tag *mst, struct ifnet *ifp, u_int type) { Index: head/sys/kern/uipc_ktls.c =================================================================== --- head/sys/kern/uipc_ktls.c +++ head/sys/kern/uipc_ktls.c @@ -834,10 +834,6 @@ params.hdr.numa_domain = inp->inp_numa_domain; INP_RUNLOCK(inp); - if (ifp->if_snd_tag_alloc == NULL) { - error = EOPNOTSUPP; - goto out; - } if ((ifp->if_capenable & IFCAP_NOMAP) == 0) { error = EOPNOTSUPP; goto out; @@ -853,7 +849,7 @@ goto out; } } - error = ifp->if_snd_tag_alloc(ifp, ¶ms, mstp); + error = m_snd_tag_alloc(ifp, ¶ms, mstp); out: if_rele(ifp); return (error); Index: head/sys/net/if_lagg.c =================================================================== --- head/sys/net/if_lagg.c +++ head/sys/net/if_lagg.c @@ -1808,7 +1808,7 @@ LAGG_RUNLOCK(); return (EOPNOTSUPP); } - if (lp->lp_ifp == NULL || lp->lp_ifp->if_snd_tag_alloc == NULL) { + if (lp->lp_ifp == NULL) { LAGG_RUNLOCK(); return (EOPNOTSUPP); } @@ -1822,7 +1822,7 @@ return (ENOMEM); } - error = lp_ifp->if_snd_tag_alloc(lp_ifp, params, &lst->tag); + error = m_snd_tag_alloc(lp_ifp, params, &lst->tag); if_rele(lp_ifp); if (error) { free(lst, M_LAGG); Index: head/sys/net/if_vlan.c =================================================================== --- head/sys/net/if_vlan.c +++ head/sys/net/if_vlan.c @@ -2047,7 +2047,7 @@ parent = PARENT(ifv); else parent = NULL; - if (parent == NULL || parent->if_snd_tag_alloc == NULL) { + if (parent == NULL) { NET_EPOCH_EXIT(et); return (EOPNOTSUPP); } @@ -2060,7 +2060,7 @@ return (ENOMEM); } - error = parent->if_snd_tag_alloc(parent, params, &vst->tag); + error = m_snd_tag_alloc(parent, params, &vst->tag); if_rele(parent); if (error) { free(vst, M_VLAN); Index: head/sys/netinet/in_pcb.c =================================================================== --- head/sys/netinet/in_pcb.c +++ head/sys/netinet/in_pcb.c @@ -3330,19 +3330,14 @@ if (*st != NULL) return (EINVAL); - if (ifp->if_snd_tag_alloc == NULL) { - error = EOPNOTSUPP; - } else { - error = ifp->if_snd_tag_alloc(ifp, ¶ms, st); - + error = m_snd_tag_alloc(ifp, ¶ms, st); #ifdef INET - if (error == 0) { - counter_u64_add(rate_limit_set_ok, 1); - counter_u64_add(rate_limit_active, 1); - } else - counter_u64_add(rate_limit_alloc_fail, 1); + if (error == 0) { + counter_u64_add(rate_limit_set_ok, 1); + counter_u64_add(rate_limit_active, 1); + } else if (error != EOPNOTSUPP) + counter_u64_add(rate_limit_alloc_fail, 1); #endif - } return (error); } Index: head/sys/netinet/tcp_ratelimit.c =================================================================== --- head/sys/netinet/tcp_ratelimit.c +++ head/sys/netinet/tcp_ratelimit.c @@ -464,18 +464,14 @@ .rate_limit.flags = M_NOWAIT, }; - if (ifp->if_snd_tag_alloc == NULL) { - error = EOPNOTSUPP; - } else { - error = ifp->if_snd_tag_alloc(ifp, ¶ms, tag); + error = m_snd_tag_alloc(ifp, ¶ms, tag); #ifdef INET - if (error == 0) { - counter_u64_add(rate_limit_set_ok, 1); - counter_u64_add(rate_limit_active, 1); - } else - counter_u64_add(rate_limit_alloc_fail, 1); + if (error == 0) { + counter_u64_add(rate_limit_set_ok, 1); + counter_u64_add(rate_limit_active, 1); + } else if (error != EOPNOTSUPP) + counter_u64_add(rate_limit_alloc_fail, 1); #endif - } return (error); } @@ -1014,13 +1010,7 @@ #else params.rate_limit.hdr.flowtype = M_HASHTYPE_OPAQUE_HASH; #endif - tag = NULL; - if (ifp->if_snd_tag_alloc) { - if (error) - *error = ENODEV; - return (NULL); - } - err = ifp->if_snd_tag_alloc(ifp, ¶ms, &tag); + err = m_snd_tag_alloc(ifp, ¶ms, &tag); if (err) { /* Failed to setup a tag? */ if (error) Index: head/sys/sys/mbuf.h =================================================================== --- head/sys/sys/mbuf.h +++ head/sys/sys/mbuf.h @@ -754,6 +754,7 @@ #define MBUF_EXTPGS_MEM_NAME "mbuf_extpgs" #ifdef _KERNEL +union if_snd_tag_alloc_params; #ifdef WITNESS #define MBUF_CHECKSLEEP(how) do { \ @@ -834,6 +835,8 @@ struct mbuf *m_split(struct mbuf *, int, int); struct mbuf *m_uiotombuf(struct uio *, int, int, int, int); struct mbuf *m_unshare(struct mbuf *, int); +int m_snd_tag_alloc(struct ifnet *, + union if_snd_tag_alloc_params *, struct m_snd_tag **); void m_snd_tag_init(struct m_snd_tag *, struct ifnet *, u_int); void m_snd_tag_destroy(struct m_snd_tag *);