Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Enable checksum offload features by default.



details:   https://anonhg.NetBSD.org/src/rev/32cf5ca8de84
branches:  trunk
changeset: 1023814:32cf5ca8de84
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Sep 26 20:14:07 2021 +0000

description:
Enable checksum offload features by default.

diffstat:

 sys/dev/pci/if_mcx.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (39 lines):

diff -r 552323fa94bb -r 32cf5ca8de84 sys/dev/pci/if_mcx.c
--- a/sys/dev/pci/if_mcx.c      Sun Sep 26 20:12:37 2021 +0000
+++ b/sys/dev/pci/if_mcx.c      Sun Sep 26 20:14:07 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_mcx.c,v 1.21 2021/09/26 15:01:55 jmcneill Exp $ */
+/*     $NetBSD: if_mcx.c,v 1.22 2021/09/26 20:14:07 jmcneill Exp $ */
 /*     $OpenBSD: if_mcx.c,v 1.101 2021/06/02 19:16:11 patrick Exp $ */
 
 /*
@@ -23,7 +23,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.21 2021/09/26 15:01:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.22 2021/09/26 20:14:07 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2743,6 +2743,7 @@
        struct mcx_softc *sc = device_private(self);
        struct ifnet *ifp = &sc->sc_ec.ec_if;
        struct pci_attach_args *pa = aux;
+       struct ifcapreq ifcr;
        uint8_t enaddr[ETHER_ADDR_LEN];
        int counts[PCI_INTR_TYPE_SIZE];
        char intrxname[32];
@@ -2993,6 +2994,12 @@
        ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO);
 
        if_attach(ifp);
+
+       /* Enable hardware offload by default */
+       memset(&ifcr, 0, sizeof(ifcr));
+       ifcr.ifcr_capenable = ifp->if_capabilities;
+       ifioctl_common(ifp, SIOCSIFCAP, &ifcr);
+
        if_deferred_start_init(ifp, NULL);
 
        ether_ifattach(ifp, enaddr);



Home | Main Index | Thread Index | Old Index