From nobody Mon Feb 06 17:53:53 2023 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 4P9Ym12z1gz3n0bB; Mon, 6 Feb 2023 17:53:53 +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 4P9Ym12QMLz4X4V; Mon, 6 Feb 2023 17:53:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675706033; 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=uxAZObDmhFRRtQMmAdxpacKJGAf8cvbbCYXZwNLpL1I=; b=i1sTSGcDtZCzbASkZL2g00PQMrEApjohujQvq7hDRLQkGEOE0/cHlgoY0EOK3WSoQ4s3eO rXg/miOpy8vh+xJUgb7v7UjsEf0Ih5XuJ5drusu3pNp2eC4QzE+AabCDVYXhO62q+h5wSq Pwg9e2vTH1FnKzkq6i5i0yKJqZ9gn2X3SqlcBZDh3JgHTyTE1FXOGzFfldNJEeYcVFjNwI yu9OdCK3dF123NiwazxWloE0bu1wAPWPmZtRpZMNdbPLpC6uVVk0QviRI8TbHbaFVDAm69 U6JH2GgQKKIdS9fTBoAHRXAROQtk2JII7vB4tafSW+WBDkoY7wlGSJzsag9r5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675706033; 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=uxAZObDmhFRRtQMmAdxpacKJGAf8cvbbCYXZwNLpL1I=; b=nRIN1ka2OdmzguZ8jJaq+85WETHsaAoiC4AgMcQg4ibbWrOmB7l8nIn3w9DeGysOqwxlgt PkI73zGdlSQDlVhDxEJhwozaQEzRvT6CMsBfonJoepgYxCcOD3N3sst50MUVSXupl0MCL6 aAQTzuAubPq6w6bSB5nHnKOs9BUH0GBF45UWTVG66k50lZHB6hjoTnzXspnkKdYAc9kLYj 4oC3PmR//C7WIpFi+SlAh8Zs+SF9PEsiWV/S6UMEkDJozBHcDzmb244myIrXN7pzsiAE1J sWUtUj4V7MpaRAUkGylNb7VMXQInEbkm77UbobBI6VAycqleuJhLQgmdeYqW2g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675706033; a=rsa-sha256; cv=none; b=UBgifes9GPkdVDv479A3wapKpNIVc+28FsV5Rc+1i2Z/mRy5nm586uxP+Hk3EDdQp3foJq YKVRF0em4WqcrSaDcm7Q9tx5/n/+9uj0UtnrMqSTIPXEZiawTxWNpG+RelJDOWSOU1YuO6 D1mzQDZNeMLoFsBM35xjYak3jn1b+J5QgtTkWcdtfLQUIVW8omFjpTtSw/qXzrVRZUFN38 V7j7mYLNbFkaXViZBDEvjTGobr4MrH3gIbYO4LEuH3s891i2SQ9L4vM6/iUwCmkpp7kz7m H1qWSlgmQA4FJaYPkKE+lQD0QLJ2o6H04r7SSmLcsYR0TP+UnbOwepzoBZYw/A== 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 4P9Ym11SNJzkjR; Mon, 6 Feb 2023 17:53:53 +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 316HrrvX074136; Mon, 6 Feb 2023 17:53:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 316HrraR074135; Mon, 6 Feb 2023 17:53:53 GMT (envelope-from git) Date: Mon, 6 Feb 2023 17:53:53 GMT Message-Id: <202302061753.316HrraR074135@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 1e6131bad6b4 - main - IfAPI: Add needed APIs for mbuf support 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1e6131bad6b47efbd35c5e7095637ed2aeaecd70 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=1e6131bad6b47efbd35c5e7095637ed2aeaecd70 commit 1e6131bad6b47efbd35c5e7095637ed2aeaecd70 Author: Justin Hibbits AuthorDate: 2023-02-01 14:56:34 +0000 Commit: Justin Hibbits CommitDate: 2023-02-06 17:32:04 +0000 IfAPI: Add needed APIs for mbuf support Summary: Add 2 new APIs for supporting recent mbuf changes: * 36e0a362ac added the m_snd_tag_alloc() wrapper around if_snd_tag_alloc(). Push this down to the ifnet level. * 4d7a1361ef adds the m_rcvif_serialize()/m_rcvif_restore() KPIs to serialize and restore an ifnet pointer. Add the necessary wrapper to get the index generation for this. Reviewed By: jhb Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D38340 --- sys/kern/kern_mbuf.c | 12 +++++------- sys/net/if.c | 16 ++++++++++++++++ sys/net/if_var.h | 3 +++ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index d47b1fbf3c60..84dea05f1bbb 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -1586,9 +1586,7 @@ m_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, struct m_snd_tag **mstp) { - if (ifp->if_snd_tag_alloc == NULL) - return (EOPNOTSUPP); - return (ifp->if_snd_tag_alloc(ifp, params, mstp)); + return (if_snd_tag_alloc(ifp, params, mstp)); } void @@ -1620,13 +1618,13 @@ m_rcvif_serialize(struct mbuf *m) u_short idx, gen; M_ASSERTPKTHDR(m); - idx = m->m_pkthdr.rcvif->if_index; - gen = m->m_pkthdr.rcvif->if_idxgen; + idx = if_getindex(m->m_pkthdr.rcvif); + gen = if_getidxgen(m->m_pkthdr.rcvif); m->m_pkthdr.rcvidx = idx; m->m_pkthdr.rcvgen = gen; if (__predict_false(m->m_pkthdr.leaf_rcvif != NULL)) { - idx = m->m_pkthdr.leaf_rcvif->if_index; - gen = m->m_pkthdr.leaf_rcvif->if_idxgen; + idx = if_getindex(m->m_pkthdr.leaf_rcvif); + gen = if_getidxgen(m->m_pkthdr.leaf_rcvif); } else { idx = -1; gen = 0; diff --git a/sys/net/if.c b/sys/net/if.c index 8bb5ed0043e5..43d1e2b95a63 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -4295,6 +4295,12 @@ if_getindex(const if_t ifp) return ((struct ifnet *)ifp)->if_index; } +int +if_getidxgen(const if_t ifp) +{ + return (ifp->if_idxgen); +} + void if_setdescr(if_t ifp, char *descrbuf) { @@ -4845,6 +4851,16 @@ if_setsndtagallocfn(if_t ifp, if_snd_tag_alloc_t alloc_fn) ((struct ifnet *)ifp)->if_snd_tag_alloc = alloc_fn; } +int +if_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, + struct m_snd_tag **mstp) +{ + + if (ifp->if_snd_tag_alloc == NULL) + return (EOPNOTSUPP); + return (ifp->if_snd_tag_alloc(ifp, params, mstp)); +} + void if_setgetcounterfn(if_t ifp, if_get_counter_t fn) { diff --git a/sys/net/if_var.h b/sys/net/if_var.h index b4cdcf27253f..f33b4fc590c7 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -578,6 +578,7 @@ int if_setcapenablebit(if_t ifp, int setcap, int clearcap); int if_getcapenable(const if_t ifp); int if_getdunit(const if_t ifp); int if_getindex(const if_t ifp); +int if_getidxgen(const if_t ifp); const char *if_getdname(const if_t ifp); void if_setdname(if_t ifp, const char *name); const char *if_name(if_t ifp); @@ -650,6 +651,8 @@ bool if_altq_is_enabled(if_t ifp); void *if_getafdata(if_t ifp, int); +int if_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, + struct m_snd_tag **mstp); /* * Traversing through interface address lists. */