From bde35a6c7d211ca88c4b4af7f63f9c7c5cebfa07 Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Sun, 21 Apr 2024 23:18:36 +0200 Subject: [PATCH 1/3] lldpd: get_config_cid_ifaces() -> get_interface_csv() where csv = comma separated value(s) Make the function more generic. Can use it for not only 'config'. Now it can be used to parse interfaces for additional lldpd settings, e.g. custom-tlv. Tested on: 22.03.6 Signed-off-by: Paul Donald Link: https://github.com/openwrt/openwrt/pull/14872 (cherry picked from commit a015f59880c72a1bdd07de32491f85ce7f8d2a1c) Link: https://github.com/openwrt/openwrt/pull/18343 Signed-off-by: Robert Marko --- package/network/services/lldpd/files/lldpd.init | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index 6c1c184bfa..2ad59f8cb1 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -75,9 +75,9 @@ get_config_restart_hash() { export -n "$var=$_hash" } -get_config_cid_ifaces() { +get_interface_csv() { local _ifaces - config_get _ifaces 'config' "$2" + config_get _ifaces "$2" "$3" local _iface _ifnames="" # Set noglob to prevent '*' capturing diverse file names in the for ... in @@ -109,7 +109,7 @@ write_lldpd_conf() config_get lldp_hostname 'config' 'lldp_hostname' "$(cat /proc/sys/kernel/hostname)" local ifnames - get_config_cid_ifaces ifnames "interface" + get_interface_csv ifnames 'config' "interface" local lldp_mgmt_ip config_get lldp_mgmt_ip 'config' 'lldp_mgmt_ip' @@ -335,7 +335,7 @@ start_service() { # ChassisID interfaces local ifnames - get_config_cid_ifaces ifnames "cid_interface" + get_interface_csv ifnames 'config' "cid_interface" [ -n "$ifnames" ] && procd_append_param command -C "$ifnames" From de2718b2f36282d1ba8e85e99f37afa0821e5ed3 Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Mon, 22 Apr 2024 00:08:48 +0200 Subject: [PATCH 2/3] lldpd: add `custom-tlv` handling Do not verify the format of TLV. Leave that to lldpd. These lldpd config entries: config custom-tlv list ports 'eth0' option tlv 'replace oui 33,44,55 subtype 254 oui-info 55,55,55,55,55' config custom-tlv option tlv 'oui 33,44,44 subtype 232' list ports 'br-lan' list ports 'eth0' config custom-tlv # oui-info truncated option tlv 'add oui 33,44,33 subtype 66 oui-info 5555555555' config custom-tlv option tlv 'add oui 33,44,31 subtype 44' config custom-tlv # invalid oui option tlv 'add oui 3322 subtype 79' config custom-tlv # invalid oui option tlv 'oui 3312 subtype 74' Produce the following lldpd.conf content: configure ports eth0 lldp custom-tlv replace oui 33,44,55 subtype 254 oui-info 55,55,55,55,55 configure ports br-lan,eth0 lldp custom-tlv oui 33,44,44 subtype 232 configure lldp custom-tlv add oui 33,44,33 subtype 66 oui-info 5555555555 configure lldp custom-tlv add oui 33,44,31 subtype 44 configure lldp custom-tlv add oui 3322 subtype 79 configure lldp custom-tlv oui 3312 subtype 74 And lldpd (v1.0.13 on v22) logs the following: Sat Mar 16 19:11:39 2024 daemon.info lldpd[10916]: custom TLV op replace oui 33:44:55 subtype fe Sat Mar 16 19:11:39 2024 daemon.info lldpd[10916]: custom TLV op add oui 33:44:44 subtype e8 Sat Mar 16 19:11:39 2024 daemon.info lldpd[10916]: custom TLV op add oui 33:44:33 subtype 42 Sat Mar 16 19:11:39 2024 daemon.info lldpd[10916]: custom TLV op add oui 33:44:33 subtype 42 Sat Mar 16 19:11:39 2024 daemon.info lldpd[10916]: custom TLV op add oui 33:44:31 subtype 2c Sat Mar 16 19:11:39 2024 daemon.info lldpd[10916]: custom TLV op add oui 33:44:31 subtype 2c Sat Mar 16 19:11:39 2024 daemon.warn lldpcli[10915]: invalid OUI value '3322' Sat Mar 16 19:11:39 2024 daemon.info lldpcli[10915]: an error occurred while executing last command Sat Mar 16 19:11:39 2024 daemon.warn lldpcli[10915]: invalid OUI value '3312' Sat Mar 16 19:11:39 2024 daemon.info lldpcli[10915]: an error occurred while executing last command Sat Mar 16 19:11:39 2024 daemon.info lldpcli[10915]: lldpd should resume operations ( The last two TLV are invalid: their oui must be three hex bytes, comma separated. Only the first hex byte of oui-info 5555555555 is used ) Depends on #14867 and its release version bump Tested on: 22.03.6 Signed-off-by: Paul Donald Link: https://github.com/openwrt/openwrt/pull/14872 (cherry picked from commit 8d1fe32c2c46a8de519f9926be2bc062cef66f24) Link: https://github.com/openwrt/openwrt/pull/18343 Signed-off-by: Robert Marko --- .../network/services/lldpd/files/lldpd.init | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index 2ad59f8cb1..e60cc82fd3 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -98,6 +98,21 @@ get_interface_csv() { export -n "${1}=$_ifnames" } +add_custom_tlv_callback() +{ + # syntax: configure [ports ethX[,…]] lldp custom-tlv [add|replace] oui XX,XX,XX subtype XX oui-info XX[,XX,...] + # ex: configure ports br-lan,eth0 lldp custom-tlv replace oui 33,44,55 subtype 254 oui-info 55,55,55,55,55 + # ex: configure lldp custom-tlv oui 33,44,44 subtype 232 + + local _ports + local _tlv + # CSV of device ports + get_interface_csv _ports "$1" 'ports' + config_get _tlv "$1" 'tlv' + + echo "configure ${_ports:+ports $_ports }lldp custom-tlv $_tlv" >> "$LLDPD_CONF" +} + write_lldpd_conf() { local lldp_description @@ -197,6 +212,9 @@ write_lldpd_conf() [ "$lldp_mgmt_addr_advertisements" -gt 0 ] && echo "configure lldp management-addresses-advertisements" >> "$LLDPD_CONF" ||\ echo "unconfigure lldp management-addresses-advertisements" >> "$LLDPD_CONF" + # Custom TLV handling + config_foreach add_custom_tlv_callback 'custom-tlv' + # Since lldpd's sysconfdir is /tmp, we'll symlink /etc/lldpd.d to /tmp/$LLDPD_CONFS_DIR [ -e "$LLDPD_CONFS_DIR" ] || ln -s /etc/lldpd.d "$LLDPD_CONFS_DIR" } From 1c1c373943d81b9a8f5613dfec0f900d5eb0f563 Mon Sep 17 00:00:00 2001 From: Rui Salvaterra Date: Fri, 28 Mar 2025 16:00:39 +0000 Subject: [PATCH 3/3] kernel: backport igc hw vlan patch to 24.10 Fix an abysmal out-of-the-box performance issue with igc-supported Ethernet controllers and 802.1Q. Signed-off-by: Rui Salvaterra --- ...an-tag-insertion-stripping-by-defaul.patch | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 target/linux/generic/backport-6.6/792-v6.16-igc-enable-HW-vlan-tag-insertion-stripping-by-defaul.patch diff --git a/target/linux/generic/backport-6.6/792-v6.16-igc-enable-HW-vlan-tag-insertion-stripping-by-defaul.patch b/target/linux/generic/backport-6.6/792-v6.16-igc-enable-HW-vlan-tag-insertion-stripping-by-defaul.patch new file mode 100644 index 0000000000..0ca219457c --- /dev/null +++ b/target/linux/generic/backport-6.6/792-v6.16-igc-enable-HW-vlan-tag-insertion-stripping-by-defaul.patch @@ -0,0 +1,32 @@ +From 8cae5a0d91fea01d90ce7c1827e26934a22ca2fa Mon Sep 17 00:00:00 2001 +From: Rui Salvaterra +Date: Wed, 5 Mar 2025 11:53:56 +0000 +Subject: [PATCH] igc: enable HW vlan tag insertion/stripping by default + +This is enabled by default in other Intel drivers I've checked (e1000, e1000e, +iavf, igb and ice). Fixes an out-of-the-box performance issue when running +OpenWrt on typical mini-PCs with igc-supported Ethernet controllers and 802.1Q +VLAN configurations, as ethtool isn't part of the default packages and sane +defaults are expected. + +In my specific case, with an Intel N100-based machine with four I226-V Ethernet +controllers, my upload performance increased from under 30 Mb/s to the expected +~1 Gb/s. + +Signed-off-by: Rui Salvaterra +--- + drivers/net/ethernet/intel/igc/igc_main.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/ethernet/intel/igc/igc_main.c ++++ b/drivers/net/ethernet/intel/igc/igc_main.c +@@ -6850,6 +6850,9 @@ static int igc_probe(struct pci_dev *pde + netdev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT | + NETDEV_XDP_ACT_XSK_ZEROCOPY; + ++ /* enable HW vlan tag insertion/stripping by default */ ++ netdev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; ++ + /* MTU range: 68 - 9216 */ + netdev->min_mtu = ETH_MIN_MTU; + netdev->max_mtu = MAX_STD_JUMBO_FRAME_SIZE;