From nobody Tue Mar 14 22:04:44 2023 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 4Pbncr5r6kz3xY6L; Tue, 14 Mar 2023 22:04:44 +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 4Pbncr5JKmz3v6m; Tue, 14 Mar 2023 22:04:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678831484; 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=SvRA5im1ralkeLjaWqMiGB6Oe2+y1WYKhio3dYC/LMk=; b=nRLbPwAbwEEr0v+poZzcdXt6CjL2Zfj6REIQz32fNanLitND+f4QvG4FUoBRtqcLP9T4Tq YGVahZRvkWE56jlZWlDsHJ56tRROGt9+Vma6DghFnRwhPiqnWvjCJ2dv2Pav6u/LzpZ3m4 O0sflx1+fqrmigsU4znMOJkFFu2ZobRqqocBBmPib72Vg0bAsizfZh0MlNTtCN4vM1ogzZ AbFaPLWBw1fxqmhETm6x1BQtWbMfbWB20LAejSJSUEdREDKygC2KJktQkS5BPjuGbbVX13 LevADUfv8CD5SWP1gG5eZpsWh+kyna6jQNRJBiGBZ33UJQcQEWfdTzYC12PV+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678831484; 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=SvRA5im1ralkeLjaWqMiGB6Oe2+y1WYKhio3dYC/LMk=; b=ohBzJS6sBORR33GuZoFV2CJvDyP5r1MUKzQp+jGsgG5hF7dtgxnNnbCvwS1L0zmVZ2qtMZ y5zkObW28eIiosfBpu+8o8hEGL5qiOP66lyAjvdQAlSSGXCvUYVZlM1U1YoD2UdDljlbvr rDVjwb8qlr/vzZswnBjp5k4KG8yGhNnU0aAaXSl+3vnl68CHVjlJicPC8gZB1p5YSbmjeh uC9pHF5afeBFSUOYp402utnmrn2s8n5CvhQukp22k7IaM94ApoSWvRUwB5XurDqaboE/s3 0TlpgeJoHtMx8uXJ1+g/ypbqttCig58XCSJXt8XR06sE1oLo0aodIOeQxlMtgw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678831484; a=rsa-sha256; cv=none; b=qlTdRgv8QCRMhmU8EtBi0OnlLj06lwKXx2iHzo6TrT/P9QoLkYO9nNlF6k6r/FveeXUe8p E//B8LJXLWOKliG/5JdThT2U6KH3oV/nvkV04Zgc4nze3Fv22xdVMS1NzgHTKMR24Blo8t W4GIFc8QlitTg8Js5u1Ev7nuecQG8CEl4mBqbTqOo7sII+k76uA1Zir1Z3kcwluGutgNnM wRDK5AZmS9jVxmSh60AG9XOAXpG+O2Z10sTJ1lXybz5tyl573LsHT7atEZlFvk3c8w/0QW KNnq44RMLOvMG97SLrgHfhpNpPFsLOQInJJ/BtU6kwkQd2ejcvMlNknYNEKm1g== 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 4Pbncr4KxJzsJm; Tue, 14 Mar 2023 22:04:44 +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 32EM4ii0016831; Tue, 14 Mar 2023 22:04:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32EM4iCH016830; Tue, 14 Mar 2023 22:04:44 GMT (envelope-from git) Date: Tue, 14 Mar 2023 22:04:44 GMT Message-Id: <202303142204.32EM4iCH016830@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: 6c9fe357435d - main - netmap: get rid of save_if_input for emulated adapters 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: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6c9fe357435db6408ec6b01221b9ff9e7e9b0ff1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=6c9fe357435db6408ec6b01221b9ff9e7e9b0ff1 commit 6c9fe357435db6408ec6b01221b9ff9e7e9b0ff1 Author: Vincenzo Maffione AuthorDate: 2023-03-14 21:59:23 +0000 Commit: Vincenzo Maffione CommitDate: 2023-03-14 22:04:23 +0000 netmap: get rid of save_if_input for emulated adapters The save_if_input function pointer was meant to save the previous value of ifp->if_input before replacing it with the emulated adapter hook. However, the same pointer value is already stored in the if_input field of the netmap_adapter struct, to be used for host TX ring processing. Reuse the netmap_adapter if_input field to simplify the code and save some space. MFC after: 14 days --- sys/dev/netmap/netmap_freebsd.c | 20 ++------------------ sys/dev/netmap/netmap_kern.h | 3 --- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/sys/dev/netmap/netmap_freebsd.c b/sys/dev/netmap/netmap_freebsd.c index 296c37576407..4b3b1a6edacd 100644 --- a/sys/dev/netmap/netmap_freebsd.c +++ b/sys/dev/netmap/netmap_freebsd.c @@ -327,9 +327,7 @@ freebsd_generic_rx_handler(if_t ifp, struct mbuf *m) stolen = generic_rx_handler(ifp, m); if (!stolen) { - struct netmap_generic_adapter *gna = - (struct netmap_generic_adapter *)NA(ifp); - gna->save_if_input(ifp, m); + NA(ifp)->if_input(ifp, m); } } @@ -346,26 +344,12 @@ nm_os_catch_rx(struct netmap_generic_adapter *gna, int intercept) nm_os_ifnet_lock(); if (intercept) { - if (gna->save_if_input) { - nm_prerr("RX on %s already intercepted", na->name); - ret = EBUSY; /* already set */ - goto out; - } if_setcapenablebit(ifp, IFCAP_NETMAP, 0); - gna->save_if_input = if_getinputfn(ifp); if_setinputfn(ifp, freebsd_generic_rx_handler); } else { - if (!gna->save_if_input) { - nm_prerr("Failed to undo RX intercept on %s", - na->name); - ret = EINVAL; /* not saved */ - goto out; - } if_setcapenablebit(ifp, 0, IFCAP_NETMAP); - if_setinputfn(ifp, gna->save_if_input); - gna->save_if_input = NULL; + if_setinputfn(ifp, na->if_input); } -out: nm_os_ifnet_unlock(); return ret; diff --git a/sys/dev/netmap/netmap_kern.h b/sys/dev/netmap/netmap_kern.h index c34733f912fd..7c68c79c61ef 100644 --- a/sys/dev/netmap/netmap_kern.h +++ b/sys/dev/netmap/netmap_kern.h @@ -1042,11 +1042,8 @@ struct netmap_generic_adapter { /* emulated device */ struct netmap_adapter *prev; /* Emulated netmap adapters support: - * - save_if_input saves the if_input hook (FreeBSD); * - mit implements rx interrupt mitigation; */ - void (*save_if_input)(if_t, struct mbuf *); - struct nm_generic_mit *mit; #ifdef linux netdev_tx_t (*save_start_xmit)(struct mbuf *, if_t);