Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 May 2017 10:38:12 +0200
From:      Harry Schmalzbauer <freebsd@omnilan.de>
To:        Vincenzo Maffione <v.maffione@gmail.com>
Cc:        FreeBSD Net <freebsd-net@freebsd.org>
Subject:   Re: [panic] netmap(4) and if_lagg(4)
Message-ID:  <5927E974.6060706@omnilan.de>
In-Reply-To: <CA%2B_eA9j%2BN5-2om2DETe0K1sAUPqDgwuNuNbF2F9St6C-YCKWQg@mail.gmail.com>
References:  <58CBCD7A.8060301@omnilan.de> <CA%2B_eA9iCT7evWUcZMA_ViKfrZnSHp3OpBTS5c4iJ9=ZjO-Pfgw@mail.gmail.com> <58CC23F5.7060507@omnilan.de> <CA%2B_eA9iajZOUFsnWKdodN7zMvst8wn0xViM4xxEx%2B41jw_0B3g@mail.gmail.com> <58CFA394.8070901@omnilan.de> <CA%2B_eA9jf_VjcYUZynu5CXx-ps5z7PSxOky=QLpR-miqtxmMU5w@mail.gmail.com> <5926EE96.1010000@omnilan.de> <CA%2B_eA9gcMD1QyG35p5UY8kz6n1kF%2B56Arz3q1T8HVBfMv3XN0w@mail.gmail.com> <5926F9F9.4040706@omnilan.de> <CA%2B_eA9hripEStmfJhj_Q93OF5jFf2nfQXeuA2DnuSjBmJi6j4g@mail.gmail.com> <592701D6.7030301@omnilan.de> <592742A8.4010207@omnilan.de> <CA%2B_eA9jg-xXJpeyQkcFzA%2B-y=qbwROww2FRWzCN=dkmfkaQivQ@mail.gmail.com> <5927D560.10003@omnilan.de> <CA%2B_eA9jhDZ-Cnj8zyAcp=1dw=Q%2BZm2m%2BBkxK11x6Y%2BHLhX%2BrUg@mail.gmail.com> <5927D77A.60502@omnilan.de> <CA%2B_eA9j%2BN5-2om2DETe0K1sAUPqDgwuNuNbF2F9St6C-YCKWQg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Bezüglich Vincenzo Maffione's Nachricht vom 26.05.2017 09:31 (localtime):
> Is lagg0 the only interface attached to vale0?
> Is lagg0 aggregating a VLAN interface?
> 
> You can try this trivial patch
> 
> diff --git a/sys/dev/netmap/netmap_generic.c
> b/sys/dev/netmap/netmap_generic.c
> index f148b228..46a3c2c6 100644
> --- a/sys/dev/netmap/netmap_generic.c
> +++ b/sys/dev/netmap/netmap_generic.c
> @@ -950,6 +950,10 @@ generic_rx_handler(struct ifnet *ifp, struct mbuf *m)
>         u_int work_done;
>         u_int r = MBUF_RXQ(m); /* receive ring number */
>  
> +       if (!NM_NA_VALID(ifp)) {
> +               return 0;
> +       }
> +
>         if (r >= na->num_rx_rings) {
>                 r = r % na->num_rx_rings;
>         }

Unfortunately code base is too differing for me, since I absolutely
don't know what I'm doing here.
My resulting patch follows (combining this patch with the previous you
provided and adding NM_NA_VALID()), but there are unmatching macros
involved, which I have no idea about, so I'm not able to test this patch:
--- src/sys/dev/netmap/netmap_freebsd.c.orig    2017-05-25
20:36:29.744382000 +0200
+++ src/sys/dev/netmap/netmap_freebsd.c 2017-05-25 20:35:53.858843000 +0200
@@ -259,9 +259,10 @@
 void
 generic_find_num_queues(struct ifnet *ifp, u_int *txq, u_int *rxq)
 {
-       D("called, in txq %d rxq %d", *txq, *rxq);
-       *txq = netmap_generic_rings;
-       *rxq = netmap_generic_rings;
+       u_int num_rings = netmap_generic_rings ? netmap_generic_rings : 1;
+
+       *txq = num_rings;
+       *rxq = num_rings;
 }


