Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F103269674
D540.id976.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D540.id976.diff
View Options
Index: share/man/man4/lagg.4
===================================================================
--- share/man/man4/lagg.4
+++ share/man/man4/lagg.4
@@ -1,6 +1,7 @@
.\" $OpenBSD: trunk.4,v 1.18 2006/06/09 13:53:34 jmc Exp $
.\"
.\" Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org>
+.\" Copyright (c) 2014 Marcelo Araujo <araujo@FreeBSD.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
@@ -110,9 +111,12 @@
The hash includes the Ethernet source and destination address, and, if
available, the VLAN tag, and the IP source and destination address.
.It Ic roundrobin
-Distributes outgoing traffic using a round-robin scheduler
-through all active ports and accepts incoming traffic from
-any active port.
+Distributes outgoing traffic using a round-robin scheduler through all active
+ports and accepts incoming traffic from any active port.
+This mode can cause unordered packet arrival at the client. This has a side
+effect of limiting the throughput as reordering packets can be CPU intensive
+on the client.
+Requires a switch which supports IEEE 802.3ad static link aggregation.
.It Ic none
This protocol is intended to do nothing: it disables any traffic without
disabling the
@@ -149,6 +153,14 @@
The default for new interfaces is set via the
.Va net.link.lagg.default_use_flowid
.Xr sysctl 8 .
+.Pp
+Additionally, the
+.Ic roundrobin
+mode can have the number of packets sent per interface fine tuned via
+.Va net.link.lagg.rr_packets
+.Xr sysctl 8 .
+Its default value is 0, where only one packet will be send per interface
+every round.
.Sh EXAMPLES
Create a link aggregation using LACP with two
.Xr bge 4
Index: sys/net/if_lagg.h
===================================================================
--- sys/net/if_lagg.h
+++ sys/net/if_lagg.h
@@ -198,6 +198,7 @@
struct ifmedia sc_media; /* media config */
caddr_t sc_psc; /* protocol data */
uint32_t sc_seq; /* sequence counter */
+ uint32_t sc_bkt; /* packet bucket */
uint32_t sc_flags;
counter_u64_t sc_ipackets;
Index: sys/net/if_lagg.c
===================================================================
--- sys/net/if_lagg.c
+++ sys/net/if_lagg.c
@@ -3,6 +3,7 @@
/*
* Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org>
* Copyright (c) 2007 Andrew Thompson <thompsa@FreeBSD.org>
+ * Copyright (c) 2014 Marcelo Araujo <araujo@FreeBSD.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -187,6 +188,10 @@
SYSCTL_INT(_net_link_lagg, OID_AUTO, default_flowid_shift, CTLFLAG_RWTUN,
&def_flowid_shift, 0,
"Default setting for flowid shift for load sharing");
+static int lagg_rr_packets = 0; /* Default value for using rr_packets */
+SYSCTL_INT(_net_link_lagg, OID_AUTO, rr_packets, CTLFLAG_RW,
+ &lagg_rr_packets, 0,
+ "How many packets to be send per interface");
static int
lagg_modevent(module_t mod, int type, void *data)
@@ -1672,6 +1677,7 @@
sc->sc_port_create = NULL;
sc->sc_capabilities = IFCAP_LAGG_FULLDUPLEX;
sc->sc_seq = 0;
+ sc->sc_bkt = lagg_rr_packets;
return (0);
}
@@ -1688,9 +1694,21 @@
struct lagg_port *lp;
uint32_t p;
- p = atomic_fetchadd_32(&sc->sc_seq, 1);
+ if (sc->sc_bkt == 0)
+ sc->sc_bkt = lagg_rr_packets;
+
+ if (lagg_rr_packets > 1) {
+ atomic_subtract_int(&sc->sc_bkt, 1);
+ if (atomic_cmpset_int(&sc->sc_bkt, 0, lagg_rr_packets))
+ p = atomic_fetchadd_32(&sc->sc_seq, 1);
+ else
+ p = sc->sc_seq;
+ } else
+ p = atomic_fetchadd_32(&sc->sc_seq, 1);
+
p %= sc->sc_count;
lp = SLIST_FIRST(&sc->sc_ports);
+
while (p--)
lp = SLIST_NEXT(lp, lp_entries);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 9:14 PM (15 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14809516
Default Alt Text
D540.id976.diff (3 KB)
Attached To
Mode
D540: Set a better granularity and distribution on roundrobin protocol.
Attached
Detach File
Event Timeline
Log In to Comment