Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/marvell Make all packets are enqueued into queue 0.



details:   https://anonhg.NetBSD.org/src/rev/66bfcc3ea915
branches:  trunk
changeset: 813685:66bfcc3ea915
user:      hikaru <hikaru%NetBSD.org@localhost>
date:      Sat Feb 13 08:05:06 2016 +0000

description:
Make all packets are enqueued into queue 0.
queue 7 is not default, it is caused by the filter tables.
The fields are including queue number, not bitfields.
So MVXPE_DF_QUEUE_ALL (b111) means queue 7.

And also, pass all unicast addresses if it is promisc mode.
MVXPE_PXC_UPM is working in almost cases,
but this change is needed for some cases; bridging frames through inter units,
using products have consecutive MAC addresses.

diffstat:

 sys/dev/marvell/if_mvxpe.c    |  39 +++++++++++++++++++++++++++++----------
 sys/dev/marvell/if_mvxpevar.h |   7 +++----
 2 files changed, 32 insertions(+), 14 deletions(-)

diffs (114 lines):

diff -r e6deb08a8582 -r 66bfcc3ea915 sys/dev/marvell/if_mvxpe.c
--- a/sys/dev/marvell/if_mvxpe.c        Sat Feb 13 06:44:22 2016 +0000
+++ b/sys/dev/marvell/if_mvxpe.c        Sat Feb 13 08:05:06 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_mvxpe.c,v 1.11 2016/02/13 06:44:22 hikaru Exp $     */
+/*     $NetBSD: if_mvxpe.c,v 1.12 2016/02/13 08:05:06 hikaru Exp $     */
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.11 2016/02/13 06:44:22 hikaru Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.12 2016/02/13 08:05:06 hikaru Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -924,6 +924,13 @@
 
        /* Port MAC Control set 4 is not used */
 
+       /* Port Configuration */
+       /* Use queue 0 only */
+       reg = MVXPE_READ(sc, MVXPE_PXC);
+       reg &= ~(MVXPE_PXC_RXQ_MASK | MVXPE_PXC_RXQARP_MASK |
+           MVXPE_PXC_TCPQ_MASK | MVXPE_PXC_UDPQ_MASK | MVXPE_PXC_BPDUQ_MASK);
+       MVXPE_WRITE(sc, MVXPE_PXC, reg);
+
        /* Port Configuration Extended: enable Tx CRC generation */
        reg = MVXPE_READ(sc, MVXPE_PXCX);
        reg &= ~MVXPE_PXCX_TXCRCDIS;
@@ -2717,11 +2724,11 @@
                if (memcmp(enm->enm_addrlo, special, 5) == 0) {
                        i = enm->enm_addrlo[5];
                        dfsmt[i>>2] |=
-                           MVXPE_DF(i&3, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS);
+                           MVXPE_DF(i&3, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS);
                } else {
                        i = mvxpe_crc8(enm->enm_addrlo, ETHER_ADDR_LEN);
                        dfomt[i>>2] |=
-                           MVXPE_DF(i&3, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS);
+                           MVXPE_DF(i&3, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS);
                }
 
                ETHER_NEXT_MULTI(step, enm);
@@ -2732,10 +2739,10 @@
        if (ifp->if_flags & (IFF_ALLMULTI|IFF_PROMISC)) {
                for (i = 0; i < MVXPE_NDFSMT; i++) {
                        dfsmt[i] = dfomt[i] = 
-                           MVXPE_DF(0, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS) |
-                           MVXPE_DF(1, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS) |
-                           MVXPE_DF(2, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS) |
-                           MVXPE_DF(3, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS);
+                           MVXPE_DF(0, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) |
+                           MVXPE_DF(1, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) |
+                           MVXPE_DF(2, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) |
+                           MVXPE_DF(3, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS);
                }
        }
 
@@ -2752,8 +2759,20 @@
        MVXPE_WRITE(sc, MVXPE_PXC, pxc);
 
        /* Set Destination Address Filter Unicast Table */
-       i = sc->sc_enaddr[5] & 0xf;             /* last nibble */
-       dfut[i>>2] = MVXPE_DF(i&3, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS);
+       if (ifp->if_flags & IFF_PROMISC) {
+               /* pass all unicast addresses */
+               for (i = 0; i < MVXPE_NDFUT; i++) {
+                       dfut[i] =
+                           MVXPE_DF(0, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) |
+                           MVXPE_DF(1, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) |
+                           MVXPE_DF(2, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) |
+                           MVXPE_DF(3, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS);
+               }
+       }
+       else {
+               i = sc->sc_enaddr[5] & 0xf;             /* last nibble */
+               dfut[i>>2] = MVXPE_DF(i&3, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS);
+       }
        MVXPE_WRITE_REGION(sc, MVXPE_DFUT(0), dfut, MVXPE_NDFUT);
 
        /* Set Destination Address Filter Multicast Tables */
diff -r e6deb08a8582 -r 66bfcc3ea915 sys/dev/marvell/if_mvxpevar.h
--- a/sys/dev/marvell/if_mvxpevar.h     Sat Feb 13 06:44:22 2016 +0000
+++ b/sys/dev/marvell/if_mvxpevar.h     Sat Feb 13 08:05:06 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_mvxpevar.h,v 1.2 2015/06/03 03:55:47 hsuenaga Exp $ */
+/*     $NetBSD: if_mvxpevar.h,v 1.3 2016/02/13 08:05:06 hikaru Exp $   */
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -40,18 +40,17 @@
  * Default limit of queue length
  *
  * queue 0 is lowest priority and queue 7 is highest priority.
- * IP packet is received on queue 7 by default.
  *
  * XXX: packet classifier is not implement yet
  */
-#define MVXPE_RX_QUEUE_LIMIT_0 8
+#define MVXPE_RX_QUEUE_LIMIT_0 IFQ_MAXLEN
 #define MVXPE_RX_QUEUE_LIMIT_1 8
 #define MVXPE_RX_QUEUE_LIMIT_2 8
 #define MVXPE_RX_QUEUE_LIMIT_3 8
 #define MVXPE_RX_QUEUE_LIMIT_4 8
 #define MVXPE_RX_QUEUE_LIMIT_5 8
 #define MVXPE_RX_QUEUE_LIMIT_6 8
-#define MVXPE_RX_QUEUE_LIMIT_7 IFQ_MAXLEN
+#define MVXPE_RX_QUEUE_LIMIT_7 8
 
 #define MVXPE_TX_QUEUE_LIMIT_0 IFQ_MAXLEN
 #define MVXPE_TX_QUEUE_LIMIT_1 8



Home | Main Index | Thread Index | Old Index