Date: Thu, 30 Apr 2020 03:58:30 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r360487 - in projects/nfs-over-tls/sys: arm64/arm64 arm64/rockchip cam cam/nvme conf dev/dwc dev/nvme kern modules/cxgb/cxgb modules/cxgbe/iw_cxgbe modules/rdma/krping modules/sfxge net... Message-ID: <202004300358.03U3wUSu052336@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Thu Apr 30 03:58:30 2020 New Revision: 360487 URL: https://svnweb.freebsd.org/changeset/base/360487 Log: Merge in an up to date kernel from head. Added: projects/nfs-over-tls/sys/net/route/route_ddb.c - copied unchanged from r360486, head/sys/net/route/route_ddb.c projects/nfs-over-tls/sys/net/route/route_temporal.c - copied unchanged from r360486, head/sys/net/route/route_temporal.c projects/nfs-over-tls/sys/net/route/route_var.h - copied unchanged from r360486, head/sys/net/route/route_var.h Deleted: projects/nfs-over-tls/sys/net/route_temporal.c projects/nfs-over-tls/sys/net/route_var.h Modified: projects/nfs-over-tls/sys/arm64/arm64/gic_v3_reg.h projects/nfs-over-tls/sys/arm64/arm64/gicv3_its.c projects/nfs-over-tls/sys/arm64/rockchip/rk805.c projects/nfs-over-tls/sys/arm64/rockchip/rk_iodomain.c projects/nfs-over-tls/sys/cam/cam_ccb.h projects/nfs-over-tls/sys/cam/nvme/nvme_da.c projects/nfs-over-tls/sys/conf/Makefile.amd64 projects/nfs-over-tls/sys/conf/files projects/nfs-over-tls/sys/conf/files.amd64 projects/nfs-over-tls/sys/dev/dwc/if_dwc.c projects/nfs-over-tls/sys/dev/dwc/if_dwcvar.h projects/nfs-over-tls/sys/dev/nvme/nvme_ctrlr.c projects/nfs-over-tls/sys/dev/nvme/nvme_sim.c projects/nfs-over-tls/sys/kern/kern_cpu.c projects/nfs-over-tls/sys/kern/kern_sendfile.c projects/nfs-over-tls/sys/modules/cxgb/cxgb/Makefile projects/nfs-over-tls/sys/modules/cxgbe/iw_cxgbe/Makefile projects/nfs-over-tls/sys/modules/rdma/krping/Makefile projects/nfs-over-tls/sys/modules/sfxge/Makefile projects/nfs-over-tls/sys/net/if_var.h projects/nfs-over-tls/sys/net/radix_mpath.c projects/nfs-over-tls/sys/net/radix_mpath.h projects/nfs-over-tls/sys/net/route.c projects/nfs-over-tls/sys/net/route.h projects/nfs-over-tls/sys/net/route/nhop.c projects/nfs-over-tls/sys/net/route/nhop_ctl.c projects/nfs-over-tls/sys/net/route/route_ctl.c projects/nfs-over-tls/sys/net/route/route_helpers.c projects/nfs-over-tls/sys/net/rtsock.c projects/nfs-over-tls/sys/netgraph/bluetooth/include/ng_hci.h projects/nfs-over-tls/sys/netinet/in_fib.c projects/nfs-over-tls/sys/netinet/in_rmx.c projects/nfs-over-tls/sys/netinet/in_var.h projects/nfs-over-tls/sys/netinet/ip_input.c projects/nfs-over-tls/sys/netinet/ip_output.c projects/nfs-over-tls/sys/netinet/tcp_input.c projects/nfs-over-tls/sys/netinet/tcp_output.c projects/nfs-over-tls/sys/netinet/tcp_stacks/bbr.c projects/nfs-over-tls/sys/netinet/tcp_stacks/rack.c projects/nfs-over-tls/sys/netinet6/in6_fib.c projects/nfs-over-tls/sys/netinet6/in6_rmx.c projects/nfs-over-tls/sys/netinet6/in6_var.h projects/nfs-over-tls/sys/netinet6/nd6.c projects/nfs-over-tls/sys/netinet6/nd6_rtr.c projects/nfs-over-tls/sys/netpfil/ipfw/ip_fw_table_algo.c projects/nfs-over-tls/sys/nfs/bootp_subr.c projects/nfs-over-tls/sys/vm/vm_page.c projects/nfs-over-tls/sys/vm/vm_page.h Directory Properties: projects/nfs-over-tls/sys/ (props changed) Modified: projects/nfs-over-tls/sys/arm64/arm64/gic_v3_reg.h ============================================================================== --- projects/nfs-over-tls/sys/arm64/arm64/gic_v3_reg.h Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/arm64/arm64/gic_v3_reg.h Thu Apr 30 03:58:30 2020 (r360487) @@ -220,6 +220,8 @@ (rev) << GITS_IIDR_REVISION_SHIFT | \ (impl) << GITS_IIDR_IMPLEMENTOR_SHIFT) +#define GITS_IIDR_IMPL_ARM (0x43B) +#define GITS_IIDR_PROD_GIC500 (0x0) #define GITS_IIDR_IMPL_CAVIUM (0x34c) #define GITS_IIDR_PROD_THUNDER (0xa1) #define GITS_IIDR_VAR_THUNDER_1 (0x0) @@ -359,6 +361,18 @@ #define LPI_CONF_PRIO_MASK (0xFC) #define LPI_CONF_GROUP1 (1 << 1) #define LPI_CONF_ENABLE (1 << 0) + +/* + * GIC 500 ITS tracking facility + */ +#define GITS_TRKCTLR 0xC000 +#define GITS_TRKR 0xC004 +#define GITS_TRKDIDR 0xC008 +#define GITS_TRKPIDR 0xC00C +#define GITS_TRKVIDR 0xC010 +#define GITS_TRKTGTR 0xC014 +#define GITS_TRKICR 0xC018 +#define GITS_TRKLCR 0xC018 /* * CPU interface Modified: projects/nfs-over-tls/sys/arm64/arm64/gicv3_its.c ============================================================================== --- projects/nfs-over-tls/sys/arm64/arm64/gicv3_its.c Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/arm64/arm64/gicv3_its.c Thu Apr 30 03:58:30 2020 (r360487) @@ -49,7 +49,9 @@ __FBSDID("$FreeBSD$"); #include <sys/proc.h> #include <sys/queue.h> #include <sys/rman.h> +#include <sys/sbuf.h> #include <sys/smp.h> +#include <sys/sysctl.h> #include <sys/vmem.h> #include <vm/vm.h> @@ -229,6 +231,7 @@ struct gicv3_its_irqsrc { }; struct gicv3_its_softc { + device_t dev; struct intr_pic *sc_pic; struct resource *sc_its_res; @@ -262,6 +265,7 @@ struct gicv3_its_softc { #define ITS_FLAGS_LPI_CONF_FLUSH 0x00000002 #define ITS_FLAGS_ERRATA_CAVIUM_22375 0x00000004 u_int sc_its_flags; + bool trace_enable; }; static void *conf_base; @@ -713,6 +717,86 @@ its_init_cpu(device_t dev, struct gicv3_its_softc *sc) } static int +gicv3_its_sysctl_trace_enable(SYSCTL_HANDLER_ARGS) +{ + struct gicv3_its_softc *sc; + int rv; + + sc = arg1; + + rv = sysctl_handle_bool(oidp, &sc->trace_enable, 0, req); + if (rv != 0 || req->newptr == NULL) + return (rv); + if (sc->trace_enable) + gic_its_write_8(sc, GITS_TRKCTLR, 3); + else + gic_its_write_8(sc, GITS_TRKCTLR, 0); + + return (0); +} + +static int +gicv3_its_sysctl_trace_regs(SYSCTL_HANDLER_ARGS) +{ + struct gicv3_its_softc *sc; + struct sbuf *sb; + int err; + + sc = arg1; + sb = sbuf_new_for_sysctl(NULL, NULL, 128, req); + if (sb == NULL) { + device_printf(sc->dev, "Could not allocate sbuf for output.\n"); + return (ENOMEM); + } + sbuf_cat(sb, "\n"); + sbuf_printf(sb, "GITS_TRKCTLR: 0x%08X\n", + gic_its_read_4(sc, GITS_TRKCTLR)); + sbuf_printf(sb, "GITS_TRKR: 0x%08X\n", + gic_its_read_4(sc, GITS_TRKR)); + sbuf_printf(sb, "GITS_TRKDIDR: 0x%08X\n", + gic_its_read_4(sc, GITS_TRKDIDR)); + sbuf_printf(sb, "GITS_TRKPIDR: 0x%08X\n", + gic_its_read_4(sc, GITS_TRKPIDR)); + sbuf_printf(sb, "GITS_TRKVIDR: 0x%08X\n", + gic_its_read_4(sc, GITS_TRKVIDR)); + sbuf_printf(sb, "GITS_TRKTGTR: 0x%08X\n", + gic_its_read_4(sc, GITS_TRKTGTR)); + + err = sbuf_finish(sb); + if (err) + device_printf(sc->dev, "Error finishing sbuf: %d\n", err); + sbuf_delete(sb); + return(err); +} + +static int +gicv3_its_init_sysctl(struct gicv3_its_softc *sc) +{ + struct sysctl_oid *oid, *child; + struct sysctl_ctx_list *ctx_list; + + ctx_list = device_get_sysctl_ctx(sc->dev); + child = device_get_sysctl_tree(sc->dev); + oid = SYSCTL_ADD_NODE(ctx_list, + SYSCTL_CHILDREN(child), OID_AUTO, "tracing", + CTLFLAG_RD| CTLFLAG_MPSAFE, NULL, "Messages tracing"); + if (oid == NULL) + return (ENXIO); + + /* Add registers */ + SYSCTL_ADD_PROC(ctx_list, + SYSCTL_CHILDREN(oid), OID_AUTO, "enable", + CTLTYPE_U8 | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, + gicv3_its_sysctl_trace_enable, "CU", "Enable tracing"); + SYSCTL_ADD_PROC(ctx_list, + SYSCTL_CHILDREN(oid), OID_AUTO, "capture", + CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, + gicv3_its_sysctl_trace_regs, "", "Captured tracing registers."); + + return (0); +} + +static int gicv3_its_attach(device_t dev) { struct gicv3_its_softc *sc; @@ -811,6 +895,11 @@ gicv3_its_attach(device_t dev) "%s,%u", name, i); } + /* For GIC-500 install tracking sysctls. */ + if ((iidr & (GITS_IIDR_PRODUCT_MASK | GITS_IIDR_IMPLEMENTOR_MASK)) == + GITS_IIDR_RAW(GITS_IIDR_IMPL_ARM, GITS_IIDR_PROD_GIC500, 0, 0)) + gicv3_its_init_sysctl(sc); + return (0); } @@ -1717,6 +1806,7 @@ gicv3_its_fdt_attach(device_t dev) int err; sc = device_get_softc(dev); + sc->dev = dev; err = gicv3_its_attach(dev); if (err != 0) return (err); @@ -1778,6 +1868,7 @@ gicv3_its_acpi_attach(device_t dev) int err; sc = device_get_softc(dev); + sc->dev = dev; err = gicv3_its_attach(dev); if (err != 0) return (err); Modified: projects/nfs-over-tls/sys/arm64/rockchip/rk805.c ============================================================================== --- projects/nfs-over-tls/sys/arm64/rockchip/rk805.c Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/arm64/rockchip/rk805.c Thu Apr 30 03:58:30 2020 (r360487) @@ -105,6 +105,7 @@ struct rk805_softc { static int rk805_regnode_status(struct regnode *regnode, int *status); static int rk805_regnode_set_voltage(struct regnode *regnode, int min_uvolt, int max_uvolt, int *udelay); +static int rk805_regnode_get_voltage(struct regnode *regnode, int *uvolt); static struct rk805_regdef rk805_regdefs[] = { { @@ -366,13 +367,21 @@ rk805_regnode_init(struct regnode *regnode) { struct rk805_reg_sc *sc; struct regnode_std_param *param; - int rv, udelay, status; + int rv, udelay, uvolt, status; sc = regnode_get_softc(regnode); + dprintf(sc, "Regulator %s init called\n", sc->def->name); param = regnode_get_stdparam(regnode); if (param->min_uvolt == 0) return (0); + /* Check that the regulator is preset to the correct voltage */ + rv = rk805_regnode_get_voltage(regnode, &uvolt); + if (rv != 0) + return(rv); + + if (uvolt >= param->min_uvolt && uvolt <= param->max_uvolt) + return(0); /* * Set the regulator at the correct voltage if it is not enabled. * Do not enable it, this is will be done either by a Modified: projects/nfs-over-tls/sys/arm64/rockchip/rk_iodomain.c ============================================================================== --- projects/nfs-over-tls/sys/arm64/rockchip/rk_iodomain.c Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/arm64/rockchip/rk_iodomain.c Thu Apr 30 03:58:30 2020 (r360487) @@ -45,17 +45,20 @@ __FBSDID("$FreeBSD$"); #define RK3288_GRF_IO_VSEL 0x380 #define RK3399_GRF_IO_VSEL 0xe640 -#define RK3399_PMUGRF_IO_VSEL 0x180 +#define RK3399_PMUGRF_SOC_CON0 0x180 struct rk_iodomain_supply { char *name; uint32_t bit; }; +struct rk_iodomain_softc; + struct rk_iodomain_conf { struct rk_iodomain_supply *supply; int nsupply; uint32_t grf_reg; + void (*init)(struct rk_iodomain_softc *sc); }; struct rk_iodomain_softc { @@ -101,10 +104,12 @@ static struct rk_iodomain_supply rk3399_pmu_supply[] = {"pmu1830-supply", 9}, }; +static void rk3399_pmu_init(struct rk_iodomain_softc *sc); static struct rk_iodomain_conf rk3399_pmu_conf = { .supply = rk3399_pmu_supply, .nsupply = nitems(rk3399_pmu_supply), - .grf_reg = RK3399_PMUGRF_IO_VSEL, + .grf_reg = RK3399_PMUGRF_SOC_CON0, + .init = rk3399_pmu_init, }; static struct ofw_compat_data compat_data[] = { @@ -115,6 +120,14 @@ static struct ofw_compat_data compat_data[] = { }; static void +rk3399_pmu_init(struct rk_iodomain_softc *sc) +{ + + SYSCON_WRITE_4(sc->grf, RK3399_PMUGRF_SOC_CON0, + (1 << 8) | (1 << (8 + 16))); /* set pmu1830_volsel */ +} + +static void rk_iodomain_set(struct rk_iodomain_softc *sc) { regulator_t supply; @@ -141,6 +154,8 @@ rk_iodomain_set(struct rk_iodomain_softc *sc) } SYSCON_WRITE_4(sc->grf, sc->conf->grf_reg, reg | mask); + if (sc->conf->init != NULL) + sc->conf->init(sc); } static int @@ -204,4 +219,4 @@ static driver_t rk_iodomain_driver = { static devclass_t rk_iodomain_devclass; EARLY_DRIVER_MODULE(rk_iodomain, simplebus, rk_iodomain_driver, - rk_iodomain_devclass, 0, 0, BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_MIDDLE); + rk_iodomain_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Modified: projects/nfs-over-tls/sys/cam/cam_ccb.h ============================================================================== --- projects/nfs-over-tls/sys/cam/cam_ccb.h Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/cam/cam_ccb.h Thu Apr 30 03:58:30 2020 (r360487) @@ -630,6 +630,7 @@ struct ccb_pathinq_settings_sas { u_int32_t bitrate; /* Mbps */ }; +#define NVME_DEV_NAME_LEN 52 struct ccb_pathinq_settings_nvme { uint32_t nsid; /* Namespace ID for this path */ uint32_t domain; @@ -637,7 +638,10 @@ struct ccb_pathinq_settings_nvme { uint8_t slot; uint8_t function; uint8_t extra; + char dev_name[NVME_DEV_NAME_LEN]; /* nvme controller dev name for this device */ }; +_Static_assert(sizeof(struct ccb_pathinq_settings_nvme) == 64, + "ccb_pathinq_settings_nvme too big"); #define PATHINQ_SETTINGS_SIZE 128 @@ -1030,6 +1034,7 @@ struct ccb_trans_settings_nvme uint8_t speed; /* PCIe generation for each lane */ uint8_t max_lanes; /* Number of PCIe lanes */ uint8_t max_speed; /* PCIe generation for each lane */ + }; #include <cam/mmc/mmc_bus.h> Modified: projects/nfs-over-tls/sys/cam/nvme/nvme_da.c ============================================================================== --- projects/nfs-over-tls/sys/cam/nvme/nvme_da.c Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/cam/nvme/nvme_da.c Thu Apr 30 03:58:30 2020 (r360487) @@ -95,6 +95,7 @@ typedef enum { NDA_CCB_BUFFER_IO = 0x01, NDA_CCB_DUMP = 0x02, NDA_CCB_TRIM = 0x03, + NDA_CCB_PASS = 0x04, NDA_CCB_TYPE_MASK = 0x0F, } nda_ccb_state; @@ -144,6 +145,7 @@ _Static_assert(NVME_MAX_DSM_TRIM % sizeof(struct nvme_ /* Need quirk table */ +static disk_ioctl_t ndaioctl; static disk_strategy_t ndastrategy; static dumper_t ndadump; static periph_init_t ndainit; @@ -366,6 +368,91 @@ ndaschedule(struct cam_periph *periph) cam_iosched_schedule(softc->cam_iosched, periph); } +static int +ndaioctl(struct disk *dp, u_long cmd, void *data, int fflag, + struct thread *td) +{ + struct cam_periph *periph; + struct nda_softc *softc; + + periph = (struct cam_periph *)dp->d_drv1; + softc = (struct nda_softc *)periph->softc; + + switch (cmd) { + case NVME_IO_TEST: + case NVME_BIO_TEST: + /* + * These don't map well to the underlying CCBs, so + * they are usupported via CAM. + */ + return (ENOTTY); + case NVME_GET_NSID: + { + struct nvme_get_nsid *gnsid = (struct nvme_get_nsid *)data; + struct ccb_pathinq cpi; + + xpt_path_inq(&cpi, periph->path); + strncpy(gnsid->cdev, cpi.xport_specific.nvme.dev_name, + sizeof(gnsid->cdev)); + gnsid->nsid = cpi.xport_specific.nvme.nsid; + return (0); + } + case NVME_PASSTHROUGH_CMD: + { + struct nvme_pt_command *pt; + union ccb *ccb; + struct cam_periph_map_info mapinfo; + u_int maxmap = MAXPHYS; /* XXX is this right */ + int error; + + /* + * Create a NVME_IO CCB to do the passthrough command. + */ + pt = (struct nvme_pt_command *)data; + ccb = xpt_alloc_ccb(); + xpt_setup_ccb(&ccb->ccb_h, periph->path, CAM_PRIORITY_NORMAL); + ccb->ccb_state = NDA_CCB_PASS; + cam_fill_nvmeio(&ccb->nvmeio, + 0, /* Retries */ + ndadone, + (pt->is_read ? CAM_DIR_IN : CAM_DIR_OUT) | CAM_DATA_VADDR, + pt->buf, + pt->len, + nda_default_timeout * 1000); + memcpy(&ccb->nvmeio.cmd, &pt->cmd, sizeof(pt->cmd)); + + /* + * Wire the user memory in this request for the I/O + */ + memset(&mapinfo, 0, sizeof(mapinfo)); + error = cam_periph_mapmem(ccb, &mapinfo, maxmap); + if (error) + return (error); + + /* + * Lock the periph and run the command. XXX do we need + * to lock the periph? + */ + cam_periph_lock(periph); + cam_periph_runccb(ccb, NULL, CAM_RETRY_SELTO, SF_RETRY_UA | SF_NO_PRINT, + NULL); + cam_periph_unlock(periph); + + /* + * Tear down mapping and return status. + */ + cam_periph_unmapmem(ccb, &mapinfo); + cam_periph_lock(periph); + error = (ccb->ccb_h.status == CAM_REQ_CMP) ? 0 : EIO; + xpt_release_ccb(ccb); + return (error); + } + default: + break; + } + return (ENOTTY); +} + /* * Actually translate the requested transfer into one the physical driver * can understand. The transfer is described by a buf and will include @@ -782,11 +869,8 @@ ndaregister(struct cam_periph *periph, void *arg) /* ident_data parsing */ periph->softc = softc; - softc->quirks = NDA_Q_NONE; - xpt_path_inq(&cpi, periph->path); - TASK_INIT(&softc->sysctl_task, 0, ndasysctlinit, periph); /* @@ -810,6 +894,7 @@ ndaregister(struct cam_periph *periph, void *arg) disk->d_open = ndaopen; disk->d_close = ndaclose; disk->d_strategy = ndastrategy; + disk->d_ioctl = ndaioctl; disk->d_getattr = ndagetattr; disk->d_dump = ndadump; disk->d_gone = ndadiskgonecb; @@ -1162,6 +1247,8 @@ ndadone(struct cam_periph *periph, union ccb *done_ccb } case NDA_CCB_DUMP: /* No-op. We're polling */ + return; + case NDA_CCB_PASS: return; default: break; Modified: projects/nfs-over-tls/sys/conf/Makefile.amd64 ============================================================================== --- projects/nfs-over-tls/sys/conf/Makefile.amd64 Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/conf/Makefile.amd64 Thu Apr 30 03:58:30 2020 (r360487) @@ -18,7 +18,7 @@ # # Which version of config(8) is required. -%VERSREQ= 600012 +%VERSREQ= 600018 STD8X16FONT?= iso Modified: projects/nfs-over-tls/sys/conf/files ============================================================================== --- projects/nfs-over-tls/sys/conf/files Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/conf/files Thu Apr 30 03:58:30 2020 (r360487) @@ -4091,12 +4091,13 @@ net/radix_mpath.c standard net/raw_cb.c standard net/raw_usrreq.c standard net/route.c standard -net/route_temporal.c standard net/route/nhop.c standard net/route/nhop_ctl.c standard net/route/nhop_utils.c standard net/route/route_ctl.c standard +net/route/route_ddb.c optional ddb net/route/route_helpers.c standard +net/route/route_temporal.c standard net/rss_config.c optional inet rss | inet6 rss net/rtsock.c standard net/slcompress.c optional netgraph_vjc | sppp | \ Modified: projects/nfs-over-tls/sys/conf/files.amd64 ============================================================================== --- projects/nfs-over-tls/sys/conf/files.amd64 Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/conf/files.amd64 Thu Apr 30 03:58:30 2020 (r360487) @@ -113,7 +113,8 @@ amd64/amd64/initcpu.c standard amd64/amd64/io.c optional io amd64/amd64/locore.S standard no-obj amd64/amd64/xen-locore.S optional xenhvm \ - compile-with "${NORMAL_S} -g0" + compile-with "${NORMAL_S} -g0" \ + no-ctfconvert amd64/amd64/machdep.c standard amd64/amd64/mem.c optional mem amd64/amd64/minidump_machdep.c standard Modified: projects/nfs-over-tls/sys/dev/dwc/if_dwc.c ============================================================================== --- projects/nfs-over-tls/sys/dev/dwc/if_dwc.c Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/dev/dwc/if_dwc.c Thu Apr 30 03:58:30 2020 (r360487) @@ -252,14 +252,13 @@ dwc_txstart_locked(struct dwc_softc *sc) ifp = sc->ifp; - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { + if (ifp->if_drv_flags & IFF_DRV_OACTIVE) return; - } enqueued = 0; for (;;) { - if (sc->txcount == (TX_DESC_COUNT-1)) { + if (sc->txcount == (TX_DESC_COUNT - 1)) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } @@ -268,7 +267,7 @@ dwc_txstart_locked(struct dwc_softc *sc) if (m == NULL) break; if (dwc_setup_txbuf(sc, sc->tx_idx_head, &m) != 0) { - IFQ_DRV_PREPEND(&ifp->if_snd, m); + IFQ_DRV_PREPEND(&ifp->if_snd, m); break; } BPF_MTAP(ifp, m); @@ -469,7 +468,7 @@ dwc_setup_rxdesc(struct dwc_softc *sc, int idx, bus_ad sc->rxdesc_ring[idx].addr = (uint32_t)paddr; nidx = next_rxidx(sc, idx); - sc->rxdesc_ring[idx].addr_next = sc->rxdesc_ring_paddr + \ + sc->rxdesc_ring[idx].addr_next = sc->rxdesc_ring_paddr + (nidx * sizeof(struct dwc_hwdesc)); if (sc->mactype == DWC_GMAC_ALT_DESC) sc->rxdesc_ring[idx].tdes1 = DDESC_CNTL_CHAINED | RX_MAX_PACKET; @@ -493,9 +492,8 @@ dwc_setup_rxbuf(struct dwc_softc *sc, int idx, struct error = bus_dmamap_load_mbuf_sg(sc->rxbuf_tag, sc->rxbuf_map[idx].map, m, &seg, &nsegs, 0); - if (error != 0) { + if (error != 0) return (error); - } KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); @@ -1167,10 +1165,6 @@ dwc_attach(device_t dev) device_printf(dev, "could not allocate resources\n"); return (ENXIO); } - - /* Memory interface */ - sc->bst = rman_get_bustag(sc->res[0]); - sc->bsh = rman_get_bushandle(sc->res[0]); /* Read MAC before reset */ if (dwc_get_hwaddr(sc, macaddr)) { Modified: projects/nfs-over-tls/sys/dev/dwc/if_dwcvar.h ============================================================================== --- projects/nfs-over-tls/sys/dev/dwc/if_dwcvar.h Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/dev/dwc/if_dwcvar.h Thu Apr 30 03:58:30 2020 (r360487) @@ -57,8 +57,6 @@ struct dwc_bufmap { struct dwc_softc { struct resource *res[2]; - bus_space_tag_t bst; - bus_space_handle_t bsh; device_t dev; int mactype; int mii_clk; Modified: projects/nfs-over-tls/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- projects/nfs-over-tls/sys/dev/nvme/nvme_ctrlr.c Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/dev/nvme/nvme_ctrlr.c Thu Apr 30 03:58:30 2020 (r360487) @@ -40,7 +40,9 @@ __FBSDID("$FreeBSD$"); #include <sys/proc.h> #include <sys/smp.h> #include <sys/uio.h> +#include <sys/sbuf.h> #include <sys/endian.h> +#include <machine/stdarg.h> #include <vm/vm.h> #include "nvme_private.h" @@ -50,6 +52,35 @@ __FBSDID("$FreeBSD$"); static void nvme_ctrlr_construct_and_submit_aer(struct nvme_controller *ctrlr, struct nvme_async_event_request *aer); +static void +nvme_ctrlr_devctl_log(struct nvme_controller *ctrlr, const char *type, const char *msg, ...) +{ + struct sbuf sb; + va_list ap; + int error; + + if (sbuf_new(&sb, NULL, 0, SBUF_AUTOEXTEND | SBUF_NOWAIT) == NULL) + return; + sbuf_printf(&sb, "%s: ", device_get_nameunit(ctrlr->dev)); + va_start(ap, msg); + sbuf_vprintf(&sb, msg, ap); + va_end(ap); + error = sbuf_finish(&sb); + if (error == 0) + printf("%s\n", sbuf_data(&sb)); + + sbuf_clear(&sb); + sbuf_printf(&sb, "name=\"%s\" reason=\"", device_get_nameunit(ctrlr->dev)); + va_start(ap, msg); + sbuf_vprintf(&sb, msg, ap); + va_end(ap); + sbuf_printf(&sb, "\""); + error = sbuf_finish(&sb); + if (error == 0) + devctl_notify("nvme", "controller", type, sbuf_data(&sb)); + sbuf_delete(&sb); +} + static int nvme_ctrlr_construct_admin_qpair(struct nvme_controller *ctrlr) { @@ -607,23 +638,28 @@ nvme_ctrlr_log_critical_warnings(struct nvme_controlle { if (state & NVME_CRIT_WARN_ST_AVAILABLE_SPARE) - nvme_printf(ctrlr, "available spare space below threshold\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "available spare space below threshold"); if (state & NVME_CRIT_WARN_ST_TEMPERATURE) - nvme_printf(ctrlr, "temperature above threshold\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "temperature above threshold"); if (state & NVME_CRIT_WARN_ST_DEVICE_RELIABILITY) - nvme_printf(ctrlr, "device reliability degraded\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "device reliability degraded"); if (state & NVME_CRIT_WARN_ST_READ_ONLY) - nvme_printf(ctrlr, "media placed in read only mode\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "media placed in read only mode"); if (state & NVME_CRIT_WARN_ST_VOLATILE_MEMORY_BACKUP) - nvme_printf(ctrlr, "volatile memory backup device failed\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "volatile memory backup device failed"); if (state & NVME_CRIT_WARN_ST_RESERVED_MASK) - nvme_printf(ctrlr, - "unknown critical warning(s): state = 0x%02x\n", state); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "unknown critical warning(s): state = 0x%02x", state); } static void @@ -1121,7 +1157,7 @@ nvme_ctrlr_reset_task(void *arg, int pending) struct nvme_controller *ctrlr = arg; int status; - nvme_printf(ctrlr, "resetting controller\n"); + nvme_ctrlr_devctl_log(ctrlr, "RESET", "resetting controller"); status = nvme_ctrlr_hw_reset(ctrlr); /* * Use pause instead of DELAY, so that we yield to any nvme interrupt Modified: projects/nfs-over-tls/sys/dev/nvme/nvme_sim.c ============================================================================== --- projects/nfs-over-tls/sys/dev/nvme/nvme_sim.c Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/dev/nvme/nvme_sim.c Thu Apr 30 03:58:30 2020 (r360487) @@ -203,6 +203,8 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb) cpi->xport_specific.nvme.slot = pci_get_slot(dev); cpi->xport_specific.nvme.function = pci_get_function(dev); cpi->xport_specific.nvme.extra = 0; + strncpy(cpi->xport_specific.nvme.dev_name, device_get_nameunit(ctrlr->dev), + sizeof(cpi->xport_specific.nvme.dev_name)); cpi->ccb_h.status = CAM_REQ_CMP; break; } Modified: projects/nfs-over-tls/sys/kern/kern_cpu.c ============================================================================== --- projects/nfs-over-tls/sys/kern/kern_cpu.c Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/kern/kern_cpu.c Thu Apr 30 03:58:30 2020 (r360487) @@ -325,6 +325,12 @@ cf_set_method(device_t dev, const struct cf_level *lev /* Bind to the target CPU before switching. */ pc = cpu_get_pcpu(set->dev); + + /* Skip settings if CPU is not started. */ + if (pc == NULL) { + error = 0; + goto out; + } thread_lock(curthread); pri = curthread->td_priority; sched_prio(curthread, PRI_MIN); Modified: projects/nfs-over-tls/sys/kern/kern_sendfile.c ============================================================================== --- projects/nfs-over-tls/sys/kern/kern_sendfile.c Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/kern/kern_sendfile.c Thu Apr 30 03:58:30 2020 (r360487) @@ -106,8 +106,36 @@ struct sendfile_sync { struct mtx mtx; struct cv cv; unsigned count; + bool waiting; }; +static void +sendfile_sync_destroy(struct sendfile_sync *sfs) +{ + KASSERT(sfs->count == 0, ("sendfile sync %p still busy", sfs)); + + cv_destroy(&sfs->cv); + mtx_destroy(&sfs->mtx); + free(sfs, M_SENDFILE); +} + +static void +sendfile_sync_signal(struct sendfile_sync *sfs) +{ + mtx_lock(&sfs->mtx); + KASSERT(sfs->count > 0, ("sendfile sync %p not busy", sfs)); + if (--sfs->count == 0) { + if (!sfs->waiting) { + /* The sendfile() waiter was interrupted by a signal. */ + sendfile_sync_destroy(sfs); + return; + } else { + cv_signal(&sfs->cv); + } + } + mtx_unlock(&sfs->mtx); +} + counter_u64_t sfstat[sizeof(struct sfstat) / sizeof(uint64_t)]; static void @@ -153,12 +181,7 @@ sendfile_free_mext(struct mbuf *m) if (m->m_ext.ext_flags & EXT_FLAG_SYNC) { struct sendfile_sync *sfs = m->m_ext.ext_arg2; - - mtx_lock(&sfs->mtx); - KASSERT(sfs->count > 0, ("Sendfile sync botchup count == 0")); - if (--sfs->count == 0) - cv_signal(&sfs->cv); - mtx_unlock(&sfs->mtx); + sendfile_sync_signal(sfs); } } @@ -186,12 +209,7 @@ sendfile_free_mext_pg(struct mbuf *m) if (m->m_ext.ext_flags & EXT_FLAG_SYNC) { struct sendfile_sync *sfs = m->m_ext.ext_arg1; - - mtx_lock(&sfs->mtx); - KASSERT(sfs->count > 0, ("Sendfile sync botchup count == 0")); - if (--sfs->count == 0) - cv_signal(&sfs->cv); - mtx_unlock(&sfs->mtx); + sendfile_sync_signal(sfs); } } @@ -719,6 +737,7 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *h sfs = malloc(sizeof(*sfs), M_SENDFILE, M_WAITOK | M_ZERO); mtx_init(&sfs->mtx, "sendfile", NULL, MTX_DEF); cv_init(&sfs->cv, "sendfile"); + sfs->waiting = true; } rem = nbytes ? omin(nbytes, obj_size - offset) : obj_size - offset; @@ -1221,11 +1240,13 @@ out: if (sfs != NULL) { mtx_lock(&sfs->mtx); if (sfs->count != 0) - cv_wait(&sfs->cv, &sfs->mtx); - KASSERT(sfs->count == 0, ("sendfile sync still busy")); - cv_destroy(&sfs->cv); - mtx_destroy(&sfs->mtx); - free(sfs, M_SENDFILE); + error = cv_wait_sig(&sfs->cv, &sfs->mtx); + if (sfs->count == 0) { + sendfile_sync_destroy(sfs); + } else { + sfs->waiting = false; + mtx_unlock(&sfs->mtx); + } } #ifdef KERN_TLS if (tls != NULL) Modified: projects/nfs-over-tls/sys/modules/cxgb/cxgb/Makefile ============================================================================== --- projects/nfs-over-tls/sys/modules/cxgb/cxgb/Makefile Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/modules/cxgb/cxgb/Makefile Thu Apr 30 03:58:30 2020 (r360487) @@ -8,7 +8,7 @@ SRCS= cxgb_mc5.c cxgb_vsc8211.c cxgb_ael1002.c cxgb_mv SRCS+= cxgb_xgmac.c cxgb_vsc7323.c cxgb_t3_hw.c cxgb_main.c cxgb_aq100x.c SRCS+= cxgb_sge.c cxgb_tn1010.c SRCS+= device_if.h bus_if.h pci_if.h -SRCS+= opt_inet.h opt_inet6.h opt_sched.h +SRCS+= opt_inet.h opt_inet6.h SRCS+= uipc_mvec.c CFLAGS+= -g -DDEFAULT_JUMBO -I${CXGB} Modified: projects/nfs-over-tls/sys/modules/cxgbe/iw_cxgbe/Makefile ============================================================================== --- projects/nfs-over-tls/sys/modules/cxgbe/iw_cxgbe/Makefile Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/modules/cxgbe/iw_cxgbe/Makefile Thu Apr 30 03:58:30 2020 (r360487) @@ -14,7 +14,7 @@ SRCS+= provider.c SRCS+= qp.c SRCS+= resource.c SRCS+= ${LINUXKPI_GENSRCS} -SRCS+= opt_inet.h opt_inet6.h opt_ktr.h opt_ofed.h opt_sched.h +SRCS+= opt_inet.h opt_inet6.h opt_ktr.h opt_ofed.h CFLAGS+= -I${CXGBE} -I${SRCTOP}/sys/ofed/include -DLINUX_TYPES_DEFINED CFLAGS+= -I${SRCTOP}/sys/ofed/include/uapi Modified: projects/nfs-over-tls/sys/modules/rdma/krping/Makefile ============================================================================== --- projects/nfs-over-tls/sys/modules/rdma/krping/Makefile Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/modules/rdma/krping/Makefile Thu Apr 30 03:58:30 2020 (r360487) @@ -4,7 +4,7 @@ KMOD= krping SRCS= krping.c krping_dev.c getopt.c SRCS+= ${LINUXKPI_GENSRCS} -SRCS+= opt_sched.h opt_inet.h opt_inet6.h +SRCS+= opt_inet.h opt_inet6.h CFLAGS+= -I${SRCTOP}/sys/ofed/include CFLAGS+= -I${SRCTOP}/sys/ofed/include/uapi CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include Modified: projects/nfs-over-tls/sys/modules/sfxge/Makefile ============================================================================== --- projects/nfs-over-tls/sys/modules/sfxge/Makefile Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/modules/sfxge/Makefile Thu Apr 30 03:58:30 2020 (r360487) @@ -5,7 +5,7 @@ KMOD= sfxge SFXGE= ${SRCTOP}/sys/dev/sfxge SRCS= device_if.h bus_if.h pci_if.h -SRCS+= opt_inet.h opt_inet6.h opt_sched.h opt_rss.h +SRCS+= opt_inet.h opt_inet6.h opt_rss.h .PATH: ${SRCTOP}/sys/dev/sfxge SRCS+= sfxge.c sfxge_dma.c sfxge_ev.c Modified: projects/nfs-over-tls/sys/net/if_var.h ============================================================================== --- projects/nfs-over-tls/sys/net/if_var.h Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/net/if_var.h Thu Apr 30 03:58:30 2020 (r360487) @@ -61,6 +61,7 @@ */ struct rtentry; /* ifa_rtrequest */ +struct nhop_object; /* ifa_rtrequest */ struct rt_addrinfo; /* ifa_rtrequest */ struct socket; struct carp_if; @@ -551,7 +552,8 @@ struct ifaddr { struct carp_softc *ifa_carp; /* pointer to CARP data */ CK_STAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */ void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ - (int, struct rtentry *, struct rt_addrinfo *); + (int, struct rtentry *, struct nhop_object *, + struct rt_addrinfo *); u_short ifa_flags; /* mostly rt_flags for cloning */ #define IFA_ROUTE RTF_UP /* route installed */ #define IFA_RTSELF RTF_HOST /* loopback route to self installed */ Modified: projects/nfs-over-tls/sys/net/radix_mpath.c ============================================================================== --- projects/nfs-over-tls/sys/net/radix_mpath.c Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/net/radix_mpath.c Thu Apr 30 03:58:30 2020 (r360487) @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #include <net/route.h> #include <net/route/nhop.h> #include <net/route/shared.h> -#include <net/route_var.h> +#include <net/route/route_var.h> #include <net/route/nhop.h> #include <net/if.h> #include <net/if_var.h> @@ -183,6 +183,7 @@ rt_mpath_conflict(struct rib_head *rnh, struct rtentry struct sockaddr *netmask) { struct radix_node *rn, *rn1; + struct nhop_object *nh, *nh1; struct rtentry *rt1; rn = (struct radix_node *)rt; @@ -198,15 +199,17 @@ rt_mpath_conflict(struct rib_head *rnh, struct rtentry if (rn1 == rn) continue; - if (rt1->rt_gateway->sa_family == AF_LINK) { - if (rt1->rt_ifa->ifa_addr->sa_len != rt->rt_ifa->ifa_addr->sa_len || - bcmp(rt1->rt_ifa->ifa_addr, rt->rt_ifa->ifa_addr, - rt1->rt_ifa->ifa_addr->sa_len)) + nh = rt->rt_nhop; + nh1 = rt1->rt_nhop; + + if (nh1->gw_sa.sa_family == AF_LINK) { + if (nh1->nh_ifa->ifa_addr->sa_len != nh->nh_ifa->ifa_addr->sa_len || + bcmp(nh1->nh_ifa->ifa_addr, nh->nh_ifa->ifa_addr, + nh1->nh_ifa->ifa_addr->sa_len)) continue; } else { - if (rt1->rt_gateway->sa_len != rt->rt_gateway->sa_len || - bcmp(rt1->rt_gateway, rt->rt_gateway, - rt1->rt_gateway->sa_len)) + if (nh1->gw_sa.sa_len != nh->gw_sa.sa_len || + bcmp(&nh1->gw_sa, &nh->gw_sa, nh1->gw_sa.sa_len)) continue; } @@ -254,46 +257,6 @@ rt_mpath_select(struct rtentry *rte, uint32_t hash) return (rte); return (rt_mpath_selectrte(rte, hash)); -} - -void -rtalloc_mpath_fib(struct route *ro, uint32_t hash, u_int fibnum) -{ - struct rtentry *rt, *rt_tmp; - - /* - * XXX we don't attempt to lookup cached route again; what should - * be done for sendto(3) case? - */ - if (ro->ro_nh && RT_LINK_IS_UP(ro->ro_nh->nh_ifp)) - return; - ro->ro_nh = NULL; - rt_tmp = rtalloc1_fib(&ro->ro_dst, 1, 0, fibnum); - - /* if the route does not exist or it is not multipath, don't care */ - if (rt_tmp == NULL) - return; - if (rn_mpath_next((struct radix_node *)rt_tmp) == NULL) { - ro->ro_nh = rt_tmp->rt_nhop; - nhop_ref_object(ro->ro_nh); - RT_UNLOCK(rt_tmp); - return; - } - - rt = rt_mpath_selectrte(rt_tmp, hash); - /* XXX try filling rt_gwroute and avoid unreachable gw */ - - /* gw selection has failed - there must be only zero weight routes */ - if (!rt) { - RT_UNLOCK(rt_tmp); - return; - } - if (rt_tmp != rt) { - RTFREE_LOCKED(rt_tmp); - ro->ro_nh = rt->rt_nhop; - nhop_ref_object(ro->ro_nh); - } else - RT_UNLOCK(rt_tmp); } void Modified: projects/nfs-over-tls/sys/net/radix_mpath.h ============================================================================== --- projects/nfs-over-tls/sys/net/radix_mpath.h Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/net/radix_mpath.h Thu Apr 30 03:58:30 2020 (r360487) @@ -54,7 +54,6 @@ u_int32_t rn_mpath_count(struct radix_node *); struct rtentry *rt_mpath_matchgate(struct rtentry *, struct sockaddr *); int rt_mpath_conflict(struct rib_head *, struct rtentry *, struct sockaddr *); -void rtalloc_mpath_fib(struct route *, u_int32_t, u_int); struct rtentry *rt_mpath_select(struct rtentry *, uint32_t); struct rtentry *rt_mpath_selectrte(struct rtentry *, uint32_t); int rt_mpath_deldup(struct rtentry *, struct rtentry *); Modified: projects/nfs-over-tls/sys/net/route.c ============================================================================== --- projects/nfs-over-tls/sys/net/route.c Thu Apr 30 02:50:58 2020 (r360486) +++ projects/nfs-over-tls/sys/net/route.c Thu Apr 30 03:58:30 2020 (r360487) @@ -61,7 +61,7 @@ #include <net/if_var.h> #include <net/if_dl.h> #include <net/route.h> -#include <net/route_var.h> +#include <net/route/route_var.h> #include <net/route/nhop.h> #include <net/route/shared.h> #include <net/vnet.h> @@ -434,28 +434,6 @@ sys_setfib(struct thread *td, struct setfib_args *uap) } /* - * Packet routing routines. - */ -void -rtalloc_ign_fib(struct route *ro, u_long ignore, u_int fibnum) -{ - struct rtentry *rt; - - if (ro->ro_nh != NULL) { - if (NH_IS_VALID(ro->ro_nh)) - return; - NH_FREE(ro->ro_nh); - ro->ro_nh = NULL; - } - rt = rtalloc1_fib(&ro->ro_dst, 1, ignore, fibnum); - if (rt != NULL) { - ro->ro_nh = rt->rt_nhop; - nhop_ref_object(rt->rt_nhop); - RT_UNLOCK(rt); - } -} - -/* * Look up the route that matches the address given * Or, at least try.. Create a cloned route if needed. * @@ -767,8 +745,8 @@ ifa_ifwithroute(int flags, const struct sockaddr *dst, default: break; } - if (!not_found && rt->rt_ifa != NULL) { - ifa = rt->rt_ifa; + if (!not_found && rt->rt_nhop->nh_ifa != NULL) { + ifa = rt->rt_nhop->nh_ifa; } RT_REMREF(rt); RT_UNLOCK(rt); @@ -931,7 +909,7 @@ rib_lookup_info(uint32_t fibnum, const struct sockaddr if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) { rt = RNTORT(rn); /* Ensure route & ifp is UP */ - if (RT_LINK_IS_UP(rt->rt_ifp)) { + if (RT_LINK_IS_UP(rt->rt_nhop->nh_ifp)) { flags = (flags & NHR_REF) | NHR_COPY; error = rt_exportinfo(rt, info, flags); RIB_RUNLOCK(rh); @@ -1086,7 +1064,8 @@ rib_walk_del(u_int fibnum, int family, rt_filter_f_t * rt_notifydelete(rt, &di.info); if (report) - rt_routemsg(RTM_DELETE, rt, rt->rt_ifp, 0, fibnum); + rt_routemsg(RTM_DELETE, rt, rt->rt_nhop->nh_ifp, 0, + fibnum); RTFREE_LOCKED(rt); } } *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004300358.03U3wUSu052336>