[panic] netmap(4) and if_lagg(4)
Vincenzo Maffione
v.maffione at gmail.com
Fri May 26 08:42:01 UTC 2017
Ok, so you should try to completely replace the code in your /usr/src/sys
with the code in the upstream netmap repository
https://github.com/luigirizzo/netmap (sys directory).
2017-05-26 10:38 GMT+02:00 Harry Schmalzbauer <freebsd at omnilan.de>:
> 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
>
--
Vincenzo Maffione
More information about the freebsd-net
mailing list