--- src/sys/dev/netmap/netmap_kern.h.orig       2017-01-31
19:42:41.453502000 +0100
+++ src/sys/dev/netmap/netmap_kern.h    2017-05-26 10:08:17.128420000 +0200
@@ -1284,6 +1284,12 @@

 #endif /* linux */

+#define NM_NA_VALID(ifp) (NA(ifp) && \
+       ((uint32_t)(uintptr_t)NA(ifp) ^ NA(ifp)->magic) == NETMAP_MAGIC )
+
+       ((uint32_t)(uintptr_t)NA(ifp)) ^ NETMAP_MAGIC; \
+       } while(0)
+
 #ifdef __FreeBSD__

 /* Assigns the device IOMMU domain to an allocator.
--- src/sys/dev/netmap/netmap_generic.c.orig    2017-01-31
19:42:41.452980000 +0100
+++ src/sys/dev/netmap/netmap_generic.c 2017-05-26 09:55:21.265066000 +0200
@@ -625,6 +625,10 @@
        u_int work_done;
        u_int rr = MBUF_RXQ(m); // receive ring number

+       if (!NM_NA_VALID(ifp)) {
+               return;
+       }
+
        if (rr >= na->num_rx_rings) {
                rr = rr % na->num_rx_rings; // XXX expensive...
        }

In file included from
/usr/local/share/deploy-tools/RELENG_11/src/sys/modules/cxgbe/if_cxgbe/../../../dev/cxgbe/t4_netmap.c:52:
/usr/local/share/deploy-tools/RELENG_11/src/sys/dev/netmap/netmap_kern.h:1290:24:
error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
        ((uint32_t)(uintptr_t)NA(ifp)) ^ NETMAP_MAGIC; \
                              ^
/usr/local/share/deploy-tools/RELENG_11/src/sys/dev/netmap/netmap_kern.h:1254:20:
note: expanded from macro 'NA'
#define NA(_ifp)        ((struct netmap_adapter *)WNA(_ifp))
                          ^
/usr/local/share/deploy-tools/RELENG_11/src/sys/dev/netmap/netmap_kern.h:1290:27:
error: a parameter list without types is only allowed in a function
definition
        ((uint32_t)(uintptr_t)NA(ifp)) ^ NETMAP_MAGIC; \
                                 ^
/usr/local/share/deploy-tools/RELENG_11/src/sys/dev/netmap/netmap_kern.h:1290:24:
error: function cannot return function type 'int ()'
        ((uint32_t)(uintptr_t)NA(ifp)) ^ NETMAP_MAGIC; \
                              ^
/usr/local/share/deploy-tools/RELENG_11/src/sys/dev/netmap/netmap_kern.h:1254:19:
note: expanded from macro 'NA'
#define NA(_ifp)        ((struct netmap_adapter *)WNA(_ifp))
                         ^
/usr/local/share/deploy-tools/RELENG_11/src/sys/dev/netmap/netmap_kern.h:1290:24:
error: expected ')'
/usr/local/share/deploy-tools/RELENG_11/src/sys/dev/netmap/netmap_kern.h:1254:44:
note: expanded from macro 'NA'
#define NA(_ifp)        ((struct netmap_adapter *)WNA(_ifp))
                                                  ^
/usr/local/share/deploy-tools/RELENG_11/src/sys/dev/netmap/netmap_kern.h:90:25:
note: expanded from macro 'WNA'
#define WNA(_ifp)       (_ifp)->if_netmap
                              ^
/usr/local/share/deploy-tools/RELENG_11/src/sys/dev/netmap/netmap_kern.h:1290:24:
note: to match this '('
/usr/local/share/deploy-tools/RELENG_11/src/sys/dev/netmap/netmap_kern.h:1254:18:
note: expanded from macro 'NA'
#define NA(_ifp)        ((struct netmap_adapter *)WNA(_ifp))

thanks,

-harry



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5927E974.6060706>