Date: Thu, 5 Jul 2012 08:24:22 +1200 From: Andrew Thompson <thompsa@FreeBSD.org> To: Vyacheslav Kulikovskyy <coolsysop@gmail.com> Cc: freebsd-net@freebsd.org Subject: Re: lagg speed trouble Message-ID: <CAFAOGNR7cz5se8xF0i4ruxxOzp6R3oW%2BPH0=cxZWfLit-g-M6A@mail.gmail.com> In-Reply-To: <CABj7HZ8dnbpwhgpQ9pE=M2xJh_LFp2oYdPqvXke0GF%2B4rt7sgg@mail.gmail.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
On 4 July 2012 23:30, Vyacheslav Kulikovskyy <coolsysop@gmail.com> wrote:
> i have sever with two 1G links (em) aggregated by lagg0
>
> after 1700Megabits i have collisions/errors on lagg0 port, but not on em0
> or em1
>
> I'm using nginx in own CDN. and server don't limited my mbufs, irq, or
> anything else.. only lagg0 errors (
> netstat -w 1 -I lagg0
> input (lagg0) output
> packets errs idrops bytes packets errs bytes colls
> 87964 0 0 5474019 78172 1964 222220549 0
> 88842 0 0 5533987 78852 1811 222578109 0
> 87687 0 0 5454717 77279 2416 222286391 0
> 87995 0 0 5471653 78090 2040 223488046 0
> 88314 0 0 5493348 78495 1994 222548964 0
> 88411 0 0 5502818 78228 1949 222214374 0
>
> how i can get full link speed on this server?
This probably means the packet could not be queued on the lagg
interface send queue. Please try this patch.
Andrew
[-- Attachment #2 --]
Index: if_lagg.c
===================================================================
--- if_lagg.c (revision 238047)
+++ if_lagg.c (working copy)
@@ -110,7 +110,8 @@ static int lagg_ether_cmdmulti(struct lagg_port *,
static int lagg_setflag(struct lagg_port *, int, int,
int (*func)(struct ifnet *, int));
static int lagg_setflags(struct lagg_port *, int status);
-static void lagg_start(struct ifnet *);
+static int lagg_transmit(struct ifnet *ifp, struct mbuf *m);
+static void lagg_qflush(struct ifnet *ifp);
static int lagg_media_change(struct ifnet *);
static void lagg_media_status(struct ifnet *, struct ifmediareq *);
static struct lagg_port *lagg_link_active(struct lagg_softc *,
@@ -312,15 +313,12 @@ lagg_clone_create(struct if_clone *ifc, int unit,
if_initname(ifp, ifc->ifc_name, unit);
ifp->if_type = IFT_ETHER;
ifp->if_softc = sc;
- ifp->if_start = lagg_start;
+ ifp->if_transmit = lagg_transmit;
+ ifp->if_qflush = lagg_qflush;
ifp->if_init = lagg_init;
ifp->if_ioctl = lagg_ioctl;
ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST;
- IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
- ifp->if_snd.ifq_drv_maxlen = ifqmaxlen;
- IFQ_SET_READY(&ifp->if_snd);
-
/*
* Attach as an ordinary ethernet device, childs will be attached
* as special device IFT_IEEE8023ADLAG.
@@ -1222,37 +1220,44 @@ lagg_setflags(struct lagg_port *lp, int status)
return (0);
}
-static void
-lagg_start(struct ifnet *ifp)
+static int
+lagg_transmit(struct ifnet *ifp, struct mbuf *m)
{
struct lagg_softc *sc = (struct lagg_softc *)ifp->if_softc;
- struct mbuf *m;
- int error = 0;
+ int error, len, mcast;
LAGG_RLOCK(sc);
/* We need a Tx algorithm and at least one port */
if (sc->sc_proto == LAGG_PROTO_NONE || sc->sc_count == 0) {
- IF_DRAIN(&ifp->if_snd);
+ m_freem(m);
LAGG_RUNLOCK(sc);
- return;
+ return (0);
}
- for (;; error = 0) {
- IFQ_DEQUEUE(&ifp->if_snd, m);
- if (m == NULL)
- break;
+ len = m->m_pkthdr.len;
+ mcast = (m->m_flags & (M_MCAST | M_BCAST)) ? 1 : 0;
+ ETHER_BPF_MTAP(ifp, m);
- ETHER_BPF_MTAP(ifp, m);
+ error = (*sc->sc_start)(sc, m);
+ if (error == 0) {
+ ifp->if_opackets++;
+ ifp->if_omcasts += mcast;
+ ifp->if_obytes += len;
+ } else
+ ifp->if_oerrors++;
+ LAGG_RUNLOCK(sc);
- error = (*sc->sc_start)(sc, m);
- if (error == 0)
- ifp->if_opackets++;
- else
- ifp->if_oerrors++;
- }
- LAGG_RUNLOCK(sc);
+ return (error);
}
+/*
+ * The ifp->if_qflush entry point for lagg(4) is a no-op.
+ */
+static void
+lagg_qflush(struct ifnet *ifp __unused)
+{
+}
+
static struct mbuf *
lagg_input(struct ifnet *ifp, struct mbuf *m)
{
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFAOGNR7cz5se8xF0i4ruxxOzp6R3oW%2BPH0=cxZWfLit-g-M6A>
