From nobody Tue Jul 02 08:06:16 2024 X-Original-To: dev-commits-src-all@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 4WCwTh51bxz5PhVj; Tue, 02 Jul 2024 08:06:16 +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 4WCwTh4Kw7z4J9P; Tue, 2 Jul 2024 08:06:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719907576; 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=/reQYK5QFvJaIZ71nvnBUW6OtpXtzxbl0EcUMTXFnVA=; b=LdoOWUdd+e1XPtqpu2RLUV4pFDgqNGO0vTcWerN2wSAhdj2CS9Z31h1UV8WYiU6X1GU5di tP2uZXlqnehNpWaCeV2lGk0psLhiOAiM9+f2ENtByfshucuLLFAtYNKdiAMtYAS8Kejskm FNbh9JdwxifrOkdXD9ytqFlNNjW3apB5afbp9H9vpR8glB7/l1wBsw1Jp/IkVyQOVkddMA PfWwaC5ttrrkr65RdOkYzQLXCUNUVX+cIj1WmHKHAqWe+c5upwFlUFXCdDZv5b0p/mmp3F O3Q8U+nsWCs70M1mrpZtZaPwLI5RmNg0dH818vEwtJe+rpo9pmJs8z8dYs0+DQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1719907576; a=rsa-sha256; cv=none; b=AcnYTW7F+38cYXUEy6LNuU2TKKwKJXNKIv+TL7ICETvyfSX9LRrtoQvk+X2v8ai8hz66dY JS2NoGi2W4oAgonogX+VIhDTno3qKbreEvcH2xQ+BqnNDUHevzWEEi+uo93H9x0aBmL/bE tcfg0Y/vSplDVSqH7qgdcHPxoz1yCGSqmdy0BaIdPIBbTjIdXmQHS4n43gD77Zgf3Ja+FD TMH+C/t6/3h/zKvFtK31wsfXQAa0jUb+1lVqzzJBYooguyREkaGPsYDzZtQm0j0L0oPwlH V+RGh1ZxZ5y8AwTFm9/86k5v/nX5Kc6QpAP0hXfNjxLrIya7wYnIWkRTi9B9XQ== 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=1719907576; 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=/reQYK5QFvJaIZ71nvnBUW6OtpXtzxbl0EcUMTXFnVA=; b=GXZ+4NgyTY/3Lzn2BaY5AiIAEm7KBt3Jg5Q6BDKl7CaekA9C7n9AVtu+zwa1u+425J1IWr u6LiGQ/lAJnCD4azsLk3CFPBW0rkIJUOQd3lpEdW5hoyV9kQ0Gd533UR3xA34hSPPBjCMv dRVJAvspgWYPUSikqXzxrZbdpjcWua72qrsqdmrthHb/fMScy2MLA3+wlL1ugFe4V412gH 5QvR/FJqKp22DV1stK5qrU7dT05r6itZnN31SKQUPFO1FJu0yS7agoOFgP2OcOKp5kE4mS MDwXQF8aaJsXtGrSOOG0wS/K1clVALcnffCkHp67RnOlUC557Avp6znIYfWnqw== 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 4WCwTh3yNQzgcD; Tue, 2 Jul 2024 08:06:16 +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 46286G1t082612; Tue, 2 Jul 2024 08:06:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46286G8e082609; Tue, 2 Jul 2024 08:06:16 GMT (envelope-from git) Date: Tue, 2 Jul 2024 08:06:16 GMT Message-Id: <202407020806.46286G8e082609@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: 9c86768b14f6 - stable/14 - mlx5: handle vlan PF restrictions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/14 X-Git-Reftype: branch X-Git-Commit: 9c86768b14f67ae071201addfe28d12eaca45fac Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9c86768b14f67ae071201addfe28d12eaca45fac commit 9c86768b14f67ae071201addfe28d12eaca45fac Author: Kristof Provost AuthorDate: 2024-05-30 13:56:56 +0000 Commit: Kristof Provost CommitDate: 2024-07-01 16:06:09 +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 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,