| Summary: | [lagg] [patch] lagg/lacp broken when aggregated interfaces have same speed but different media type | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Josef Pojsl <jp> | ||||
| Component: | kern | Assignee: | Andrey V. Elsukov <ae> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 8.3-RELEASE | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
Responsible Changed From-To: freebsd-bugs->freebsd-net Over to maintainer(s). Author: ae Date: Thu Oct 17 15:14:58 2013 New Revision: 256689 URL: http://svnweb.freebsd.org/changeset/base/256689 Log: Use the same actor key for media types of the same speed. PR: 176097 MFC after: 2 weeks Modified: head/sys/net/ieee8023ad_lacp.c Modified: head/sys/net/ieee8023ad_lacp.c ============================================================================== --- head/sys/net/ieee8023ad_lacp.c Thu Oct 17 14:20:44 2013 (r256688) +++ head/sys/net/ieee8023ad_lacp.c Thu Oct 17 15:14:58 2013 (r256689) @@ -1089,8 +1089,45 @@ lacp_compose_key(struct lacp_port *lp) KASSERT(IFM_TYPE(media) == IFM_ETHER, ("invalid media type")); KASSERT((media & IFM_FDX) != 0, ("aggregating HDX interface")); - /* bit 0..4: IFM_SUBTYPE */ - key = subtype; + /* bit 0..4: IFM_SUBTYPE modulo speed */ + switch (subtype) { + case IFM_10_T: + case IFM_10_2: + case IFM_10_5: + case IFM_10_STP: + case IFM_10_FL: + key = IFM_10_T; + break; + case IFM_100_TX: + case IFM_100_FX: + case IFM_100_T4: + case IFM_100_VG: + case IFM_100_T2: + key = IFM_100_TX; + break; + case IFM_1000_SX: + case IFM_1000_LX: + case IFM_1000_CX: + case IFM_1000_T: + key = IFM_1000_SX; + break; + case IFM_10G_LR: + case IFM_10G_SR: + case IFM_10G_CX4: + case IFM_10G_TWINAX: + case IFM_10G_TWINAX_LONG: + case IFM_10G_LRM: + case IFM_10G_T: + key = IFM_10G_LR; + break; + case IFM_40G_CR4: + case IFM_40G_SR4: + case IFM_40G_LR4: + key = IFM_40G_CR4; + break; + default: + key = subtype; + } /* bit 5..14: (some bits of) if_index of lagg device */ key |= 0x7fe0 & ((sc->sc_ifp->if_index) << 5); /* bit 15: 0 */ _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" State Changed From-To: open->patched Committed in head/. Thanks! Responsible Changed From-To: freebsd-net->ae Take it. Author: ae Date: Mon Nov 11 09:47:51 2013 New Revision: 257956 URL: http://svnweb.freebsd.org/changeset/base/257956 Log: MFC r256689: Use the same actor key for media types of the same speed. PR: 176097 MFC r256832: Add a note that lacp_compose_key() should be updated, when new media types will be added. Submitted by: melifaro Approved by: re (hrs) Modified: stable/10/sys/net/ieee8023ad_lacp.c stable/10/sys/net/if_media.h Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/net/ieee8023ad_lacp.c ============================================================================== --- stable/10/sys/net/ieee8023ad_lacp.c Mon Nov 11 09:47:33 2013 (r257955) +++ stable/10/sys/net/ieee8023ad_lacp.c Mon Nov 11 09:47:51 2013 (r257956) @@ -1089,8 +1089,45 @@ lacp_compose_key(struct lacp_port *lp) KASSERT(IFM_TYPE(media) == IFM_ETHER, ("invalid media type")); KASSERT((media & IFM_FDX) != 0, ("aggregating HDX interface")); - /* bit 0..4: IFM_SUBTYPE */ - key = subtype; + /* bit 0..4: IFM_SUBTYPE modulo speed */ + switch (subtype) { + case IFM_10_T: + case IFM_10_2: + case IFM_10_5: + case IFM_10_STP: + case IFM_10_FL: + key = IFM_10_T; + break; + case IFM_100_TX: + case IFM_100_FX: + case IFM_100_T4: + case IFM_100_VG: + case IFM_100_T2: + key = IFM_100_TX; + break; + case IFM_1000_SX: + case IFM_1000_LX: + case IFM_1000_CX: + case IFM_1000_T: + key = IFM_1000_SX; + break; + case IFM_10G_LR: + case IFM_10G_SR: + case IFM_10G_CX4: + case IFM_10G_TWINAX: + case IFM_10G_TWINAX_LONG: + case IFM_10G_LRM: + case IFM_10G_T: + key = IFM_10G_LR; + break; + case IFM_40G_CR4: + case IFM_40G_SR4: + case IFM_40G_LR4: + key = IFM_40G_CR4; + break; + default: + key = subtype; + } /* bit 5..14: (some bits of) if_index of lagg device */ key |= 0x7fe0 & ((sc->sc_ifp->if_index) << 5); /* bit 15: 0 */ Modified: stable/10/sys/net/if_media.h ============================================================================== --- stable/10/sys/net/if_media.h Mon Nov 11 09:47:33 2013 (r257955) +++ stable/10/sys/net/if_media.h Mon Nov 11 09:47:51 2013 (r257956) @@ -153,7 +153,10 @@ uint64_t ifmedia_baudrate(int); #define IFM_40G_CR4 27 /* 40GBase-CR4 */ #define IFM_40G_SR4 28 /* 40GBase-SR4 */ #define IFM_40G_LR4 29 /* 40GBase-LR4 */ - +/* + * Please update ieee8023ad_lacp.c:lacp_compose_key() + * after adding new Ethernet media types. + */ /* note 31 is the max! */ #define IFM_ETH_MASTER 0x00000100 /* master mode (1000baseT) */ _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" Author: ae Date: Mon Nov 11 10:09:52 2013 New Revision: 257959 URL: http://svnweb.freebsd.org/changeset/base/257959 Log: MFC r256689: Use the same actor key for media types of the same speed. PR: 176097 MFC r256832: Add a note that lacp_compose_key() should be updated, when new media types will be added. Submitted by: melifaro Modified: stable/9/sys/net/ieee8023ad_lacp.c stable/9/sys/net/if_media.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/net/ (props changed) Modified: stable/9/sys/net/ieee8023ad_lacp.c ============================================================================== --- stable/9/sys/net/ieee8023ad_lacp.c Mon Nov 11 10:00:19 2013 (r257958) +++ stable/9/sys/net/ieee8023ad_lacp.c Mon Nov 11 10:09:52 2013 (r257959) @@ -1028,8 +1028,45 @@ lacp_compose_key(struct lacp_port *lp) KASSERT(IFM_TYPE(media) == IFM_ETHER, ("invalid media type")); KASSERT((media & IFM_FDX) != 0, ("aggregating HDX interface")); - /* bit 0..4: IFM_SUBTYPE */ - key = subtype; + /* bit 0..4: IFM_SUBTYPE modulo speed */ + switch (subtype) { + case IFM_10_T: + case IFM_10_2: + case IFM_10_5: + case IFM_10_STP: + case IFM_10_FL: + key = IFM_10_T; + break; + case IFM_100_TX: + case IFM_100_FX: + case IFM_100_T4: + case IFM_100_VG: + case IFM_100_T2: + key = IFM_100_TX; + break; + case IFM_1000_SX: + case IFM_1000_LX: + case IFM_1000_CX: + case IFM_1000_T: + key = IFM_1000_SX; + break; + case IFM_10G_LR: + case IFM_10G_SR: + case IFM_10G_CX4: + case IFM_10G_TWINAX: + case IFM_10G_TWINAX_LONG: + case IFM_10G_LRM: + case IFM_10G_T: + key = IFM_10G_LR; + break; + case IFM_40G_CR4: + case IFM_40G_SR4: + case IFM_40G_LR4: + key = IFM_40G_CR4; + break; + default: + key = subtype; + } /* bit 5..14: (some bits of) if_index of lagg device */ key |= 0x7fe0 & ((sc->sc_ifp->if_index) << 5); /* bit 15: 0 */ Modified: stable/9/sys/net/if_media.h ============================================================================== --- stable/9/sys/net/if_media.h Mon Nov 11 10:00:19 2013 (r257958) +++ stable/9/sys/net/if_media.h Mon Nov 11 10:09:52 2013 (r257959) @@ -153,7 +153,10 @@ uint64_t ifmedia_baudrate(int); #define IFM_40G_CR4 27 /* 40GBase-CR4 */ #define IFM_40G_SR4 28 /* 40GBase-SR4 */ #define IFM_40G_LR4 29 /* 40GBase-LR4 */ - +/* + * Please update ieee8023ad_lacp.c:lacp_compose_key() + * after adding new Ethernet media types. + */ /* note 31 is the max! */ #define IFM_ETH_MASTER 0x00000100 /* master mode (1000baseT) */ _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" State Changed From-To: patched->closed Merged to stable/9 and stable/10. Thanks! Author: ae Date: Mon Nov 11 10:38:37 2013 New Revision: 257960 URL: http://svnweb.freebsd.org/changeset/base/257960 Log: MFC r256689 (modified): Use the same actor key for media types of the same speed. PR: 176097 MFC r256832: Add a note that lacp_compose_key() should be updated, when new media types will be added. Submitted by: melifaro Modified: stable/8/sys/net/ieee8023ad_lacp.c stable/8/sys/net/if_media.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/net/ (props changed) Modified: stable/8/sys/net/ieee8023ad_lacp.c ============================================================================== --- stable/8/sys/net/ieee8023ad_lacp.c Mon Nov 11 10:09:52 2013 (r257959) +++ stable/8/sys/net/ieee8023ad_lacp.c Mon Nov 11 10:38:37 2013 (r257960) @@ -1028,8 +1028,40 @@ lacp_compose_key(struct lacp_port *lp) KASSERT(IFM_TYPE(media) == IFM_ETHER, ("invalid media type")); KASSERT((media & IFM_FDX) != 0, ("aggregating HDX interface")); - /* bit 0..4: IFM_SUBTYPE */ - key = subtype; + /* bit 0..4: IFM_SUBTYPE modulo speed */ + switch (subtype) { + case IFM_10_T: + case IFM_10_2: + case IFM_10_5: + case IFM_10_STP: + case IFM_10_FL: + key = IFM_10_T; + break; + case IFM_100_TX: + case IFM_100_FX: + case IFM_100_T4: + case IFM_100_VG: + case IFM_100_T2: + key = IFM_100_TX; + break; + case IFM_1000_SX: + case IFM_1000_LX: + case IFM_1000_CX: + case IFM_1000_T: + key = IFM_1000_SX; + break; + case IFM_10G_LR: + case IFM_10G_SR: + case IFM_10G_CX4: + case IFM_10G_TWINAX: + case IFM_10G_TWINAX_LONG: + case IFM_10G_LRM: + case IFM_10G_T: + key = IFM_10G_LR; + break; + default: + key = subtype; + } /* bit 5..14: (some bits of) if_index of lagg device */ key |= 0x7fe0 & ((sc->sc_ifp->if_index) << 5); /* bit 15: 0 */ Modified: stable/8/sys/net/if_media.h ============================================================================== --- stable/8/sys/net/if_media.h Mon Nov 11 10:09:52 2013 (r257959) +++ stable/8/sys/net/if_media.h Mon Nov 11 10:38:37 2013 (r257960) @@ -150,7 +150,10 @@ uint64_t ifmedia_baudrate(int); #define IFM_10G_LRM 24 /* 10GBase-LRM 850nm Multi-mode */ #define IFM_UNKNOWN 25 /* media types not defined yet */ #define IFM_10G_T 26 /* 10GBase-T - RJ45 */ - +/* + * Please update ieee8023ad_lacp.c:lacp_compose_key() + * after adding new Ethernet media types. + */ /* note 31 is the max! */ #define IFM_ETH_MASTER 0x00000100 /* master mode (1000baseT) */ _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" |
I have aggregated two interfaces with the same speed but slightly different type of media (namely 10Gbase-SR and 10Gbase-LR). There is a Cisco switch on the other side. LACP won't work as my FreeBSD box computes the actor key differently for the two interfaces. This is weird as LACP inists on the same speed but not on the exact same type of media. Cisco has no problem having one aggregated interface Short and the other Long Range. Outputs of ifconfig: [root@FW-C-02 /var/log]# ifconfig ix0 ix0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=401bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,VLAN_HWTSO> ether 90:e2:ba:26:3a:18 media: Ethernet autoselect (10Gbase-SR <full-duplex>) status: active [root@FW-C-02 /var/log]# ifconfig ix1 ix1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=401bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,VLAN_HWTSO> ether 90:e2:ba:26:3a:18 media: Ethernet autoselect (10Gbase-LR <full-duplex>) status: active [root@FW-C-02 /var/log]# ifconfig -v lagg0 lagg0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500 description: LAGG options=401bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,VLAN_HWTSO> ether 90:e2:ba:26:3a:18 media: Ethernet autoselect status: active groups: lagg laggproto lacp lag id: [(8000,90-E2-BA-26-3A-18,0353,0000,0000), (8000,20-FD-F1-DF-9A-84,000A,0000,0000)] laggport: ix1 flags=0<> state=D [(8000,90-E2-BA-26-3A-18,0352,8000,0002), (8000,20-FD-F1-DF-9A-84,000A,8000,00B3)] laggport: ix0 flags=1c<ACTIVE,COLLECTING,DISTRIBUTING> state=3D [(8000,90-E2-BA-26-3A-18,0353,8000,0001), (8000,20-FD-F1-DF-9A-84,000A,8000,00B2)] Please note that the actor key is 0352 (for ix1) and 0353 (for ix0) respectively. Fix: I have found the place in code where actor key is computed. When using the same key for media types of the same speed, lacp starts working. Please see the attached patch file. The ok result can be demonstrated with ifconfig: [root@FW-C-02 /var/log]# ifconfig -v lagg0 lagg0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500 description: LAGG options=401bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,VLAN_HWTSO> ether 90:e2:ba:26:3a:18 inet 127.0.1.1 netmask 0xffffffff broadcast 127.0.1.1 media: Ethernet autoselect status: active groups: lagg laggproto lacp lag id: [(8000,90-E2-BA-26-3A-18,0352,0000,0000), (8000,20-FD-F1-DF-9A-84,000A,0000,0000)] laggport: ix1 flags=1c<ACTIVE,COLLECTING,DISTRIBUTING> state=3D [(8000,90-E2-BA-26-3A-18,0352,8000,0002), (8000,20-FD-F1-DF-9A-84,000A,8000,00B3)] laggport: ix0 flags=1c<ACTIVE,COLLECTING,DISTRIBUTING> state=3D [(8000,90-E2-BA-26-3A-18,0352,8000,0001), (8000,20-FD-F1-DF-9A-84,000A,8000,00B2)] Patch attached with submission follows: How-To-Repeat: Aggregate two ix interfaces, one short-range, the other one long-range, into a lagg interface using lacp. Excerpt from rc.conf: ifconfig_ix0=" up descr OPT10SR" ifconfig_ix1=" up descr OPT10LR" ifconfig_lagg0="inet 127.0.1.1 netmask 255.255.255.255 descr LAGG laggport ix0 laggport ix1 laggproto lacp"