From nobody Tue Jul 2 08:06:15 2024 X-Original-To: dev-commits-src-branches@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 4WCwTg5B3Mz5Phlt; Tue, 02 Jul 2024 08:06:15 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WCwTg4Hr4z4Hv6; Tue, 2 Jul 2024 08:06:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719907575; 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=N+oKW4mH8EobctxMtyb0qNndROusHfb5B1Eos8ZXtoI=; b=ve551GZ215gnP2AxS+C0SFqxbm7HeO2KeftOeABjsYEZxJa2cVGmTYzL3sdawIskwFJZex /tAGLN4IhhY7WUDphqKnRvPnhL6o9LrPsrrekypOnuzizXhu6vBfYiqIpKmFtRXT0yZN9Q 0HF4NdEOh6diY15Hgnj+THWmXJxF3DIVdAiT0Qt0sv0iZJwgABsAtYmu9o/SoYhDWMwyhL P3Ssg4KYkPhLXT2J+7k0AwXkanqcsFpgxNAlFOAT5IgGzCvlUAMMUGqUqECs4CZOf/q1U9 Plksk+1yVN0LfoPbrS8vtKavG6Dha/543mYVcab9njrjCqX1Z3GnO+XUfPuj3w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1719907575; a=rsa-sha256; cv=none; b=ZBZcvOntRf1V6lmwu8x+AgWRRURQ/lGh16lhuDzmSaE7QwRXOwlJy5qLWCV+hAIJeIZfm4 zSSVj3Ekk8fAxsEBZd923byPp9MTlX86iK7iPStxrlgrfmZv70WXSFWRVnCQH7z0aLZorq u+ygTgmtDWMJ2VUs79+xPbefh4qGn1aP0pX6rxpR4dwRpOapvGfTvKP9Be7iY+iYhQ7MMI GirW5cfveGgYa8KWRlH4ULY/cWvfwQdcD7Irr+W83HqHTJboIhqwVkv+6H8yU9bwACFkZr L/nFxPAKwU12jcdzwO15A8qWbU9Is/iv43LNEdc8JauBrnrFwXoP7Y3jVCc2WQ== 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=1719907575; 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=N+oKW4mH8EobctxMtyb0qNndROusHfb5B1Eos8ZXtoI=; b=uZEHcCNJqm9bI00MNeGdyzh1TLotHNIaFSbfF3cS0ju/dVdSrk3gzMpbBnBVr+TqYz3xj2 ELTNMTCw2PpiK59kcFiqd1qGNmVPadnY7NDNWsozONAdC4qQvwQjYd16EPp2NDpdMCboOr i2TxI3DnpxSYmOXY/yjcryiEL7lOgAYaP1E3rW/eh8n6Z2a5WrRuLXh2lN2H31HoRVSe1A ClIFP3/2H9bo2doHidyRNjWgHirb9UVvuJpTey3TsvhlQeXDz7e9EGQ722I305cBSS7Bzi JlgDWWNcSu+6WqMsA8nH1ifdbNMMXqi6A73V1PNMtf+RmiZ/mFZ1Wwr4fWw+hQ== 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 4WCwTg3nL4zgGP; Tue, 2 Jul 2024 08:06:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46286FBV082570; Tue, 2 Jul 2024 08:06:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46286F2b082567; Tue, 2 Jul 2024 08:06:15 GMT (envelope-from git) Date: Tue, 2 Jul 2024 08:06:15 GMT Message-Id: <202407020806.46286F2b082567@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 29c64c8ddf67 - stable/13 - mlx5: handle vlan PF restrictions List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 29c64c8ddf675e5dac615083df7cc8c12dd63bcc Auto-Submitted: auto-generated The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=29c64c8ddf675e5dac615083df7cc8c12dd63bcc commit 29c64c8ddf675e5dac615083df7cc8c12dd63bcc Author: Kristof Provost AuthorDate: 2024-05-30 13:56:56 +0000 Commit: Kristof Provost CommitDate: 2024-07-02 07:45:53 +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 (cherry picked from commit 7deadea2eb0aca0b83657d30f895d98795d9d81f) --- 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 0a05d559072f..a96467a3681b 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 @@ -1697,6 +1702,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, @@ -1933,6 +1940,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 == 0) + error = ENOTSUP; + else { + if (vlan == VF_VLAN_TRUNK) + vlan = 0; + + 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,