From nobody Sat Dec 31 12:07:09 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 4Nkgq20hLNz2nK6N; Sat, 31 Dec 2022 12:07:10 +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 4Nkgq206jXz4J3r; Sat, 31 Dec 2022 12:07:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672488430; 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=UKdn1uPYqn9w1paZgAl246jUvhk49gDvQs8CTl4A+oU=; b=FrpFmNIGoY2YMdwzrCF6FK2lyzptA38VF83rc9PZfxngQP0NKXDhN8EzV3cZ8T0AQ6CVTK 1AE2WAB3rfNHQ/4mCoOs957kUE/I46Bee35MO2r1IpXTofvgllKMV0557cbjFOcOSir9mI pVZilvoQC5Xl0CJjCDpI5eJCr70DgYTusZDNgxkpdwXWreN0OjHrUoB0oo4Yp5zDEVXgGT d5XQjGzl5k+os8xyOCPHorXH7kx0ynAVwkEYYPLha8eK8+pYnUNTvMZoA/cB1u2S+9THcA lA+mIIrRZcprAayByIDX93XlEcJtQG4mQDBBhnphOZ5rfFxsUZvBbfbiKuNz+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672488430; 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=UKdn1uPYqn9w1paZgAl246jUvhk49gDvQs8CTl4A+oU=; b=YKmkT/l6nhraRhuG7OWuG3AHk/nmLBdZIBkz8w910rqA+uZlOg89F5wh/N64YQzcmw7J7H L40v+IuZCJZrpfNg6AkB88EQgVI+cc9YQeqfdq6iMdu3A4M4Fc+Rr02vXx0OHhO/7caR6J oEf+hMzTTYnbJlr7UaR6aIq+QqTlwncePlQIxfAYfie10GRpqc4ZXVZDqEbgiPjugKTi2E npXH4sWiPPvmfUfsBmfH+EnYte/qjFouDU8jSZ66ICBxpgzvmqy+ovRIlzF4Qs3n0d9tg4 c9H5UjiRg++YHtl9qvDyYbZLTyx9YKLajloWvlmD++MlzI5u5nbKBADld7rcgw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1672488430; a=rsa-sha256; cv=none; b=b2sj67cZdr//nwgT0DrsRMx1+NpPu1/NPIGrAbxViTBzNpvWvNxfPyQ/Q5YQkW5U2oO6Ff Q/PKyIByHKP0paF506J1ZzfyqHJXP8K8Xd5QDQfz0dO1SYUkjDWISXKkY4sD3hYKTu5LoX Pb8D9ccohbtPt5SMCL1sJ77iWTrPaPeNHssacQ0IvR+EoVrnVwCLPqqMP0Y3KuQqv18Amc sD2rNH4vGy+smtR5fHZ1mMVkSA6EvWdRyxjUxyC3jP18tosT7iSA92tY7P5vhHpWdX3RaB vWTP/VNWvJjEuEs5Z2rY65u4YkmSJalYzsVCG2Livaj4M1Xik+u90n9HwdqQIg== 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 4Nkgq16LrZznv9; Sat, 31 Dec 2022 12:07:09 +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 2BVC79G8041392; Sat, 31 Dec 2022 12:07:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BVC79WJ041391; Sat, 31 Dec 2022 12:07:09 GMT (envelope-from git) Date: Sat, 31 Dec 2022 12:07:09 GMT Message-Id: <202212311207.2BVC79WJ041391@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vincenzo Maffione Subject: git: bdf79b356216 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: bdf79b3562169ffec05613b1ad43129182b02029 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=bdf79b3562169ffec05613b1ad43129182b02029 commit bdf79b3562169ffec05613b1ad43129182b02029 Author: Vincenzo Maffione AuthorDate: 2022-12-24 14:31:14 +0000 Commit: Vincenzo Maffione CommitDate: 2022-12-31 12:06:22 +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 (cherry picked from commit 3da494d3246e30a19d2107c8bb8a293ffd5a9da6) --- 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 99d21c38f8ab..5a85027d7197 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 @@ -419,9 +414,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; @@ -1015,7 +1008,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) { @@ -1053,7 +1045,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 2cedea4440fe..c1e19bc1a4a5 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 09ba550cae92..bf582fab875d 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 848562d5d1f9..ea124a332af8 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 @@ -2301,69 +2290,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, @@ -2376,13 +2302,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) ? \ @@ -2408,7 +2328,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);