From nobody Sat Dec 24 14:39:11 2022 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 4NfRWg2mKbz1mXdx; Sat, 24 Dec 2022 14:39:11 +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 4NfRWg2J58z4YKq; Sat, 24 Dec 2022 14:39:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671892751; 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=S7T89Md3rqmwvPUhAMlg9vhpyXIuDavqQRLPFIi7dFk=; b=NTjW5CwxKfyJaY/6acYTi/VMh5kSlrMgXa96NqGM9Yzp9XpU6lrvkttkywEg/BmZYvykYD D5Bf+6SI+3XK6PfDI6HuQTUf6APi48gFGlr2cPA042ZacNl4cPohFxnCi18gsIAgS3USVB 9lCiE1v3WlO+uXowBOO360WjGQ5awKRAu0LW6SHNM5Lwpc+RwS/PUrPiUd7TfLql1Yjz+s eoDQrLRGiDEKqSqGYDoT0IWZP23Svw86s2TeCP2cuB3eBGR6joXyW/ii96ZbyO56Fip0g/ 8unbu2u4ynEfezmiZgh0ZFFnhmpeWnTOP941tzkMo9zZFAhJk2I+6gWGisCKHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671892751; 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=S7T89Md3rqmwvPUhAMlg9vhpyXIuDavqQRLPFIi7dFk=; b=Orfumh2upBkyhxSpu4wz6PYtphQpOSO7P3bnH+xfXxuFvazOI+vwJ2f10N63LPeN+TfyOb hVZ7/kc31En/mIFahdR2PQGwaUXRE+VvEruQcBGyRRW/7KWdpSeqgXLPIgL/8k7x2Ol5AB 0o/ofXyea0wdX2XQikqslkc2JHNdNe+ylSl/KugJUFlgHC4GgUVy8O5F8ErqSmIIN4Rp4b Gq/ZCT4XzgVJBh9hKJVTbDafmMmxzasTC7ve+5dn8b5wpqwrVBiJth7FYamyTudKDR6dxI dFNVzYPRhS5BgFnQofAcAzaP0l2E7e+47SALy2jyCnYPHULUamboO9FbcKbQuA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1671892751; a=rsa-sha256; cv=none; b=p6wIK4/SCQud2RyId6J3c1lEFwdpZXSLDKBS8XYq/otLnTOGpfl6OOpnmKHCLCYWud/Q0s v/IFzXfDPP03omlwju1KjqO1XDWG2MCGdzdfAYpaGrLApQ4ZqGDutOGWTpMGtYRSeEIJQ1 qNPHCV/5sLNpq8Db3Cs2FqQHldXnpai9ogwpnUBPNvF2KVeesnnyutbLtZA5quL0KnTePM WrXVgU4EvxW0lndAM5vLXs3fmOjpAdobNdoEzjAEKGaPcVz+c8XN3uMfmsFr+WsUF8yJXT cseUOcXPH2Sv88c7VFWsd/JBx21bEUvz6y4NcA5i8uxgM0/7odC+bgqyqUxeow== 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 4NfRWg1F1tzHM0; Sat, 24 Dec 2022 14:39:11 +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 2BOEdBRV002395; Sat, 24 Dec 2022 14:39:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BOEdBaa002394; Sat, 24 Dec 2022 14:39:11 GMT (envelope-from git) Date: Sat, 24 Dec 2022 14:39:11 GMT Message-Id: <202212241439.2BOEdBaa002394@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 3da494d3246e - main - netmap: drop compatibility FreeBSD code 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: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3da494d3246e30a19d2107c8bb8a293ffd5a9da6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=3da494d3246e30a19d2107c8bb8a293ffd5a9da6 commit 3da494d3246e30a19d2107c8bb8a293ffd5a9da6 Author: Vincenzo Maffione AuthorDate: 2022-12-24 14:31:14 +0000 Commit: Vincenzo Maffione CommitDate: 2022-12-24 14:36:31 +0000 netmap: drop compatibility FreeBSD code Netmap users on FreeBSD are not supposed to import code from the github netmap repository anymore. They should use the code that is available in the src repo. We can therefore drop the compatibility code. MFC after: 7 days --- sys/dev/netmap/if_ptnet.c | 9 ----- sys/dev/netmap/netmap_freebsd.c | 24 +----------- sys/dev/netmap/netmap_generic.c | 4 -- sys/dev/netmap/netmap_kern.h | 81 ----------------------------------------- 4 files changed, 1 insertion(+), 117 deletions(-) diff --git a/sys/dev/netmap/if_ptnet.c b/sys/dev/netmap/if_ptnet.c index fa0ea1476a3c..be75da2db9dc 100644 --- a/sys/dev/netmap/if_ptnet.c +++ b/sys/dev/netmap/if_ptnet.c @@ -93,12 +93,7 @@ #error "INET not defined, cannot support offloadings" #endif -#if __FreeBSD_version >= 1100000 static uint64_t ptnet_get_counter(if_t, ift_counter); -#else -typedef struct ifnet *if_t; -#define if_getsoftc(_ifp) (_ifp)->if_softc -#endif //#define PTNETMAP_STATS //#define DEBUG @@ -418,9 +413,7 @@ ptnet_attach(device_t dev) ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST | IFF_SIMPLEX; ifp->if_init = ptnet_init; ifp->if_ioctl = ptnet_ioctl; -#if __FreeBSD_version >= 1100000 ifp->if_get_counter = ptnet_get_counter; -#endif ifp->if_transmit = ptnet_transmit; ifp->if_qflush = ptnet_qflush; @@ -1014,7 +1007,6 @@ ptnet_media_change(if_t ifp) return 0; } -#if __FreeBSD_version >= 1100000 static uint64_t ptnet_get_counter(if_t ifp, ift_counter cnt) { @@ -1052,7 +1044,6 @@ ptnet_get_counter(if_t ifp, ift_counter cnt) return (if_get_counter_default(ifp, cnt)); } } -#endif #ifdef PTNETMAP_STATS diff --git a/sys/dev/netmap/netmap_freebsd.c b/sys/dev/netmap/netmap_freebsd.c index 383c733cc159..7a3f2ceacdbb 100644 --- a/sys/dev/netmap/netmap_freebsd.c +++ b/sys/dev/netmap/netmap_freebsd.c @@ -211,11 +211,7 @@ nm_os_ifnet_fini(void) unsigned nm_os_ifnet_mtu(struct ifnet *ifp) { -#if __FreeBSD_version < 1100030 - return ifp->if_data.ifi_mtu; -#else /* __FreeBSD_version >= 1100030 */ return ifp->if_mtu; -#endif } rawsum_t @@ -423,26 +419,10 @@ nm_os_generic_xmit_frame(struct nm_os_gen_arg *a) struct ifnet *ifp = a->ifp; struct mbuf *m = a->m; -#if __FreeBSD_version < 1100000 - /* - * Old FreeBSD versions. The mbuf has a cluster attached, - * we need to copy from the cluster to the netmap buffer. - */ - if (MBUF_REFCNT(m) != 1) { - nm_prerr("invalid refcnt %d for %p", MBUF_REFCNT(m), m); - panic("in generic_xmit_frame"); - } - if (m->m_ext.ext_size < len) { - nm_prlim(2, "size %d < len %d", m->m_ext.ext_size, len); - len = m->m_ext.ext_size; - } - bcopy(a->addr, m->m_data, len); -#else /* __FreeBSD_version >= 1100000 */ - /* New FreeBSD versions. Link the external storage to + /* Link the external storage to * the netmap buffer, so that no copy is necessary. */ m->m_ext.ext_buf = m->m_data = a->addr; m->m_ext.ext_size = len; -#endif /* __FreeBSD_version >= 1100000 */ m->m_flags |= M_PKTHDR; m->m_len = m->m_pkthdr.len = len; @@ -460,13 +440,11 @@ nm_os_generic_xmit_frame(struct nm_os_gen_arg *a) } -#if __FreeBSD_version >= 1100005 struct netmap_adapter * netmap_getna(if_t ifp) { return (NA((struct ifnet *)ifp)); } -#endif /* __FreeBSD_version >= 1100005 */ /* * The following two functions are empty until we have a generic diff --git a/sys/dev/netmap/netmap_generic.c b/sys/dev/netmap/netmap_generic.c index 2068e9fd4359..a57da84e1d24 100644 --- a/sys/dev/netmap/netmap_generic.c +++ b/sys/dev/netmap/netmap_generic.c @@ -482,11 +482,7 @@ generic_mbuf_destructor(struct mbuf *m) * txsync. */ netmap_generic_irq(na, r, NULL); #ifdef __FreeBSD__ -#if __FreeBSD_version <= 1200050 - void_mbuf_dtor(m, NULL, NULL); -#else /* __FreeBSD_version >= 1200051 */ void_mbuf_dtor(m); -#endif /* __FreeBSD_version >= 1200051 */ #endif } diff --git a/sys/dev/netmap/netmap_kern.h b/sys/dev/netmap/netmap_kern.h index e5be1c793f4d..0c658c1e046d 100644 --- a/sys/dev/netmap/netmap_kern.h +++ b/sys/dev/netmap/netmap_kern.h @@ -110,23 +110,12 @@ #define NM_ATOMIC_TEST_AND_SET(p) (!atomic_cmpset_acq_int((p), 0, 1)) #define NM_ATOMIC_CLEAR(p) atomic_store_rel_int((p), 0) -#if __FreeBSD_version >= 1100030 #define WNA(_ifp) (_ifp)->if_netmap -#else /* older FreeBSD */ -#define WNA(_ifp) (_ifp)->if_pspare[0] -#endif /* older FreeBSD */ -#if __FreeBSD_version >= 1100005 struct netmap_adapter *netmap_getna(if_t ifp); -#endif -#if __FreeBSD_version >= 1100027 #define MBUF_REFCNT(m) ((m)->m_ext.ext_count) #define SET_MBUF_REFCNT(m, x) (m)->m_ext.ext_count = x -#else -#define MBUF_REFCNT(m) ((m)->m_ext.ref_cnt ? *((m)->m_ext.ref_cnt) : -1) -#define SET_MBUF_REFCNT(m, x) *((m)->m_ext.ref_cnt) = x -#endif #define MBUF_QUEUED(m) 1 @@ -2390,69 +2379,6 @@ ptnet_sync_tail(struct nm_csb_ktoa *ktoa, struct netmap_kring *kring) #ifdef __FreeBSD__ /* * FreeBSD mbuf allocator/deallocator in emulation mode: - */ -#if __FreeBSD_version < 1100000 - -/* - * For older versions of FreeBSD: - * - * We allocate EXT_PACKET mbuf+clusters, but need to set M_NOFREE - * so that the destructor, if invoked, will not free the packet. - * In principle we should set the destructor only on demand, - * but since there might be a race we better do it on allocation. - * As a consequence, we also need to set the destructor or we - * would leak buffers. - */ - -/* mbuf destructor, also need to change the type to EXT_EXTREF, - * add an M_NOFREE flag, and then clear the flag and - * chain into uma_zfree(zone_pack, mf) - * (or reinstall the buffer ?) - */ -#define SET_MBUF_DESTRUCTOR(m, fn) do { \ - (m)->m_ext.ext_free = (void *)fn; \ - (m)->m_ext.ext_type = EXT_EXTREF; \ -} while (0) - -static int -void_mbuf_dtor(struct mbuf *m, void *arg1, void *arg2) -{ - /* restore original mbuf */ - m->m_ext.ext_buf = m->m_data = m->m_ext.ext_arg1; - m->m_ext.ext_arg1 = NULL; - m->m_ext.ext_type = EXT_PACKET; - m->m_ext.ext_free = NULL; - if (MBUF_REFCNT(m) == 0) - SET_MBUF_REFCNT(m, 1); - uma_zfree(zone_pack, m); - - return 0; -} - -static inline struct mbuf * -nm_os_get_mbuf(struct ifnet *ifp, int len) -{ - struct mbuf *m; - - (void)ifp; - m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); - if (m) { - /* m_getcl() (mb_ctor_mbuf) has an assert that checks that - * M_NOFREE flag is not specified as third argument, - * so we have to set M_NOFREE after m_getcl(). */ - m->m_flags |= M_NOFREE; - m->m_ext.ext_arg1 = m->m_ext.ext_buf; // XXX save - m->m_ext.ext_free = (void *)void_mbuf_dtor; - m->m_ext.ext_type = EXT_EXTREF; - nm_prdis(5, "create m %p refcnt %d", m, MBUF_REFCNT(m)); - } - return m; -} - -#else /* __FreeBSD_version >= 1100000 */ - -/* - * Newer versions of FreeBSD, using a straightforward scheme. * * We allocate mbufs with m_gethdr(), since the mbuf header is needed * by the driver. We also attach a customly-provided external storage, @@ -2465,13 +2391,7 @@ nm_os_get_mbuf(struct ifnet *ifp, int len) * has a KASSERT(), checking that the mbuf dtor function is not NULL. */ -#if __FreeBSD_version <= 1200050 -static void void_mbuf_dtor(struct mbuf *m, void *arg1, void *arg2) { } -#else /* __FreeBSD_version >= 1200051 */ -/* The arg1 and arg2 pointers argument were removed by r324446, which - * in included since version 1200051. */ static void void_mbuf_dtor(struct mbuf *m) { } -#endif /* __FreeBSD_version >= 1200051 */ #define SET_MBUF_DESTRUCTOR(m, fn) do { \ (m)->m_ext.ext_free = (fn != NULL) ? \ @@ -2497,7 +2417,6 @@ nm_os_get_mbuf(struct ifnet *ifp, int len) return m; } -#endif /* __FreeBSD_version >= 1100000 */ #endif /* __FreeBSD__ */ struct nmreq_option * nmreq_getoption(struct nmreq_header *, uint16_t);