From owner-svn-src-all@freebsd.org Sat Jun 15 11:07:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B9D315C4296; Sat, 15 Jun 2019 11:07:42 +0000 (UTC) (envelope-from marius@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2083671743; Sat, 15 Jun 2019 11:07:42 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E999E26225; Sat, 15 Jun 2019 11:07:41 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5FB7f64039971; Sat, 15 Jun 2019 11:07:41 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5FB7f6N039968; Sat, 15 Jun 2019 11:07:41 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201906151107.x5FB7f6N039968@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sat, 15 Jun 2019 11:07:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349055 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 349055 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2083671743 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jun 2019 11:07:42 -0000 Author: marius Date: Sat Jun 15 11:07:41 2019 New Revision: 349055 URL: https://svnweb.freebsd.org/changeset/base/349055 Log: - Replace unused and only ever written to members of public iflib(9) structs with placeholders (in the latter case, IFLIB_MAX_TX_BYTES etc. are also only ever used for these write-only members if at all, so both these macros and members can just go). Using these spares may render it possible to merge certain iflib(9) fixes to stable/12. Otherwise, changes extending struct if_irq or struct if_shared_ctx in any way would break KBI as instances of these are allocated by the driver front-ends (by contrast, struct if_pkt_info as well as struct if_softc_ctx instances are provided by iflib(9) and, thus, may grow at least at the end without breaking KBI). - Make the pvi_name in struct pci_vendor_info const char * as device identifiers in hardware lookup tables aren't to be expected to ever change at runtime. - Similarly, make the pci_vendor_info_t of struct if_shared_ctx which is used to point to the struct pci_vendor_info arrays provided by the driver front-ends const. - Remove the ETH_ADDR_LEN macro from iflib.h; this was duplicating ETHER_ADDR_LEN of with iflib(9) actually only consuming the latter macro. - Make the name argument of iflib_io_tqg_attach(9) const, matching the taskqgroup_attach_cpu(9) this function wraps as well as e. g. iflib_config_gtask_init(9). - Remove the orphaned iflib_qset_lock_get() prototype. - Remove some extraneous empty lines. Modified: head/sys/net/iflib.c head/sys/net/iflib.h head/sys/net/iflib_private.h Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Sat Jun 15 09:45:00 2019 (r349054) +++ head/sys/net/iflib.c Sat Jun 15 11:07:41 2019 (r349055) @@ -376,7 +376,6 @@ struct iflib_fl { uint64_t ifl_cl_dequeued; #endif /* implicit pad */ - bitstr_t *ifl_rx_bitmap; qidx_t ifl_fragidx; /* constant */ @@ -1250,7 +1249,6 @@ iflib_netmap_timer_adjust(if_ctx_t ctx, iflib_txq_t tx #define netmap_rx_irq(ifp, qid, budget) (0) #define netmap_tx_irq(ifp, qid) do {} while (0) #define iflib_netmap_timer_adjust(ctx, txq, reset_on) - #endif #if defined(__i386__) || defined(__amd64__) @@ -1537,17 +1535,17 @@ _iflib_irq_alloc(if_ctx_t ctx, if_irq_t irq, int rid, driver_filter_t filter, driver_intr_t handler, void *arg, const char *name) { - int rc, flags; struct resource *res; void *tag = NULL; device_t dev = ctx->ifc_dev; + int flags, i, rc; flags = RF_ACTIVE; if (ctx->ifc_flags & IFC_LEGACY) flags |= RF_SHAREABLE; MPASS(rid < 512); - irq->ii_rid = rid; - res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &irq->ii_rid, flags); + i = rid; + res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &i, flags); if (res == NULL) { device_printf(dev, "failed to allocate IRQ for rid %d, name %s.\n", rid, name); @@ -1569,7 +1567,6 @@ _iflib_irq_alloc(if_ctx_t ctx, if_irq_t irq, int rid, return (0); } - /********************************************************************* * * Allocate DMA resources for TX buffers as well as memory for the TX @@ -4332,12 +4329,10 @@ iflib_led_func(void *arg, int onoff) int iflib_device_probe(device_t dev) { - pci_vendor_info_t *ent; - - uint16_t pci_vendor_id, pci_device_id; - uint16_t pci_subvendor_id, pci_subdevice_id; - uint16_t pci_rev_id; + const pci_vendor_info_t *ent; if_shared_ctx_t sctx; + uint16_t pci_device_id, pci_rev_id, pci_subdevice_id, pci_subvendor_id; + uint16_t pci_vendor_id; if ((sctx = DEVICE_REGISTER(dev)) == NULL || sctx->isc_magic != IFLIB_MAGIC) return (ENOTSUP); @@ -4397,8 +4392,6 @@ iflib_reset_qvalues(if_ctx_t ctx) device_t dev = ctx->ifc_dev; int i; - scctx->isc_txrx_budget_bytes_max = IFLIB_MAX_TX_BYTES; - scctx->isc_tx_qdepth = IFLIB_DEFAULT_TX_QDEPTH; if (ctx->ifc_sysctl_ntxqs != 0) scctx->isc_ntxqsets = ctx->ifc_sysctl_ntxqs; if (ctx->ifc_sysctl_nrxqs != 0) @@ -6037,15 +6030,14 @@ iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filte struct resource *res; struct taskqgroup *tqg; gtask_fn_t *fn; - int tqrid; void *q; - int err; + int err, tqrid; q = &ctx->ifc_rxqs[0]; info = &rxq[0].ifr_filter_info; gtask = &rxq[0].ifr_task; tqg = qgroup_if_io_tqg; - tqrid = irq->ii_rid = *rid; + tqrid = *rid; fn = _task_fn_rx; ctx->ifc_flags |= IFC_LEGACY; @@ -6112,7 +6104,7 @@ iflib_iov_intr_deferred(if_ctx_t ctx) } void -iflib_io_tqg_attach(struct grouptask *gt, void *uniq, int cpu, char *name) +iflib_io_tqg_attach(struct grouptask *gt, void *uniq, int cpu, const char *name) { taskqgroup_attach_cpu(qgroup_if_io_tqg, gt, uniq, cpu, NULL, NULL, Modified: head/sys/net/iflib.h ============================================================================== --- head/sys/net/iflib.h Sat Jun 15 09:45:00 2019 (r349054) +++ head/sys/net/iflib.h Sat Jun 15 11:07:41 2019 (r349055) @@ -132,12 +132,12 @@ typedef struct if_pkt_info { uint8_t ipi_mflags; /* packet mbuf flags */ uint32_t ipi_tcp_seq; /* tcp seqno */ - uint32_t ipi_tcp_sum; /* tcp csum */ + uint32_t __spare0__; } *if_pkt_info_t; typedef struct if_irq { struct resource *ii_res; - int ii_rid; + int __spare0__; void *ii_tag; } *if_irq_t; @@ -166,7 +166,7 @@ typedef struct pci_vendor_info { uint32_t pvi_subdevice_id; uint32_t pvi_rev_id; uint32_t pvi_class_mask; - caddr_t pvi_name; + const char *pvi_name; } pci_vendor_info_t; #define PVID(vendor, devid, name) {vendor, devid, 0, 0, 0, 0, name} @@ -194,9 +194,8 @@ typedef struct if_softc_ctx { int isc_vectors; int isc_nrxqsets; int isc_ntxqsets; - uint8_t isc_min_tx_latency; /* disable doorbell update batching */ - uint8_t isc_rx_mvec_enable; /* generate mvecs on rx */ - uint32_t isc_txrx_budget_bytes_max; + uint16_t __spare0__; + uint32_t __spare1__; int isc_msix_bar; /* can be model specific - initialize in attach_pre */ int isc_tx_nsegments; /* can be model specific - initialize in attach_pre */ int isc_ntxd[8]; @@ -218,20 +217,25 @@ typedef struct if_softc_ctx { int isc_rss_table_mask; int isc_nrxqsets_max; int isc_ntxqsets_max; - uint32_t isc_tx_qdepth; + uint32_t __spare2__; iflib_intr_mode_t isc_intr; uint16_t isc_max_frame_size; /* set at init time by driver */ uint16_t isc_min_frame_size; /* set at init time by driver, only used if IFLIB_NEED_ETHER_PAD is set. */ uint32_t isc_pause_frames; /* set by driver for iflib_timer to detect */ - pci_vendor_info_t isc_vendor_info; /* set by iflib prior to attach_pre */ + uint32_t __spare3__; + uint32_t __spare4__; + uint32_t __spare5__; + uint32_t __spare6__; + uint32_t __spare7__; + uint32_t __spare8__; + caddr_t __spare9__; int isc_disable_msix; if_txrx_t isc_txrx; struct ifmedia *isc_media; } *if_softc_ctx_t; - /* * Initialization values for device */ @@ -249,7 +253,7 @@ struct if_shared_ctx { int isc_admin_intrcnt; /* # of admin/link interrupts */ /* fields necessary for probe */ - pci_vendor_info_t *isc_vendor_info; + const pci_vendor_info_t *isc_vendor_info; const char *isc_driver_version; /* optional function to transform the read values to match the table*/ void (*isc_parse_devinfo) (uint16_t *device_id, uint16_t *subvendor_id, @@ -265,7 +269,7 @@ struct if_shared_ctx { int isc_nfl __aligned(CACHE_LINE_SIZE); int isc_ntxqs; /* # of tx queues per tx qset - usually 1 */ int isc_nrxqs; /* # of rx queues per rx qset - intel 1, chelsio 2, broadcom 3 */ - int isc_rx_process_limit; + int __spare0__; int isc_tx_reclaim_thresh; int isc_flags; const char *isc_name; @@ -289,11 +293,6 @@ typedef enum { IFLIB_INTR_IOV, } iflib_intr_type_t; -#ifndef ETH_ADDR_LEN -#define ETH_ADDR_LEN 6 -#endif - - /* * Interface has a separate command queue for RX */ @@ -368,7 +367,6 @@ typedef enum { */ #define IFLIB_DRIVER_MEDIA 0x20000 - /* * field accessors */ @@ -406,7 +404,6 @@ int iflib_device_shutdown(device_t); */ int iflib_device_probe_vendor(device_t); - int iflib_device_iov_init(device_t, uint16_t, const nvlist_t *); void iflib_device_iov_uninit(device_t); int iflib_device_iov_add_vf(device_t, uint16_t, const nvlist_t *); @@ -418,8 +415,6 @@ int iflib_device_iov_add_vf(device_t, uint16_t, const int iflib_device_register(device_t dev, void *softc, if_shared_ctx_t sctx, if_ctx_t *ctxp); int iflib_device_deregister(if_ctx_t); - - int iflib_irq_alloc(if_ctx_t, if_irq_t, int, driver_filter_t, void *filter_arg, driver_intr_t, void *arg, const char *name); int iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, int rid, iflib_intr_type_t type, driver_filter_t *filter, @@ -428,34 +423,28 @@ void iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_ void iflib_irq_free(if_ctx_t ctx, if_irq_t irq); -void iflib_io_tqg_attach(struct grouptask *gt, void *uniq, int cpu, char *name); +void iflib_io_tqg_attach(struct grouptask *gt, void *uniq, int cpu, + const char *name); void iflib_config_gtask_init(void *ctx, struct grouptask *gtask, gtask_fn_t *fn, const char *name); - void iflib_config_gtask_deinit(struct grouptask *gtask); - - void iflib_tx_intr_deferred(if_ctx_t ctx, int txqid); void iflib_rx_intr_deferred(if_ctx_t ctx, int rxqid); void iflib_admin_intr_deferred(if_ctx_t ctx); void iflib_iov_intr_deferred(if_ctx_t ctx); - void iflib_link_state_change(if_ctx_t ctx, int linkstate, uint64_t baudrate); int iflib_dma_alloc(if_ctx_t ctx, int size, iflib_dma_info_t dma, int mapflags); int iflib_dma_alloc_align(if_ctx_t ctx, int size, int align, iflib_dma_info_t dma, int mapflags); void iflib_dma_free(iflib_dma_info_t dma); - int iflib_dma_alloc_multi(if_ctx_t ctx, int *sizes, iflib_dma_info_t *dmalist, int mapflags, int count); void iflib_dma_free_multi(iflib_dma_info_t *dmalist, int count); - struct sx *iflib_ctx_lock_get(if_ctx_t); -struct mtx *iflib_qset_lock_get(if_ctx_t, uint16_t); void iflib_led_create(if_ctx_t ctx); @@ -467,4 +456,5 @@ void iflib_add_int_delay_sysctl(if_ctx_t, const char * */ if_pseudo_t iflib_clone_register(if_shared_ctx_t); void iflib_clone_deregister(if_pseudo_t); + #endif /* __IFLIB_H_ */ Modified: head/sys/net/iflib_private.h ============================================================================== --- head/sys/net/iflib_private.h Sat Jun 15 09:45:00 2019 (r349054) +++ head/sys/net/iflib_private.h Sat Jun 15 11:07:41 2019 (r349055) @@ -28,9 +28,8 @@ */ #ifndef __NET_IFLIB_PRIVATE_H_ -#define __NET_IFLIB_PRIVATE_H_ +#define __NET_IFLIB_PRIVATE_H_ - #define IFC_LEGACY 0x001 #define IFC_QFLUSH 0x002 #define IFC_MULTISEG 0x004 @@ -40,18 +39,13 @@ #define IFC_PREFETCH 0x040 #define IFC_DO_RESET 0x080 #define IFC_DO_WATCHDOG 0x100 -#define IFC_CHECK_HUNG 0x200 +#define IFC_SPARE0 0x200 #define IFC_PSEUDO 0x400 #define IFC_IN_DETACH 0x800 -#define IFC_NETMAP_TX_IRQ 0x80000000 +#define IFC_NETMAP_TX_IRQ 0x80000000 MALLOC_DECLARE(M_IFLIB); - -#define IFLIB_MAX_TX_BYTES (2*1024*1024) -#define IFLIB_MIN_TX_BYTES (8*1024) -#define IFLIB_DEFAULT_TX_QDEPTH 2048 - struct iflib_cloneattach_ctx { struct if_clone *cc_ifc;