On 10 January 2018 at 02:47, Martin Pieuchot <[email protected]> wrote:
>
>
>
> Here's a fixed diff, does it work for you?
>
> Index: net/if_vxlan.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if_vxlan.c,v
> retrieving revision 1.64
> diff -u -p -r1.64 if_vxlan.c
> --- net/if_vxlan.c      20 Nov 2017 10:35:24 -0000      1.64
> +++ net/if_vxlan.c      9 Jan 2018 15:41:23 -0000
> @@ -73,6 +73,8 @@ struct vxlan_softc {
>         int64_t                  sc_vnetid;
>         u_int8_t                 sc_ttl;
>
> +       struct task              sc_sendtask;
> +
>         LIST_ENTRY(vxlan_softc)  sc_entry;
>  };
>
> @@ -91,6 +93,7 @@ int    vxlan_output(struct ifnet *, struct
>  void    vxlan_addr_change(void *);
>  void    vxlan_if_change(void *);
>  void    vxlan_link_change(void *);
> +void    vxlan_send_dispatch(void *);
>
>  int     vxlan_sockaddr_cmp(struct sockaddr *, struct sockaddr *);
>  uint16_t vxlan_sockaddr_port(struct sockaddr *);
> @@ -135,6 +138,7 @@ vxlan_clone_create(struct if_clone *ifc,
>         sc->sc_imo.imo_max_memberships = IP_MIN_MEMBERSHIPS;
>         sc->sc_dstport = htons(VXLAN_PORT);
>         sc->sc_vnetid = VXLAN_VNI_UNSET;
> +       task_set(&sc->sc_sendtask, vxlan_send_dispatch, sc);
>
>         ifp = &sc->sc_ac.ac_if;
>         snprintf(ifp->if_xname, sizeof ifp->if_xname, "vxlan%d", unit);
> @@ -189,6 +193,10 @@ vxlan_clone_destroy(struct ifnet *ifp)
>         ifmedia_delete_instance(&sc->sc_media, IFM_INST_ANY);
>         ether_ifdetach(ifp);
>         if_detach(ifp);
> +
> +       if (!task_del(net_tq(ifp->if_index), &sc->sc_sendtask))
> +               taskq_barrier(net_tq(ifp->if_index));
> +
>         free(sc->sc_imo.imo_membership, M_IPMOPTS, 0);
>         free(sc, M_DEVBUF, sizeof(*sc));
>
> @@ -302,21 +310,43 @@ vxlan_multicast_join(struct ifnet *ifp,
>  void
>  vxlanstart(struct ifnet *ifp)
>  {
> +       struct vxlan_softc      *sc = (struct vxlan_softc *)ifp->if_softc;
> +
> +       task_add(net_tq(ifp->if_index), &sc->sc_sendtask);
> +}
> +
> +void
> +vxlan_send_dispatch(void *xsc)
> +{
> +       struct vxlan_softc      *sc = xsc;
> +       struct ifnet            *ifp = &sc->sc_ac.ac_if;
>         struct mbuf             *m;
> +       struct mbuf_list         ml;
>
> +       ml_init(&ml);
>         for (;;) {
>                 IFQ_DEQUEUE(&ifp->if_snd, m);
>                 if (m == NULL)
> -                       return;
> +                       break;
>
>  #if NBPFILTER > 0
>                 if (ifp->if_bpf)
>                         bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT);
>  #endif
>
> +               ml_enqueue(&ml, m);
> +       }
> +
> +       if (ml_empty(&ml))
> +               return;
> +
> +       NET_RLOCK();
> +       while ((m = ml_dequeue(&ml)) != NULL) {
>                 vxlan_output(ifp, m);
>         }
> +       NET_RUNLOCK();
>  }
> +
>
>  int
>  vxlan_config(struct ifnet *ifp, struct sockaddr *src, struct sockaddr
*dst)


Hi Martin,

I can confirm that the patch applied correctly:

# patch -p0 if_vxlan.c < /root/vxlan.txt
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: net/if_vxlan.c
|===================================================================
|RCS file: /cvs/src/sys/net/if_vxlan.c,v
|retrieving revision 1.64
|diff -u -p -r1.64 if_vxlan.c
|--- net/if_vxlan.c     20 Nov 2017 10:35:24 -0000      1.64
|+++ net/if_vxlan.c     9 Jan 2018 15:41:23 -0000
--------------------------
Patching file if_vxlan.c using Plan A...
Hunk #1 succeeded at 73.
Hunk #2 succeeded at 93.
Hunk #3 succeeded at 135 (offset -3 lines).
Hunk #4 succeeded at 190 (offset -3 lines).
Hunk #5 succeeded at 307 (offset -3 lines).
done

And all compiled ok.  The vxlan(4) interface now behaves correctly when
queuing is applied to the interface in pf.conf and we no longer get the
tracebacks like before while kern.splassert is still set to 2.  Below is
the output of running iperf across two vxlan interfaces that are
constrained to 5Mb/s each:

# grep queue /etc/pf.conf
queue vxqueue on vxlan1 bandwidth 2M, max 5M default

# iperf -c 10.2.2.1
------------------------------------------------------------
Client connecting to 10.2.2.1, TCP port 5001
TCP window size: 17.0 KByte (default)
------------------------------------------------------------
[  3] local 10.2.2.2 port 25895 connected with 10.2.2.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.2 sec  5.88 MBytes  4.83 Mbits/sec

# iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  4] local 10.2.2.2 port 5001 connected with 10.2.2.1 port 13866
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.3 sec  5.88 MBytes  4.78 Mbits/sec

As this is resolved, can you please apply this against -current?  Also
would it be possible to back port this fix to 6.2 for syspatch deployment
please (we have 6.1 hosts waiting on upgrades)?

Thank you again for getting this resolved.

Cheers,

Jason.

Reply via email to