From nobody Tue Jun 07 10:59:26 2022 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 574105D66E8; Tue, 7 Jun 2022 10:59:27 +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 4LHS6R1WzNz4mkD; Tue, 7 Jun 2022 10:59:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654599567; 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=Jr6qBBSMrpVEhVx3yUPkF7+BO0wqC89DQqgj4cOnaEY=; b=fWVB/1wX7YCLi25o90jX2tXoOK4eS2GaFQpNJMIw2xQq/OP6FeGUlA69Ne1YX/z8b7LEd2 frHOPHqPaa7BpdU0LrI+qSh50QSkf4ZHZTteQOddw0ifL35FrtXT1Aff/Jdwx1xt3ckPiP LDX4IEaeSArCFKaz5H8voQBgrQNTJ6Ldw6hfXwwnFuAdnhwPWdq8zNdKcGfWavfuXJFVop P5C2gEpYTcYeMqwvm+3OYpRHdSDLXZKiC9F+qbcVohMcLUl0955/HjJr08sdMVPPaOcQHr rBiTX+J9RZjAKKheFTox+Hh5L7nLCbV3KV162jmfzAKRh0APbafciloGmGVMlw== 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 047F519949; Tue, 7 Jun 2022 10:59:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 257AxQEo035473; Tue, 7 Jun 2022 10:59:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 257AxQCi035472; Tue, 7 Jun 2022 10:59:26 GMT (envelope-from git) Date: Tue, 7 Jun 2022 10:59:26 GMT Message-Id: <202206071059.257AxQCi035472@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 892eded5b8b0 - main - vlan(4): Add support for allocating TLS receive tags. 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 892eded5b8b0723043577b971ac7be7edeb8df7a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654599567; 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=Jr6qBBSMrpVEhVx3yUPkF7+BO0wqC89DQqgj4cOnaEY=; b=vRPu5c0+ih8UvWgdgMAw8f7aXKHOJ/FPsDUmSikPNA9O4lunYRmUE+M6zg6kHoqnYoa14u FjMDgpvBMW1tOwqErMNJ78Hof9nqSxi4eTl/GuB2L0T2e2Y/KUGNleKQPVwDuuXEHnY8l+ bRnmdAf4oeiBmJY6Z6IC7CWGlhf2t0hCzUGiMsmAaLSVBq6jEw6ird0rM4l2kU2oNC6Y+o XtJlU+ifyec/JuP+Z0/K50SkeISfrBAvIPgY9pbZMWiUZr9lQggT32KUQE+x4lv9HdtfMo qe0M0gCqakzDuQyyTirtGD4m88RHK+EE88Bom7WfJulBYzREL5MwZz5L3kRWWg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654599567; a=rsa-sha256; cv=none; b=Nb20k5XpMVIU1upnr7pWhuspcusoEvZtqdqyzXEjZq7HK30mWiwmAVmka2KQrmOkwVGjwU GmCQGvcqMU6LfetVc+Gy/B4dgv9joROeRwVf3DZwbzX4oiS4e/FtHfHMLiQ7Re6w5pHIMf oEysJirDGUmAyqjdn+MlT5MpndSArs1xI5ZtK/HidqiSpH18nq7U08OGHelS7WPE47Dk1H 8EmV59qmzbAvFWX8AgRYofbhOcWOXPkKZKVp/NA0m32UWGHTwnMyqYJ2gaphlfP62aJ0z6 vAYCOfw0Su2oWzqBrppowsYR7wTeIa30xU7FGrDb8IAYzBa2qyGOQZ0iHcLfxQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=892eded5b8b0723043577b971ac7be7edeb8df7a commit 892eded5b8b0723043577b971ac7be7edeb8df7a Author: Hans Petter Selasky AuthorDate: 2022-05-25 10:39:56 +0000 Commit: Hans Petter Selasky CommitDate: 2022-06-07 10:54:42 +0000 vlan(4): Add support for allocating TLS receive tags. The TLS receive tags are allocated directly from the receiving interface, because mbufs are flowing in the opposite direction and then route change checks are not useful, because they only work for outgoing traffic. Differential revision: https://reviews.freebsd.org/D32356 Sponsored by: NVIDIA Networking --- sys/net/if_vlan.c | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index dc7a5fcb0c73..f8af0fd3d915 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -2204,8 +2204,12 @@ vlan_snd_tag_alloc(struct ifnet *ifp, struct vlan_snd_tag *vst; struct ifvlan *ifv; struct ifnet *parent; + struct m_snd_tag *mst; int error; + NET_EPOCH_ENTER(et); + ifv = ifp->if_softc; + switch (params->hdr.type) { #ifdef RATELIMIT case IF_SND_TAG_TYPE_UNLIMITED: @@ -2219,6 +2223,12 @@ vlan_snd_tag_alloc(struct ifnet *ifp, case IF_SND_TAG_TYPE_TLS: sw = &vlan_snd_tag_tls_sw; break; + case IF_SND_TAG_TYPE_TLS_RX: + sw = NULL; + if (params->tls_rx.vlan_id != 0) + goto failure; + params->tls_rx.vlan_id = ifv->ifv_vid; + break; #ifdef RATELIMIT case IF_SND_TAG_TYPE_TLS_RATE_LIMIT: sw = &vlan_snd_tag_tls_rl_sw; @@ -2226,39 +2236,46 @@ vlan_snd_tag_alloc(struct ifnet *ifp, #endif #endif default: - return (EOPNOTSUPP); + goto failure; } - NET_EPOCH_ENTER(et); - ifv = ifp->if_softc; if (ifv->ifv_trunk != NULL) parent = PARENT(ifv); else parent = NULL; - if (parent == NULL) { - NET_EPOCH_EXIT(et); - return (EOPNOTSUPP); - } + if (parent == NULL) + goto failure; if_ref(parent); NET_EPOCH_EXIT(et); - vst = malloc(sizeof(*vst), M_VLAN, M_NOWAIT); - if (vst == NULL) { - if_rele(parent); - return (ENOMEM); - } + if (sw != NULL) { + vst = malloc(sizeof(*vst), M_VLAN, M_NOWAIT); + if (vst == NULL) { + if_rele(parent); + return (ENOMEM); + } + } else + vst = NULL; - error = m_snd_tag_alloc(parent, params, &vst->tag); + error = m_snd_tag_alloc(parent, params, &mst); if_rele(parent); if (error) { free(vst, M_VLAN); return (error); } - m_snd_tag_init(&vst->com, ifp, sw); + if (sw != NULL) { + m_snd_tag_init(&vst->com, ifp, sw); + vst->tag = mst; + + *ppmt = &vst->com; + } else + *ppmt = mst; - *ppmt = &vst->com; return (0); +failure: + NET_EPOCH_EXIT(et); + return (EOPNOTSUPP); } static struct m_snd_tag *