git: 9c40fca6c809 - stable/11 - ixl: Permit 802.1ad frames to pass though the chip

Lutz Donnerhacke donner at FreeBSD.org
Tue Feb 2 14:26:52 UTC 2021


The branch stable/11 has been updated by donner:

URL: https://cgit.FreeBSD.org/src/commit/?id=9c40fca6c809e845341aade54307f9fc84627480

commit 9c40fca6c809e845341aade54307f9fc84627480
Author:     Lutz Donnerhacke <donner at FreeBSD.org>
AuthorDate: 2021-02-02 14:22:55 +0000
Commit:     Lutz Donnerhacke <donner at FreeBSD.org>
CommitDate: 2021-02-02 14:25:19 +0000

    ixl: Permit 802.1ad frames to pass though the chip
    
    This patch is a quick hack to change the internal Ethertype used
    within the chip.  All frames with this type are dropped silently.
    This patch allows you to overwrite the factory default 0x88a8, which
    is used by IEEE 802.1ad VLAN stacking.
    
    Reviewed by:    kp, philip, brueffer
    Approved by:    philip (mentor)
    Differential Revision: https://reviews.freebsd.org/D24179
    
    (cherry-picked from commit fa6662b3689eeb71cb63c2b230ca08e7342cabf0)
---
 share/man/man4/ixl.4      | 11 ++++++++++-
 sys/dev/ixl/ixl_pf_main.c | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/share/man/man4/ixl.4 b/share/man/man4/ixl.4
index 60aa5e67ac40..e7554b7bc854 100644
--- a/share/man/man4/ixl.4
+++ b/share/man/man4/ixl.4
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 25, 2015
+.Dd January 19, 2021
 .Dt IXL 4
 .Os
 .Sh NAME
@@ -151,6 +151,15 @@ this can cause a link at 10GB, 1GB, or 100MB.
 This is a display of the current setting.
 .It Va hw.ixl.fw_version
 This is a display of the Firmware version.
+.It Va dev.ixl.#.debug.switch_vlans
+Set the Ethertype used by the hardware itself to handle internal
+services.
+Frames with this Ethertype will be dropped without notice.
+Defaults to
+.Dv 0x88a8 ,
+which is a well known number for IEEE 802.1ad VLAN stacking.
+If you need 802.1ad support, set this number to any another Ethertype i.e.
+.Dv 0xffff .
 .El
 .Sh Interrupt Storms
 It is important to note that 40G operation can generate high
diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c
index 1ddc21760d05..7d56e0562071 100644
--- a/sys/dev/ixl/ixl_pf_main.c
+++ b/sys/dev/ixl/ixl_pf_main.c
@@ -73,6 +73,7 @@ static int	ixl_sysctl_phy_abilities(SYSCTL_HANDLER_ARGS);
 static int	ixl_sysctl_sw_filter_list(SYSCTL_HANDLER_ARGS);
 static int	ixl_sysctl_hw_res_alloc(SYSCTL_HANDLER_ARGS);
 static int	ixl_sysctl_switch_config(SYSCTL_HANDLER_ARGS);
+static int	ixl_sysctl_switch_vlans(SYSCTL_HANDLER_ARGS);
 static int	ixl_sysctl_hkey(SYSCTL_HANDLER_ARGS);
 static int	ixl_sysctl_hena(SYSCTL_HANDLER_ARGS);
 static int	ixl_sysctl_hlut(SYSCTL_HANDLER_ARGS);
@@ -4529,6 +4530,10 @@ ixl_add_device_sysctls(struct ixl_pf *pf)
 	    OID_AUTO, "switch_config", CTLTYPE_STRING | CTLFLAG_RD,
 	    pf, 0, ixl_sysctl_switch_config, "A", "HW Switch Configuration");
 
+	SYSCTL_ADD_PROC(ctx, debug_list,
+	    OID_AUTO, "switch_vlans", CTLTYPE_INT | CTLFLAG_WR,
+	    pf, 0, ixl_sysctl_switch_vlans, "I", "HW Switch VLAN Configuration");
+
 	SYSCTL_ADD_PROC(ctx, debug_list,
 	    OID_AUTO, "rss_key", CTLTYPE_STRING | CTLFLAG_RD,
 	    pf, 0, ixl_sysctl_hkey, "A", "View RSS key");
@@ -6069,6 +6074,40 @@ ixl_sysctl_switch_config(SYSCTL_HANDLER_ARGS)
 	return (error);
 }
 
+static int
+ixl_sysctl_switch_vlans(SYSCTL_HANDLER_ARGS)
+{
+	struct ixl_pf *pf = (struct ixl_pf *)arg1;
+	struct i40e_hw *hw = &pf->hw;
+	device_t dev = pf->dev;
+	int requested_vlan = -1;
+	enum i40e_status_code status = 0;
+	int error = 0;
+
+	error = sysctl_handle_int(oidp, &requested_vlan, 0, req);
+	if ((error) || (req->newptr == NULL))
+	    return (error);
+
+	if ((hw->flags & I40E_HW_FLAG_802_1AD_CAPABLE) == 0) {
+		device_printf(dev, "Flags disallow setting of vlans\n");
+		return (ENODEV);
+	}
+
+	hw->switch_tag = requested_vlan;
+	device_printf(dev,
+	    "Setting switch config to switch_tag=%04x, first_tag=%04x, second_tag=%04x\n",
+	    hw->switch_tag, hw->first_tag, hw->second_tag);
+	status = i40e_aq_set_switch_config(hw, 0, 0, 0, NULL);
+	if (status) {
+		device_printf(dev,
+		    "%s: aq_set_switch_config() error %s, aq error %s\n",
+		    __func__, i40e_stat_str(hw, status),
+		    i40e_aq_str(hw, hw->aq.asq_last_status));
+		return (status);
+	}
+	return (0);
+}
+
 static int
 ixl_sysctl_hkey(SYSCTL_HANDLER_ARGS)
 {


More information about the dev-commits-src-all mailing list