From nobody Mon Jun 17 09:54:59 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4W2lc34kxNz5NYKc; Mon, 17 Jun 2024 09:54:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4W2lc34GMyz4S20; Mon, 17 Jun 2024 09:54:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718618099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GyisDM2ZLbuSJFyXOV1x82aoEotW3K+p8hbCBv8xyQc=; b=kVxxgSLqqg7zHmd3t5zjM4xj2nnDxdM+htW+WwbuIjaO2HZUVc/bQXDDJWQ6h3f5Pwsxt/ QGFMMFQNUCosn/eW5tpXlDDcknt4B/RfSvosjhAs4ZFmboAedqUVBM4c1hMXKqA/ropn++ nLN09Bs6zTQJtgQ4B7muX+RPYgA8P425Xa1en1xgQ2VK226N/wDfBYp5UZN7ZhUqcn2G5v Pt6/UY9uRuQGpzjFJGHMbXYcGBc3+mRX2S1g8/FuZso7oH6PeJM/Seo+VTbPjrW73YNVOG U51pv4qyEZJJnnO8+Y+2H6ro5JLm6DoSzvlVe7dInfscaj8gTKcWT/1nxgIbzw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718618099; a=rsa-sha256; cv=none; b=FK6L5crbiQIRHjgL4vp8d6C5yJAmtmk+E/h42ElNQRd6bHix78ZUNDX1FTYxwcLv0PGV4H CbraYnDZRwh5CUbbUdR94v1MLBuYbTFxcD8YvHds9+Q4F2sC0D0pshg93ti4VJSWQBerrT CA/irEGGpVgN4EDrXeglerbYs23PUVXPRP4UQZY/tH/P71L1QTZ1OxU8T1iepujdolQ1od zTnB7Nl3IxA5upKvvwTNuXlotCdzyDN8RCajqEdKk4LaH6G0TvELkqJ91hF96HfC3YtAb2 sUBKjDZvto9OwO3q6FtlU0Qpx4Smmc1/uloEI7WhRkDGjngdlQSusg8GWAYMCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718618099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GyisDM2ZLbuSJFyXOV1x82aoEotW3K+p8hbCBv8xyQc=; b=OguvhwQBRvNQEG9e5YZeG8nFdmwy8NjccJkAWsO4ODI50w0seTTIiwO0qDaxlKvDaZ6kXU Kiov/2/XZqatDnKeDcSFfqq2U3kBx3rZfljoeL+XUSjUJHBxe4LbcO+Wqpe3xgW58AXr4R ApNASxlxONVBEbwN/OWc+lpQRyaZvNAzd4teA7X0mBLZQGtluesRNtw0YFHCeH1LVEiHva bHcHkMmFgME+dZzVdGaWwOC6ce+0Rx4oES2RkILrrGrZul68u8wIDTE/BRqOzQlZlTU2CD T/fc5L3msvF2rmceepM+ZdfJci95Ea54uxvgL8AP5pzY8k1p2WQRI8XsyiY4ew== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4W2lc33t3fz1Q6C; Mon, 17 Jun 2024 09:54:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 45H9sxFp030948; Mon, 17 Jun 2024 09:54:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45H9sx8c030945; Mon, 17 Jun 2024 09:54:59 GMT (envelope-from git) Date: Mon, 17 Jun 2024 09:54:59 GMT Message-Id: <202406170954.45H9sx8c030945@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 7deadea2eb0a - main - mlx5: handle vlan PF restrictions List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7deadea2eb0aca0b83657d30f895d98795d9d81f Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7deadea2eb0aca0b83657d30f895d98795d9d81f commit 7deadea2eb0aca0b83657d30f895d98795d9d81f Author: Kristof Provost AuthorDate: 2024-05-30 13:56:56 +0000 Commit: Kristof Provost CommitDate: 2024-06-17 08:50:16 +0000 mlx5: handle vlan PF restrictions Reviewed by: kib MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D45427 --- sys/dev/mlx5/mlx5_core/mlx5_main.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 6b9b63a24714..95d88c728306 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -52,8 +52,12 @@ #include #ifdef PCI_IOV #include +#include #include #include +#include +#include +#include #endif static const char mlx5_version[] = "Mellanox Core driver " @@ -225,6 +229,7 @@ static void mlx5_set_driver_version(struct mlx5_core_dev *dev) #ifdef PCI_IOV static const char iov_mac_addr_name[] = "mac-addr"; +static const char iov_vlan_name[] = "vlan"; static const char iov_node_guid_name[] = "node-guid"; static const char iov_port_guid_name[] = "port-guid"; #endif @@ -1714,6 +1719,8 @@ static int init_one(struct pci_dev *pdev, vf_schema = pci_iov_schema_alloc_node(); pci_iov_schema_add_unicast_mac(vf_schema, iov_mac_addr_name, 0, NULL); + pci_iov_schema_add_vlan(vf_schema, + iov_vlan_name, 0, 0); pci_iov_schema_add_uint64(vf_schema, iov_node_guid_name, 0, 0); pci_iov_schema_add_uint64(vf_schema, iov_port_guid_name, @@ -1950,6 +1957,25 @@ mlx5_iov_add_vf(device_t dev, uint16_t vfnum, const nvlist_t *vf_config) } } + if (nvlist_exists_number(vf_config, iov_vlan_name)) { + uint16_t vlan = nvlist_get_number(vf_config, iov_vlan_name); + + if (vlan == DOT1Q_VID_NULL) + error = ENOTSUP; + else { + if (vlan == VF_VLAN_TRUNK) + vlan = DOT1Q_VID_NULL; + + error = -mlx5_eswitch_set_vport_vlan(priv->eswitch, + vfnum + 1, vlan, 0); + } + if (error != 0) { + mlx5_core_err(core_dev, + "setting VLAN for VF %d failed, error %d\n", + vfnum + 1, error); + } + } + if (nvlist_exists_number(vf_config, iov_node_guid_name)) { node_guid = nvlist_get_number(vf_config, iov_node_guid_name); error = -mlx5_modify_nic_vport_node_guid(core_dev, vfnum + 1,