mcx(4) is almost ready to enable RSS, except arm64 doesn't yet support
mapping interrupts to cpus.  Until that's in place, here's a diff with the
missing pieces from the driver in case anyone wants to test.  This will
enable up to 8 rx/tx queues, depending on the number of cpus available.


Index: if_mcx.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_mcx.c,v
retrieving revision 1.64
diff -u -p -r1.64 if_mcx.c
--- if_mcx.c    14 Jul 2020 04:10:18 -0000      1.64
+++ if_mcx.c    14 Jul 2020 04:49:36 -0000
@@ -33,6 +33,7 @@
 #include <sys/timeout.h>
 #include <sys/task.h>
 #include <sys/atomic.h>
+#include <sys/intrmap.h>
 
 #include <machine/bus.h>
 #include <machine/intr.h>
@@ -83,7 +84,7 @@
 #define MCX_LOG_RQ_SIZE                        10
 #define MCX_LOG_SQ_SIZE                        11
 
-#define MCX_MAX_QUEUES                 1
+#define MCX_MAX_QUEUES                 8
 
 /* completion event moderation - about 10khz, or 90% of the cq */
 #define MCX_CQ_MOD_PERIOD              50
@@ -2331,6 +2332,7 @@ struct mcx_softc {
        unsigned int             sc_calibration_gen;
        struct timeout           sc_calibrate;
 
+       struct intrmap          *sc_intrmap;
        struct mcx_queues        sc_queues[MCX_MAX_QUEUES];
        unsigned int             sc_nqueues;
 
@@ -2716,7 +2718,11 @@ mcx_attach(struct device *parent, struct
            ether_sprintf(sc->sc_ac.ac_enaddr));
 
        msix = pci_intr_msix_count(pa->pa_pc, pa->pa_tag);
-       sc->sc_nqueues = 1;
+       sc->sc_intrmap = intrmap_create(&sc->sc_dev, msix, MCX_MAX_QUEUES,
+           INTRMAP_POWEROF2);
+       sc->sc_nqueues = intrmap_count(sc->sc_intrmap);
+       KASSERT(sc->sc_nqueues > 0);
+       KASSERT(powerof2(sc->sc_nqueues));
 
        strlcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ);
        ifp->if_softc = sc;
@@ -2786,8 +2792,9 @@ mcx_attach(struct device *parent, struct
                }
                snprintf(q->q_name, sizeof(q->q_name), "%s:%d",
                    DEVNAME(sc), i);
-               q->q_ihc = pci_intr_establish(sc->sc_pc, ih,
-                   IPL_NET | IPL_MPSAFE, mcx_cq_intr, q, q->q_name);
+               q->q_ihc = pci_intr_establish_cpu(sc->sc_pc, ih,
+                   IPL_NET | IPL_MPSAFE, intrmap_cpu(sc->sc_intrmap, i),
+                   mcx_cq_intr, q, q->q_name);
        }
 
        timeout_set(&sc->sc_calibrate, mcx_calibrate, sc);
Index: files.pci
===================================================================
RCS file: /cvs/src/sys/dev/pci/files.pci,v
retrieving revision 1.350
diff -u -p -r1.350 files.pci
--- files.pci   14 Jul 2020 04:10:18 -0000      1.350
+++ files.pci   14 Jul 2020 04:49:36 -0000
@@ -831,7 +831,7 @@ attach      bnxt at pci
 file   dev/pci/if_bnxt.c               bnxt
 
 # Mellanox ConnectX-4 and later
-device  mcx: ether, ifnet, ifmedia, stoeplitz
+device  mcx: ether, ifnet, ifmedia, stoeplitz, intrmap
 attach  mcx at pci
 file    dev/pci/if_mcx.c                mcx
 

Reply via email to