if_atsam: Support IFCAP_VLAN_HWTAGGING

This is required to enable checksum offload for vlan interfaces.

Update #4651.
This commit is contained in:
Sebastian Huber 2022-05-10 07:49:32 +02:00
parent 204a4873d7
commit 245ca940bb

View File

@ -685,6 +685,18 @@ if_atsam_transmit(struct ifnet *ifp, struct mbuf *m)
struct if_atsam_softc *sc; struct if_atsam_softc *sc;
int error; int error;
if (__predict_false((m->m_flags & M_VLANTAG) != 0)) {
struct mbuf *n;
n = ether_vlanencap(m, m->m_pkthdr.ether_vtag);
if (n == NULL) {
m_freem(m);
return (ENOBUFS);
}
m = n;
}
sc = ifp->if_softc; sc = ifp->if_softc;
IF_ATSAM_LOCK(sc); IF_ATSAM_LOCK(sc);
@ -1423,7 +1435,7 @@ static int if_atsam_driver_attach(device_t dev)
ifp->if_qflush = if_qflush; ifp->if_qflush = if_qflush;
ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST | IFF_SIMPLEX; ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST | IFF_SIMPLEX;
ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6 | ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6 |
IFCAP_VLAN_HWCSUM; IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTAGGING;
ifp->if_capenable = ifp->if_capabilities; ifp->if_capenable = ifp->if_capabilities;
ifp->if_hwassist = CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP | ifp->if_hwassist = CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP |
CSUM_IP6_UDP | CSUM_IP6_TCP; CSUM_IP6_UDP | CSUM_IP6_TCP;