svn commit: r368557 - head/share/man/man9
Author: np Date: Fri Dec 11 19:45:40 2020 New Revision: 368557 URL: https://svnweb.freebsd.org/changeset/base/368557 Log: vnet.9: Use correct location of vnet.h. MFC after:1 week Sponsored by: Chelsio Communications Differential Revision:https://reviews.freebsd.org/D27557 Modified: head/share/man/man9/vnet.9 Modified: head/share/man/man9/vnet.9 == --- head/share/man/man9/vnet.9 Fri Dec 11 19:27:21 2020(r368556) +++ head/share/man/man9/vnet.9 Fri Dec 11 19:45:40 2020(r368557) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 24, 2018 +.Dd December 10, 2020 .Dt VNET 9 .Os .Sh NAME @@ -38,7 +38,7 @@ .Cd "options VIMAGE" .Cd "options VNET_DEBUG" .Pp -.In sys/vnet.h +.In net/vnet.h .\" .Ss "Constants and Global Variables" .\" ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368315 - head/sys/dev/cxgbe
Author: np Date: Thu Dec 3 22:04:23 2020 New Revision: 368315 URL: https://svnweb.freebsd.org/changeset/base/368315 Log: cxgbe(4): Fix vertical alignment in sysctl_cpl_stats. MFC after:3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cThu Dec 3 22:01:13 2020 (r368314) +++ head/sys/dev/cxgbe/t4_main.cThu Dec 3 22:04:23 2020 (r368315) @@ -8269,13 +8269,13 @@ sysctl_cpl_stats(SYSCTL_HANDLER_ARGS) " channel 2 channel 3"); sbuf_printf(sb, "\nCPL requests: %10u %10u %10u %10u", stats.req[0], stats.req[1], stats.req[2], stats.req[3]); - sbuf_printf(sb, "\nCPL responses: %10u %10u %10u %10u", + sbuf_printf(sb, "\nCPL responses: %10u %10u %10u %10u", stats.rsp[0], stats.rsp[1], stats.rsp[2], stats.rsp[3]); } else { sbuf_printf(sb, " channel 0 channel 1"); sbuf_printf(sb, "\nCPL requests: %10u %10u", stats.req[0], stats.req[1]); - sbuf_printf(sb, "\nCPL responses: %10u %10u", + sbuf_printf(sb, "\nCPL responses: %10u %10u", stats.rsp[0], stats.rsp[1]); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368313 - in head/sys/dev/cxgbe: . common
Author: np Date: Thu Dec 3 22:00:41 2020 New Revision: 368313 URL: https://svnweb.freebsd.org/changeset/base/368313 Log: cxgbe(4): two new debug sysctls. dev...misc.tid_stats dev...misc.tnl_stats MFC after:3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/common/common.h == --- head/sys/dev/cxgbe/common/common.h Thu Dec 3 21:59:47 2020 (r368312) +++ head/sys/dev/cxgbe/common/common.h Thu Dec 3 22:00:41 2020 (r368313) @@ -189,6 +189,13 @@ struct tp_usm_stats { u64 octets; }; +struct tp_tid_stats { + u32 del; + u32 inv; + u32 act; + u32 pas; +}; + struct tp_fcoe_stats { u32 frames_ddp; u32 frames_drop; @@ -208,6 +215,11 @@ struct tp_err_stats { u32 ofld_cong_defer; }; +struct tp_tnl_stats { + u32 out_pkt[MAX_NCHAN]; + u32 in_pkt[MAX_NCHAN]; +}; + struct tp_proxy_stats { u32 proxy[MAX_NCHAN]; }; @@ -715,6 +727,8 @@ void t4_tp_wr_bits_indirect(struct adapter *adap, unsi void t4_tp_read_la(struct adapter *adap, u64 *la_buf, unsigned int *wrptr); void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st, bool sleep_ok); +void t4_tp_get_tnl_stats(struct adapter *adap, struct tp_tnl_stats *st, +bool sleep_ok); void t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st, bool sleep_ok); void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st, @@ -722,6 +736,8 @@ void t4_tp_get_cpl_stats(struct adapter *adap, struct void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st, bool sleep_ok); void t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st, + bool sleep_ok); +void t4_tp_get_tid_stats(struct adapter *adap, struct tp_tid_stats *st, bool sleep_ok); void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, struct tp_tcp_stats *v6, bool sleep_ok); Modified: head/sys/dev/cxgbe/common/t4_hw.c == --- head/sys/dev/cxgbe/common/t4_hw.c Thu Dec 3 21:59:47 2020 (r368312) +++ head/sys/dev/cxgbe/common/t4_hw.c Thu Dec 3 22:00:41 2020 (r368313) @@ -6169,6 +6169,25 @@ void t4_tp_get_err_stats(struct adapter *adap, struct } /** + * t4_tp_get_err_stats - read TP's error MIB counters + * @adap: the adapter + * @st: holds the counter values + * @sleep_ok: if true we may sleep while awaiting command completion + * + * Returns the values of TP's error counters. + */ +void t4_tp_get_tnl_stats(struct adapter *adap, struct tp_tnl_stats *st, +bool sleep_ok) +{ + int nchan = adap->chip_params->nchan; + + t4_tp_mib_read(adap, st->out_pkt, nchan, A_TP_MIB_TNL_OUT_PKT_0, + sleep_ok); + t4_tp_mib_read(adap, st->in_pkt, nchan, A_TP_MIB_TNL_IN_PKT_0, + sleep_ok); +} + +/** * t4_tp_get_proxy_stats - read TP's proxy MIB counters * @adap: the adapter * @st: holds the counter values @@ -6259,6 +6278,21 @@ void t4_get_usm_stats(struct adapter *adap, struct tp_ st->frames = val[0]; st->drops = val[1]; st->octets = ((u64)val[2] << 32) | val[3]; +} + +/** + * t4_tp_get_tid_stats - read TP's tid MIB counters. + * @adap: the adapter + * @st: holds the counter values + * @sleep_ok: if true we may sleep while awaiting command completion + * + * Returns the values of TP's counters for tids. + */ +void t4_tp_get_tid_stats(struct adapter *adap, struct tp_tid_stats *st, + bool sleep_ok) +{ + + t4_tp_mib_read(adap, &st->del, 4, A_TP_MIB_TID_DEL, sleep_ok); } /** Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cThu Dec 3 21:59:47 2020 (r368312) +++ head/sys/dev/cxgbe/t4_main.cThu Dec 3 22:00:41 2020 (r368313) @@ -761,6 +761,7 @@ static int sysctl_cim_pif_la(SYSCTL_HANDLER_ARGS); static int sysctl_cim_qcfg(SYSCTL_HANDLER_ARGS); static int sysctl_cpl_stats(SYSCTL_HANDLER_ARGS); static int sysctl_ddp_stats(SYSCTL_HANDLER_ARGS); +static int sysctl_tid_stats(SYSCTL_HANDLER_ARGS); static int sysctl_devlog(SYSCTL_HANDLER_ARGS); static int sysctl_fcoe_stats(SYSCTL_HANDLER_ARGS); static int sysctl_hw_sched(SYSCTL_HANDLER_ARGS); @@ -775,6 +776,7 @@ static int sysctl_rdma_stats(SYSCTL_HANDLER_ARGS); static int sysctl_tcp_stats(SYSCTL_HANDLER_ARGS); static int sysctl_tids(SYSCTL_HANDLER_ARGS); static int sysctl_tp_err_stats(SYSCTL_HANDLER_ARGS);
svn commit: r368310 - head/share/man/man9
Author: np Date: Thu Dec 3 21:38:00 2020 New Revision: 368310 URL: https://svnweb.freebsd.org/changeset/base/368310 Log: Fix typo in kern_testfrwk.9. Modified: head/share/man/man9/kern_testfrwk.9 Modified: head/share/man/man9/kern_testfrwk.9 == --- head/share/man/man9/kern_testfrwk.9 Thu Dec 3 19:29:18 2020 (r368309) +++ head/share/man/man9/kern_testfrwk.9 Thu Dec 3 21:38:00 2020 (r368310) @@ -30,7 +30,7 @@ .Nm kern_testfrwk .Nd A kernel testing framework .Sh SYNOPSIS -kld_load kern_testfrwk +kldload kern_testfrwk .Sh DESCRIPTION .\" This whole section is not written in manual page style and should be ripped .\" out and replaced. -CEM ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368296 - in head/sys/dev/cxgbe: . common
Author: np Date: Thu Dec 3 08:30:29 2020 New Revision: 368296 URL: https://svnweb.freebsd.org/changeset/base/368296 Log: cxgbe(4): Stop but don't free netmap queues when netmap is switched off. It is common for freelists to be starving when a netmap application stops. Mailbox commands to free queues can hang in such a situation. Avoid that by not freeing the queues when netmap is switched off. Instead, use an alternate method to stop the queues without releasing the context ids. If netmap is enabled again later then the same queue is reinitialized for use. Move alloc_nm_rxq and txq to t4_netmap.c while here. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hThu Dec 3 05:56:42 2020 (r368295) +++ head/sys/dev/cxgbe/adapter.hThu Dec 3 08:30:29 2020 (r368296) @@ -1247,6 +1247,12 @@ struct sge_nm_rxq; void cxgbe_nm_attach(struct vi_info *); void cxgbe_nm_detach(struct vi_info *); void service_nm_rxq(struct sge_nm_rxq *); +int alloc_nm_rxq(struct vi_info *, struct sge_nm_rxq *, int, int, +struct sysctl_oid *); +int free_nm_rxq(struct vi_info *, struct sge_nm_rxq *); +int alloc_nm_txq(struct vi_info *, struct sge_nm_txq *, int, int, +struct sysctl_oid *); +int free_nm_txq(struct vi_info *, struct sge_nm_txq *); #endif /* t4_sge.c */ @@ -1259,6 +1265,11 @@ int t4_create_dma_tag(struct adapter *); void t4_sge_sysctls(struct adapter *, struct sysctl_ctx_list *, struct sysctl_oid_list *); int t4_destroy_dma_tag(struct adapter *); +int alloc_ring(struct adapter *, size_t, bus_dma_tag_t *, bus_dmamap_t *, +bus_addr_t *, void **); +int free_ring(struct adapter *, bus_dma_tag_t, bus_dmamap_t, bus_addr_t, +void *); +int sysctl_uint16(SYSCTL_HANDLER_ARGS); int t4_setup_adapter_queues(struct adapter *); int t4_teardown_adapter_queues(struct adapter *); int t4_setup_vi_queues(struct vi_info *); Modified: head/sys/dev/cxgbe/common/common.h == --- head/sys/dev/cxgbe/common/common.h Thu Dec 3 05:56:42 2020 (r368295) +++ head/sys/dev/cxgbe/common/common.h Thu Dec 3 08:30:29 2020 (r368296) @@ -840,6 +840,8 @@ int t4_iq_stop(struct adapter *adap, unsigned int mbox int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int iqtype, unsigned int iqid, unsigned int fl0id, unsigned int fl1id); +int t4_eth_eq_stop(struct adapter *adap, unsigned int mbox, unsigned int pf, + unsigned int vf, unsigned int eqid); int t4_eth_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int eqid); int t4_ctrl_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, Modified: head/sys/dev/cxgbe/common/t4_hw.c == --- head/sys/dev/cxgbe/common/t4_hw.c Thu Dec 3 05:56:42 2020 (r368295) +++ head/sys/dev/cxgbe/common/t4_hw.c Thu Dec 3 08:30:29 2020 (r368296) @@ -8620,6 +8620,32 @@ int t4_iq_free(struct adapter *adap, unsigned int mbox } /** + * t4_eth_eq_stop - stop an Ethernet egress queue + * @adap: the adapter + * @mbox: mailbox to use for the FW command + * @pf: the PF owning the queues + * @vf: the VF owning the queues + * @eqid: egress queue id + * + * Stops an Ethernet egress queue. The queue can be reinitialized or + * freed but is not otherwise functional after this call. + */ +int t4_eth_eq_stop(struct adapter *adap, unsigned int mbox, unsigned int pf, + unsigned int vf, unsigned int eqid) +{ + struct fw_eq_eth_cmd c; + + memset(&c, 0, sizeof(c)); + c.op_to_vfn = cpu_to_be32(V_FW_CMD_OP(FW_EQ_ETH_CMD) | + F_FW_CMD_REQUEST | F_FW_CMD_EXEC | + V_FW_EQ_ETH_CMD_PFN(pf) | + V_FW_EQ_ETH_CMD_VFN(vf)); + c.alloc_to_len16 = cpu_to_be32(F_FW_EQ_ETH_CMD_EQSTOP | FW_LEN16(c)); + c.eqid_pkd = cpu_to_be32(V_FW_EQ_ETH_CMD_EQID(eqid)); + return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); +} + +/** * t4_eth_eq_free - free an Ethernet egress queue * @adap: the adapter * @mbox: mailbox to use for the FW command Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Thu Dec 3 05:56:42 2020 (r368295) +++ head/sys/dev/cxgbe/t4_netmap.c Thu Dec 3 08:30:29 2020 (r3
svn commit: r368283 - head/sys/dev/cxgbe
Author: np Date: Wed Dec 2 20:54:03 2020 New Revision: 368283 URL: https://svnweb.freebsd.org/changeset/base/368283 Log: cxgbe(4): Revert r367917. r367917 fixed the backpressure on the netmap rxq being stopped but that doesn't help if some other netmap rxq is starved (because it is stopping too although the driver doesn't know this yet) and blocks the pipeline. An alternate fix that works in all cases will be checked in instead. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_netmap.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hWed Dec 2 19:58:50 2020 (r368282) +++ head/sys/dev/cxgbe/adapter.hWed Dec 2 20:54:03 2020 (r368283) @@ -749,9 +749,6 @@ struct sge_nm_rxq { bus_dma_tag_t fl_desc_tag; bus_dmamap_t fl_desc_map; bus_addr_t fl_ba; - - void *bb; /* bit bucket for packets with nowhere to go. */ - uma_zone_t bb_zone; }; #define INVALID_NM_TXQ_CNTXT_ID ((u_int)(-1)) Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Wed Dec 2 19:58:50 2020 (r368282) +++ head/sys/dev/cxgbe/t4_netmap.c Wed Dec 2 20:54:03 2020 (r368283) @@ -42,8 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include #include #include @@ -588,8 +586,6 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi alloc_nm_rxq_hwq(vi, nm_rxq, tnl_cong(vi->pi, nm_cong_drop)); nm_rxq->fl_hwidx = hwidx; - nm_rxq->bb_zone = rxb->zone; - nm_rxq->bb = uma_zalloc(nm_rxq->bb_zone, M_WAITOK); slot = netmap_reset(na, NR_RX, i, 0); MPASS(slot != NULL);/* XXXNM: error check, not assert */ @@ -632,31 +628,6 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi return (cxgbe_netmap_rss(sc, vi, ifp, na)); } -static void -flush_nm_rxq(struct adapter *sc, struct vi_info *vi, struct sge_nm_rxq *nm_rxq) -{ - int i, n; - u_int fl_pidx, fl_pidx_target, hw_cidx_desc; - const uint64_t ba = pmap_kextract((vm_offset_t)nm_rxq->bb); - - hw_cidx_desc = nm_rxq->fl_cidx / 8; - if (hw_cidx_desc == 0) - fl_pidx_target = nm_rxq->fl_sidx2 - 8; - else - fl_pidx_target = (hw_cidx_desc - 1) * 8; - MPASS((fl_pidx_target & 7) == 0); - - fl_pidx = nm_rxq->fl_pidx; - MPASS((fl_pidx & 7) == 0); - for (n = 0; fl_pidx != fl_pidx_target; n++) { - for (i = 0; i < 8; i++, fl_pidx++) - nm_rxq->fl_desc[fl_pidx] = htobe64(ba | nm_rxq->fl_hwidx); - if (__predict_false(fl_pidx == nm_rxq->fl_sidx2)) - fl_pidx = 0; - } - t4_write_reg(sc, sc->sge_kdoorbell_reg, nm_rxq->fl_db_val | V_PIDX(n)); -} - static int cxgbe_netmap_off(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, struct netmap_adapter *na) @@ -681,23 +652,6 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *v if (rc != 0) return (rc);/* error message logged already. */ - /* -* First pass over the rx queues to make sure they're all caught up. -* -* The freelists could be out of buffers and we may need to arrange -* things so that any packets still in flight (after TP's cong_drop -* logic but not yet DMA'd) have somewhere to go and do not block the -* pipeline. Do this before trying to free any queue. -*/ - for_each_nm_rxq(vi, i, nm_rxq) { - nm_state = atomic_load_int(&nm_rxq->nm_state); - kring = na->rx_rings[nm_rxq->nid]; - if (nm_state == NM_OFF || !nm_kring_pending_off(kring)) - continue; - MPASS(nm_rxq->iq_cntxt_id != INVALID_NM_RXQ_CNTXT_ID); - flush_nm_rxq(sc, vi, nm_rxq); - } - for_each_nm_txq(vi, i, nm_txq) { struct sge_qstat *spg = (void *)&nm_txq->desc[nm_txq->sidx]; @@ -734,8 +688,6 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *v pause("nmst", 1); free_nm_rxq_hwq(vi, nm_rxq); - uma_zfree(nm_rxq->bb_zone, nm_rxq->bb); - nm_rxq->bb = NULL; /* XXX: netmap, not the driver, should do this. */ kring->rhead = kring->rcur = kring->nr_hwcur = 0; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367917 - head/sys/dev/cxgbe
Author: np Date: Sat Nov 21 03:27:32 2020 New Revision: 367917 URL: https://svnweb.freebsd.org/changeset/base/367917 Log: cxgbe(4): Catch up with in-flight netmap rx before destroying queues. The netmap application using the driver is responsible for replenishing the receive freelists and they may be totally depleted when the application exits. Packets in flight, if any, might block the pipeline in case there aren't enough buffers left in the freelist. Avoid this by filling up the freelists with a driver allocated buffer. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_netmap.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hSat Nov 21 00:53:31 2020 (r367916) +++ head/sys/dev/cxgbe/adapter.hSat Nov 21 03:27:32 2020 (r367917) @@ -749,6 +749,9 @@ struct sge_nm_rxq { bus_dma_tag_t fl_desc_tag; bus_dmamap_t fl_desc_map; bus_addr_t fl_ba; + + void *bb; /* bit bucket for packets with nowhere to go. */ + uma_zone_t bb_zone; }; #define INVALID_NM_TXQ_CNTXT_ID ((u_int)(-1)) Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Sat Nov 21 00:53:31 2020 (r367916) +++ head/sys/dev/cxgbe/t4_netmap.c Sat Nov 21 03:27:32 2020 (r367917) @@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -586,6 +588,8 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi alloc_nm_rxq_hwq(vi, nm_rxq, tnl_cong(vi->pi, nm_cong_drop)); nm_rxq->fl_hwidx = hwidx; + nm_rxq->bb_zone = rxb->zone; + nm_rxq->bb = uma_zalloc(nm_rxq->bb_zone, M_WAITOK); slot = netmap_reset(na, NR_RX, i, 0); MPASS(slot != NULL);/* XXXNM: error check, not assert */ @@ -628,6 +632,31 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi return (cxgbe_netmap_rss(sc, vi, ifp, na)); } +static void +flush_nm_rxq(struct adapter *sc, struct vi_info *vi, struct sge_nm_rxq *nm_rxq) +{ + int i, n; + u_int fl_pidx, fl_pidx_target, hw_cidx_desc; + const uint64_t ba = pmap_kextract((vm_offset_t)nm_rxq->bb); + + hw_cidx_desc = nm_rxq->fl_cidx / 8; + if (hw_cidx_desc == 0) + fl_pidx_target = nm_rxq->fl_sidx2 - 8; + else + fl_pidx_target = (hw_cidx_desc - 1) * 8; + MPASS((fl_pidx_target & 7) == 0); + + fl_pidx = nm_rxq->fl_pidx; + MPASS((fl_pidx & 7) == 0); + for (n = 0; fl_pidx != fl_pidx_target; n++) { + for (i = 0; i < 8; i++, fl_pidx++) + nm_rxq->fl_desc[fl_pidx] = htobe64(ba | nm_rxq->fl_hwidx); + if (__predict_false(fl_pidx == nm_rxq->fl_sidx2)) + fl_pidx = 0; + } + t4_write_reg(sc, sc->sge_kdoorbell_reg, nm_rxq->fl_db_val | V_PIDX(n)); +} + static int cxgbe_netmap_off(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, struct netmap_adapter *na) @@ -652,6 +681,23 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *v if (rc != 0) return (rc);/* error message logged already. */ + /* +* First pass over the rx queues to make sure they're all caught up. +* +* The freelists could be out of buffers and we may need to arrange +* things so that any packets still in flight (after TP's cong_drop +* logic but not yet DMA'd) have somewhere to go and do not block the +* pipeline. Do this before trying to free any queue. +*/ + for_each_nm_rxq(vi, i, nm_rxq) { + nm_state = atomic_load_int(&nm_rxq->nm_state); + kring = na->rx_rings[nm_rxq->nid]; + if (nm_state == NM_OFF || !nm_kring_pending_off(kring)) + continue; + MPASS(nm_rxq->iq_cntxt_id != INVALID_NM_RXQ_CNTXT_ID); + flush_nm_rxq(sc, vi, nm_rxq); + } + for_each_nm_txq(vi, i, nm_txq) { struct sge_qstat *spg = (void *)&nm_txq->desc[nm_txq->sidx]; @@ -688,6 +734,8 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *v pause("nmst", 1); free_nm_rxq_hwq(vi, nm_rxq); + uma_zfree(nm_rxq->bb_zone, nm_rxq->bb); + nm_rxq->bb = NULL; /* XXX: netmap, not the driver, should do this. */ kring->rhead = kring->rcur = kring->nr_hwcur = 0; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freeb
svn commit: r367624 - head/sys/dev/cxgbe/tom
Author: np Date: Thu Nov 12 20:02:48 2020 New Revision: 367624 URL: https://svnweb.freebsd.org/changeset/base/367624 Log: cxgbe/t4_tom: Handle VXLAN-encapsulated SYNs correctly. TCP SYNs in inner traffic will hit hardware listeners when VXLAN/NVGRE rx parsing is enabled in the chip. t4_tom should pass on these SYNs to the kernel and let it deal with them as if they arrived on the non-TOE path. Reported by: Sony at Chelsio MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_listen.c Modified: head/sys/dev/cxgbe/tom/t4_listen.c == --- head/sys/dev/cxgbe/tom/t4_listen.c Thu Nov 12 19:25:31 2020 (r367623) +++ head/sys/dev/cxgbe/tom/t4_listen.c Thu Nov 12 20:02:48 2020 (r367624) @@ -1003,6 +1003,17 @@ t4opt_to_tcpopt(const struct tcp_options *t4opt, struc to->to_flags |= TOF_SACKPERM; } +static bool +encapsulated_syn(struct adapter *sc, const struct cpl_pass_accept_req *cpl) +{ + u_int hlen = be32toh(cpl->hdr_len); + + if (chip_id(sc) >= CHELSIO_T6) + return (G_T6_ETH_HDR_LEN(hlen) > sizeof(struct ether_vlan_header)); + else + return (G_ETH_HDR_LEN(hlen) > sizeof(struct ether_vlan_header)); +} + static void pass_accept_req_to_protohdrs(struct adapter *sc, const struct mbuf *m, struct in_conninfo *inc, struct tcphdr *th, uint8_t *iptos) @@ -1194,22 +1205,38 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss CTR4(KTR_CXGBE, "%s: stid %u, tid %u, lctx %p", __func__, stid, tid, lctx); + /* +* Figure out the port the SYN arrived on. We'll look for an exact VI +* match in a bit but in case we don't find any we'll use the main VI as +* the incoming ifnet. +*/ + l2info = be16toh(cpl->l2info); + pi = sc->port[G_SYN_INTF(l2info)]; + hw_ifp = pi->vi[0].ifp; + m->m_pkthdr.rcvif = hw_ifp; + CURVNET_SET(lctx->vnet);/* before any potential REJECT */ /* +* If VXLAN/NVGRE parsing is enabled then SYNs in the inner traffic will +* also hit the listener. We don't want to offload those. +*/ + if (encapsulated_syn(sc, cpl)) { + REJECT_PASS_ACCEPT_REQ(true); + } + + /* * Use the MAC index to lookup the associated VI. If this SYN didn't * match a perfect MAC filter, punt. */ - l2info = be16toh(cpl->l2info); - pi = sc->port[G_SYN_INTF(l2info)]; if (!(l2info & F_SYN_XACT_MATCH)) { - REJECT_PASS_ACCEPT_REQ(false); + REJECT_PASS_ACCEPT_REQ(true); } for_each_vi(pi, v, vi) { if (vi->xact_addr_filt == G_SYN_MAC_IDX(l2info)) goto found; } - REJECT_PASS_ACCEPT_REQ(false); + REJECT_PASS_ACCEPT_REQ(true); found: hw_ifp = vi->ifp; /* the cxgbe ifnet */ m->m_pkthdr.rcvif = hw_ifp; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367608 - head/sys/dev/cxgbe
Author: np Date: Thu Nov 12 01:18:05 2020 New Revision: 367608 URL: https://svnweb.freebsd.org/changeset/base/367608 Log: cxgbev(4): Make sure that the iq/eq map sizes are correct for VFs. This should have been part of r366929. MFC after:3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_vf.c Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cThu Nov 12 00:51:53 2020 (r367607) +++ head/sys/dev/cxgbe/t4_main.cThu Nov 12 01:18:05 2020 (r367608) @@ -4467,9 +4467,9 @@ get_params__post_init(struct adapter *sc) "failed to query parameters (post_init2): %d.\n", rc); return (rc); } - MPASS(val[0] >= sc->sge.iq_start); + MPASS((int)val[0] >= sc->sge.iq_start); sc->sge.iqmap_sz = val[0] - sc->sge.iq_start + 1; - MPASS(val[1] >= sc->sge.eq_start); + MPASS((int)val[1] >= sc->sge.eq_start); sc->sge.eqmap_sz = val[1] - sc->sge.eq_start + 1; if (chip_id(sc) >= CHELSIO_T6) { Modified: head/sys/dev/cxgbe/t4_vf.c == --- head/sys/dev/cxgbe/t4_vf.c Thu Nov 12 00:51:53 2020(r367607) +++ head/sys/dev/cxgbe/t4_vf.c Thu Nov 12 01:18:05 2020(r367608) @@ -695,13 +695,16 @@ t4vf_attach(device_t dev) s->neq += sc->params.nports;/* ctrl queues: 1 per port */ s->niq = s->nrxq + 1; /* 1 extra for firmware event queue */ + s->iqmap_sz = s->niq; + s->eqmap_sz = s->neq; + s->rxq = malloc(s->nrxq * sizeof(struct sge_rxq), M_CXGBE, M_ZERO | M_WAITOK); s->txq = malloc(s->ntxq * sizeof(struct sge_txq), M_CXGBE, M_ZERO | M_WAITOK); - s->iqmap = malloc(s->niq * sizeof(struct sge_iq *), M_CXGBE, + s->iqmap = malloc(s->iqmap_sz * sizeof(struct sge_iq *), M_CXGBE, M_ZERO | M_WAITOK); - s->eqmap = malloc(s->neq * sizeof(struct sge_eq *), M_CXGBE, + s->eqmap = malloc(s->eqmap_sz * sizeof(struct sge_eq *), M_CXGBE, M_ZERO | M_WAITOK); sc->irq = malloc(sc->intr_count * sizeof(struct irq), M_CXGBE, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367502 - in head/sys/dev/cxgbe: . common
Author: np Date: Mon Nov 9 00:08:35 2020 New Revision: 367502 URL: https://svnweb.freebsd.org/changeset/base/367502 Log: cxgbe(4): Allow the PF driver to set a VF's MAC address. The MAC address can be set with the optional mac-addr property in the VF section of the iovctl.conf(5) used to instantiate the VFs. MFC after:2 weeks Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_iov.c Modified: head/sys/dev/cxgbe/common/common.h == --- head/sys/dev/cxgbe/common/common.h Mon Nov 9 00:05:45 2020 (r367501) +++ head/sys/dev/cxgbe/common/common.h Mon Nov 9 00:08:35 2020 (r367502) @@ -691,6 +691,8 @@ void t4_idma_monitor_init(struct adapter *adapter, void t4_idma_monitor(struct adapter *adapter, struct sge_idma_monitor_state *idma, int hz, int ticks); +int t4_set_vf_mac(struct adapter *adapter, unsigned int pf, unsigned int vf, + unsigned int naddr, u8 *addr); unsigned int t4_get_regs_len(struct adapter *adapter); void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size); Modified: head/sys/dev/cxgbe/common/t4_hw.c == --- head/sys/dev/cxgbe/common/t4_hw.c Mon Nov 9 00:05:45 2020 (r367501) +++ head/sys/dev/cxgbe/common/t4_hw.c Mon Nov 9 00:08:35 2020 (r367502) @@ -10202,6 +10202,48 @@ void t4_idma_monitor(struct adapter *adapter, } /** + * t4_set_vf_mac - Set MAC address for the specified VF + * @adapter: The adapter + * @pf: the PF used to instantiate the VFs + * @vf: one of the VFs instantiated by the specified PF + * @naddr: the number of MAC addresses + * @addr: the MAC address(es) to be set to the specified VF + */ +int t4_set_vf_mac(struct adapter *adapter, unsigned int pf, unsigned int vf, + unsigned int naddr, u8 *addr) +{ + struct fw_acl_mac_cmd cmd; + + memset(&cmd, 0, sizeof(cmd)); + cmd.op_to_vfn = cpu_to_be32(V_FW_CMD_OP(FW_ACL_MAC_CMD) | + F_FW_CMD_REQUEST | + F_FW_CMD_WRITE | + V_FW_ACL_MAC_CMD_PFN(pf) | + V_FW_ACL_MAC_CMD_VFN(vf)); + + /* Note: Do not enable the ACL */ + cmd.en_to_len16 = cpu_to_be32((unsigned int)FW_LEN16(cmd)); + cmd.nmac = naddr; + + switch (pf) { + case 3: + memcpy(cmd.macaddr3, addr, sizeof(cmd.macaddr3)); + break; + case 2: + memcpy(cmd.macaddr2, addr, sizeof(cmd.macaddr2)); + break; + case 1: + memcpy(cmd.macaddr1, addr, sizeof(cmd.macaddr1)); + break; + case 0: + memcpy(cmd.macaddr0, addr, sizeof(cmd.macaddr0)); + break; + } + + return t4_wr_mbox(adapter, adapter->mbox, &cmd, sizeof(cmd), &cmd); +} + +/** * t4_read_pace_tbl - read the pace table * @adap: the adapter * @pace_vals: holds the returned values Modified: head/sys/dev/cxgbe/t4_iov.c == --- head/sys/dev/cxgbe/t4_iov.c Mon Nov 9 00:05:45 2020(r367501) +++ head/sys/dev/cxgbe/t4_iov.c Mon Nov 9 00:08:35 2020(r367502) @@ -42,12 +42,19 @@ __FBSDID("$FreeBSD$"); #endif #include "common/common.h" +#include "common/t4_regs.h" #include "t4_if.h" struct t4iov_softc { device_t sc_dev; device_t sc_main; bool sc_attached; + + int pf; + int regs_rid; + struct resource *regs_res; + bus_space_handle_t bh; + bus_space_tag_t bt; }; struct { @@ -113,6 +120,13 @@ struct { {0x6087, "Chelsio T6225-CR 87"}, }; +static inline uint32_t +t4iov_read_reg(struct t4iov_softc *sc, uint32_t reg) +{ + + return bus_space_read_4(sc->bt, sc->bh, reg); +} + static int t4iov_attach_child(device_t dev); static int @@ -179,10 +193,28 @@ static int t4iov_attach(device_t dev) { struct t4iov_softc *sc; + uint32_t pl_rev, whoami; sc = device_get_softc(dev); sc->sc_dev = dev; + sc->regs_rid = PCIR_BAR(0); + sc->regs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->regs_rid, RF_ACTIVE); + if (sc->regs_res == NULL) { + device_printf(dev, "cannot map registers.\n"); + return (ENXIO); + } + sc->bt = rman_get_bustag(sc->regs_res); + sc->bh = rman_get_bushandle(sc->regs_res); + + pl_rev = t4iov_read_reg(sc, A_PL_REV); + whoami = t4iov_read_reg(sc, A_PL_WHOAMI); + if (G_CHIPID(pl_rev) <= CHELSIO_T5) + sc->pf = G_SOURCEPF(whoami); + else + sc->pf = G_T6_SOURCEPF(wh
svn commit: r367497 - in head/sys/dev/cxgbe: . common
Author: np Date: Mon Nov 9 00:01:13 2020 New Revision: 367497 URL: https://svnweb.freebsd.org/changeset/base/367497 Log: cxgbev(4): Use the MAC address set by the the PF if there is one. Query the firmware for the MAC address set by the PF for the VF and use it instead of the firmware generated MAC if it's available. MFC after:2 weeks Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4vf_hw.c head/sys/dev/cxgbe/t4_vf.c Modified: head/sys/dev/cxgbe/common/common.h == --- head/sys/dev/cxgbe/common/common.h Sun Nov 8 23:34:06 2020 (r367496) +++ head/sys/dev/cxgbe/common/common.h Mon Nov 9 00:01:13 2020 (r367497) @@ -912,6 +912,8 @@ int t4vf_get_sge_params(struct adapter *adapter); int t4vf_get_rss_glb_config(struct adapter *adapter); int t4vf_get_vfres(struct adapter *adapter); int t4vf_prep_adapter(struct adapter *adapter); +int t4vf_get_vf_mac(struct adapter *adapter, unsigned int port, + unsigned int *naddr, u8 *addr); int t4_bar2_sge_qregs(struct adapter *adapter, unsigned int qid, enum t4_bar2_qtype qtype, int user, u64 *pbar2_qoffset, unsigned int *pbar2_qid); Modified: head/sys/dev/cxgbe/common/t4vf_hw.c == --- head/sys/dev/cxgbe/common/t4vf_hw.c Sun Nov 8 23:34:06 2020 (r367496) +++ head/sys/dev/cxgbe/common/t4vf_hw.c Mon Nov 9 00:01:13 2020 (r367497) @@ -382,3 +382,49 @@ int t4vf_prep_adapter(struct adapter *adapter) return 0; } + +/* + * t4vf_get_vf_mac - Get the MAC address to be set to the VI of this VF. + * @adapter: The adapter + * @port: The port associated with vf + * @naddr: the number of ACL MAC addresses returned in addr + * @addr: Placeholder for MAC addresses + * + * Find the MAC address to be set to the VF's VI. The requested MAC address + * is from the host OS via callback in the PF driver. + */ +int t4vf_get_vf_mac(struct adapter *adapter, unsigned int port, + unsigned int *naddr, u8 *addr) +{ + struct fw_acl_mac_cmd cmd; + int ret; + + memset(&cmd, 0, sizeof(cmd)); + cmd.op_to_vfn = cpu_to_be32(V_FW_CMD_OP(FW_ACL_MAC_CMD) | + F_FW_CMD_REQUEST | + F_FW_CMD_READ); + cmd.en_to_len16 = cpu_to_be32((unsigned int)FW_LEN16(cmd)); + ret = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &cmd); + if (ret) + return ret; + + if (cmd.nmac < *naddr) + *naddr = cmd.nmac; + + switch (port) { + case 3: + memcpy(addr, cmd.macaddr3, sizeof(cmd.macaddr3)); + break; + case 2: + memcpy(addr, cmd.macaddr2, sizeof(cmd.macaddr2)); + break; + case 1: + memcpy(addr, cmd.macaddr1, sizeof(cmd.macaddr1)); + break; + case 0: + memcpy(addr, cmd.macaddr0, sizeof(cmd.macaddr0)); + break; + } + + return ret; +} Modified: head/sys/dev/cxgbe/t4_vf.c == --- head/sys/dev/cxgbe/t4_vf.c Sun Nov 8 23:34:06 2020(r367496) +++ head/sys/dev/cxgbe/t4_vf.c Mon Nov 9 00:01:13 2020(r367497) @@ -481,7 +481,7 @@ static int t4vf_attach(device_t dev) { struct adapter *sc; - int rc = 0, i, j, rqidx, tqidx; + int rc = 0, i, j, rqidx, tqidx, n, p, pmask; struct make_dev_args mda; struct intrs_and_queues iaq; struct sge *s; @@ -618,8 +618,10 @@ t4vf_attach(device_t dev) * First pass over all the ports - allocate VIs and initialize some * basic parameters like mac address, port type, etc. */ + pmask = sc->params.vfres.pmask; for_each_port(sc, i) { struct port_info *pi; + uint8_t mac[ETHER_ADDR_LEN]; pi = malloc(sizeof(*pi), M_CXGBE, M_ZERO | M_WAITOK); sc->port[i] = pi; @@ -644,6 +646,15 @@ t4vf_attach(device_t dev) sc->port[i] = NULL; goto done; } + + /* Prefer the MAC address set by the PF, if there is one. */ + n = 1; + p = ffs(pmask) - 1; + MPASS(p >= 0); + rc = t4vf_get_vf_mac(sc, p, &n, mac); + if (rc == 0 && n == 1) + t4_os_set_hw_addr(pi, mac); + pmask &= ~(1 << p); /* No t4_link_start. */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367495 - head/sys/dev/cxgbe/firmware
Author: np Date: Sun Nov 8 22:30:13 2020 New Revision: 367495 URL: https://svnweb.freebsd.org/changeset/base/367495 Log: cxgbe(4): Add the firmware binaries missing in r367428. Obtained from:Chelsio Communications MFC after:5 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin (contents, props changed) head/sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin (contents, props changed) head/sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin (contents, props changed) Modified: head/sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin == Binary file (source and/or target). No diff available. Modified: head/sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin == Binary file (source and/or target). No diff available. Modified: head/sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin == Binary file (source and/or target). No diff available. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367428 - in head/sys: conf dev/cxgbe/firmware modules/cxgbe/t4_firmware modules/cxgbe/t5_firmware modules/cxgbe/t6_firmware
Author: np Date: Fri Nov 6 19:04:20 2020 New Revision: 367428 URL: https://svnweb.freebsd.org/changeset/base/367428 Log: cxgbe(4): Update firmwares to 1.25.0.40. This fixes a potential crash in firmware 1.25.0.0 on the passive open side during TOE operation. Obtained from:Chelsio Communications MFC after:1 week Sponsored by: Chelsio Communications Added: head/sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin (contents, props changed) head/sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin (contents, props changed) head/sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin (contents, props changed) Deleted: head/sys/dev/cxgbe/firmware/t4fw-1.25.0.0.bin head/sys/dev/cxgbe/firmware/t5fw-1.25.0.0.bin head/sys/dev/cxgbe/firmware/t6fw-1.25.0.0.bin Modified: head/sys/conf/files head/sys/dev/cxgbe/firmware/t4fw_interface.h head/sys/modules/cxgbe/t4_firmware/Makefile head/sys/modules/cxgbe/t5_firmware/Makefile head/sys/modules/cxgbe/t6_firmware/Makefile Modified: head/sys/conf/files == --- head/sys/conf/files Fri Nov 6 18:50:00 2020(r367427) +++ head/sys/conf/files Fri Nov 6 19:04:20 2020(r367428) @@ -1516,7 +1516,7 @@ t4fw.fwo optional cxgbe \ no-implicit-rule\ clean "t4fw.fwo" t4fw.fwoptional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t4fw-1.25.0.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t4fw-1.25.0.40.bin" \ compile-with"${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t4fw.fw" @@ -1550,7 +1550,7 @@ t5fw.fwo optional cxgbe \ no-implicit-rule\ clean "t5fw.fwo" t5fw.fwoptional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t5fw-1.25.0.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t5fw-1.25.0.40.bin" \ compile-with"${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t5fw.fw" @@ -1584,7 +1584,7 @@ t6fw.fwo optional cxgbe \ no-implicit-rule\ clean "t6fw.fwo" t6fw.fwoptional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t6fw-1.25.0.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t6fw-1.25.0.40.bin" \ compile-with"${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t6fw.fw" Added: head/sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin == Modified: head/sys/dev/cxgbe/firmware/t4fw_interface.h == --- head/sys/dev/cxgbe/firmware/t4fw_interface.hFri Nov 6 18:50:00 2020(r367427) +++ head/sys/dev/cxgbe/firmware/t4fw_interface.hFri Nov 6 19:04:20 2020(r367428) @@ -9985,17 +9985,17 @@ enum { T4FW_VERSION_MAJOR = 1, T4FW_VERSION_MINOR = 25, T4FW_VERSION_MICRO = 0, - T4FW_VERSION_BUILD = 0, + T4FW_VERSION_BUILD = 40, T5FW_VERSION_MAJOR = 1, T5FW_VERSION_MINOR = 25, T5FW_VERSION_MICRO = 0, - T5FW_VERSION_BUILD = 0, + T5FW_VERSION_BUILD = 40, T6FW_VERSION_MAJOR = 1, T6FW_VERSION_MINOR = 25, T6FW_VERSION_MICRO = 0, - T6FW_VERSION_BUILD = 0, + T6FW_VERSION_BUILD = 40, }; enum { Added: head/sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin == Added: head/sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin == Modified: head/sys/modules/cxgbe/t4_firmware/Makefile == --- head/sys/modules/cxgbe/t4_firmware/Makefile Fri Nov 6 18:50:00 2020 (r367427) +++ head/sys/modules/cxgbe/t4_firmware/Makefile Fri Nov 6 19:04:20 2020 (r367428) @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T4FW_VER= 1.25.0.0 +T4FW_VER= 1.25.0.40 FIRMWS+= t4fw-${T4FW_VER}.bin:t4fw:${T4FW_VER} .include Modified: head/sys/modules/cxgbe/t5_firmware/Makefile ==
svn commit: r366959 - head/sys/dev/cxgbe
Author: np Date: Fri Oct 23 02:24:43 2020 New Revision: 366959 URL: https://svnweb.freebsd.org/changeset/base/366959 Log: cxgbe(4): Fix min/max typo in r366958. Modified: head/sys/dev/cxgbe/t4_sched.c Modified: head/sys/dev/cxgbe/t4_sched.c == --- head/sys/dev/cxgbe/t4_sched.c Fri Oct 23 01:36:54 2020 (r366958) +++ head/sys/dev/cxgbe/t4_sched.c Fri Oct 23 02:24:43 2020 (r366959) @@ -924,10 +924,10 @@ cxgbe_ratelimit_query(struct ifnet *ifp, struct if_rat if (chip_id(sc) < CHELSIO_T6) { /* Based on testing by rrs@ with a T580 at burstsize = 4. */ MPASS(q->min_segment_burst == 4); - q->max_flows = max(4000, q->max_flows); + q->max_flows = min(4000, q->max_flows); } else { /* XXX: TBD, carried forward from T5 for now. */ - q->max_flows = max(4000, q->max_flows); + q->max_flows = min(4000, q->max_flows); } /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366958 - head/sys/dev/cxgbe
Author: np Date: Fri Oct 23 01:36:54 2020 New Revision: 366958 URL: https://svnweb.freebsd.org/changeset/base/366958 Log: cxgbe(4): refine the values reported in if_ratelimit_query. - Get the number of classes from chip_params. - Get the number of ethofld tids from the firmware. - Do not let tcp_ratelimit allocate all traffic classes. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sched.c Modified: head/sys/dev/cxgbe/t4_sched.c == --- head/sys/dev/cxgbe/t4_sched.c Fri Oct 23 01:06:42 2020 (r366957) +++ head/sys/dev/cxgbe/t4_sched.c Fri Oct 23 01:36:54 2020 (r366958) @@ -903,34 +903,46 @@ cxgbe_rate_tag_free(struct m_snd_tag *mst) mtx_unlock(&cst->lock); } -#define CXGBE_MAX_FLOWS 4000 /* Testing show so far thats all this adapter can do */ -#define CXGBE_UNIQUE_RATE_COUNT 16 /* Number of unique rates that can be setup */ - void -cxgbe_ratelimit_query(struct ifnet *ifp __unused, - struct if_ratelimit_query_results *q) +cxgbe_ratelimit_query(struct ifnet *ifp, struct if_ratelimit_query_results *q) { - /* -* This is a skeleton and needs future work -* by the driver supporters. It should be -* enhanced to look at the specific type of -* interface and select approprate values -* for these settings. This example goes -* with an earlier card (t5), it has a maximum -* number of 16 rates that the first guys in -* select (thus the flags value RT_IS_SELECTABLE). -* If it was a fixed table then we would setup a -* const array (example mlx5). Note the card tested -* can only support reasonably 4000 flows before -* the adapter has issues with sending so here -* we limit the number of flows using hardware -* pacing to that number, other cards may -* be able to raise or eliminate this limit. -*/ + struct vi_info *vi = ifp->if_softc; + struct adapter *sc = vi->adapter; + q->rate_table = NULL; q->flags = RT_IS_SELECTABLE; - q->max_flows = CXGBE_MAX_FLOWS; - q->number_of_rates = CXGBE_UNIQUE_RATE_COUNT; - q->min_segment_burst = 4; /* Driver emits 4 in a burst */ + /* +* Absolute max limits from the firmware configuration. Practical +* limits depend on the burstsize, pktsize (ifp->if_mtu ultimately) and +* the card's cclk. +*/ + q->max_flows = sc->tids.netids; + q->number_of_rates = sc->chip_params->nsched_cls; + q->min_segment_burst = 4; /* matches PKTSCHED_BURST in the firmware. */ + +#if 1 + if (chip_id(sc) < CHELSIO_T6) { + /* Based on testing by rrs@ with a T580 at burstsize = 4. */ + MPASS(q->min_segment_burst == 4); + q->max_flows = max(4000, q->max_flows); + } else { + /* XXX: TBD, carried forward from T5 for now. */ + q->max_flows = max(4000, q->max_flows); + } + + /* +* XXX: tcp_ratelimit.c grabs all available rates on link-up before it +* even knows whether hw pacing will be used or not. This prevents +* other consumers like SO_MAX_PACING_RATE or those using cxgbetool or +* the private ioctls from using any of traffic classes. +* +* Underreport the number of rates to tcp_ratelimit so that it doesn't +* hog all of them. This can be removed if/when tcp_ratelimit switches +* to making its allocations on first-use rather than link-up. There is +* nothing wrong with one particular consumer reserving all the classes +* but it should do so only if it'll actually use hw rate limiting. +*/ + q->number_of_rates /= 4; +#endif } #endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366941 - head/sys/net
Author: np Date: Thu Oct 22 17:05:55 2020 New Revision: 366941 URL: https://svnweb.freebsd.org/changeset/base/366941 Log: if_vxlan(4): csum_flags_to_inner_flags takes the tunnel protocol as a parameter. No functional change. Modified: head/sys/net/if_vxlan.c Modified: head/sys/net/if_vxlan.c == --- head/sys/net/if_vxlan.c Thu Oct 22 16:41:13 2020(r366940) +++ head/sys/net/if_vxlan.c Thu Oct 22 17:05:55 2020(r366941) @@ -2423,9 +2423,9 @@ vxlan_encap_header(struct vxlan_softc *sc, struct mbuf * Return the CSUM_INNER_* equivalent of CSUM_* caps. */ static uint32_t -csum_flags_to_inner_flags(uint32_t csum_flags_in, uint32_t encap) +csum_flags_to_inner_flags(uint32_t csum_flags_in, const uint32_t encap) { - uint32_t csum_flags = CSUM_ENCAP_VXLAN; + uint32_t csum_flags = encap; const uint32_t v4 = CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP; /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366929 - head/sys/dev/cxgbe
Author: np Date: Thu Oct 22 08:40:25 2020 New Revision: 366929 URL: https://svnweb.freebsd.org/changeset/base/366929 Log: cxgbe(4): fix the size of the iq/eq maps. The firmware can allocate ingress and egress context ids anywhere from its configured range. Size the iq/eq maps to match the entire range instead of assuming that the firmware always allocates the first available context id. Reported by: Baptiste Wicht @ Verisign MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hThu Oct 22 06:51:47 2020 (r366928) +++ head/sys/dev/cxgbe/adapter.hThu Oct 22 08:40:25 2020 (r366929) @@ -799,6 +799,8 @@ struct sge { uint16_t iq_base; /* first abs_id */ int eq_start; /* first cntxt_id */ int eq_base;/* first abs_id */ + int iqmap_sz; + int eqmap_sz; struct sge_iq **iqmap; /* iq->cntxt_id to iq mapping */ struct sge_eq **eqmap; /* eq->cntxt_id to eq mapping */ Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cThu Oct 22 06:51:47 2020 (r366928) +++ head/sys/dev/cxgbe/t4_main.cThu Oct 22 08:40:25 2020 (r366929) @@ -1358,6 +1358,8 @@ t4_attach(device_t dev) s->nm_txq = malloc(s->nnmtxq * sizeof(struct sge_nm_txq), M_CXGBE, M_ZERO | M_WAITOK); #endif + MPASS(s->niq <= s->iqmap_sz); + MPASS(s->neq <= s->eqmap_sz); s->ctrlq = malloc(nports * sizeof(struct sge_wrq), M_CXGBE, M_ZERO | M_WAITOK); @@ -1365,9 +1367,9 @@ t4_attach(device_t dev) M_ZERO | M_WAITOK); s->txq = malloc(s->ntxq * sizeof(struct sge_txq), M_CXGBE, M_ZERO | M_WAITOK); - s->iqmap = malloc(s->niq * sizeof(struct sge_iq *), M_CXGBE, + s->iqmap = malloc(s->iqmap_sz * sizeof(struct sge_iq *), M_CXGBE, M_ZERO | M_WAITOK); - s->eqmap = malloc(s->neq * sizeof(struct sge_eq *), M_CXGBE, + s->eqmap = malloc(s->eqmap_sz * sizeof(struct sge_eq *), M_CXGBE, M_ZERO | M_WAITOK); sc->irq = malloc(sc->intr_count * sizeof(struct irq), M_CXGBE, @@ -4456,6 +4458,19 @@ get_params__post_init(struct adapter *sc) ("%s: L2 table size (%u) larger than expected (%u)", __func__, sc->vres.l2t.size, L2T_SIZE)); sc->params.core_vdd = val[6]; + + param[0] = FW_PARAM_PFVF(IQFLINT_END); + param[1] = FW_PARAM_PFVF(EQ_END); + rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 2, param, val); + if (rc != 0) { + device_printf(sc->dev, + "failed to query parameters (post_init2): %d.\n", rc); + return (rc); + } + MPASS(val[0] >= sc->sge.iq_start); + sc->sge.iqmap_sz = val[0] - sc->sge.iq_start + 1; + MPASS(val[1] >= sc->sge.eq_start); + sc->sge.eqmap_sz = val[1] - sc->sge.eq_start + 1; if (chip_id(sc) >= CHELSIO_T6) { Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Thu Oct 22 06:51:47 2020 (r366928) +++ head/sys/dev/cxgbe/t4_netmap.c Thu Oct 22 08:40:25 2020 (r366929) @@ -188,9 +188,9 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq nm_rxq->iq_cntxt_id = be16toh(c.iqid); nm_rxq->iq_abs_id = be16toh(c.physiqid); cntxt_id = nm_rxq->iq_cntxt_id - sc->sge.iq_start; - if (cntxt_id >= sc->sge.niq) { + if (cntxt_id >= sc->sge.iqmap_sz) { panic ("%s: nm_rxq->iq_cntxt_id (%d) more than the max (%d)", - __func__, cntxt_id, sc->sge.niq - 1); + __func__, cntxt_id, sc->sge.iqmap_sz - 1); } sc->sge.iqmap[cntxt_id] = (void *)nm_rxq; @@ -201,9 +201,9 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq nm_rxq->fl_db_threshold = chip_id(sc) <= CHELSIO_T5 ? 8 : 4; MPASS(nm_rxq->fl_sidx == na->num_rx_desc); cntxt_id = nm_rxq->fl_cntxt_id - sc->sge.eq_start; - if (cntxt_id >= sc->sge.neq) { + if (cntxt_id >= sc->sge.eqmap_sz) { panic("%s: nm_rxq->fl_cntxt_id (%d) more than the max (%d)", - __func__, cntxt_id, sc->sge.neq - 1); + __func__, cntxt_id, sc->sge.eqmap_sz - 1); } sc->sge.eqmap[cntxt_id] = (void *)nm_rxq; @@ -300,9 +300,9 @@ alloc_nm_txq_hwq(struct vi_info *vi, struct sge_nm_txq nm_txq->cntxt_id = G_FW_EQ_ETH_CMD_EQID(be32toh(c.eqid_pkd)); cntxt_id = nm_txq->cntxt_id - sc->sge.eq_start; - if
svn commit: r366916 - head/sys/dev/cxgbe
Author: np Date: Wed Oct 21 20:42:29 2020 New Revision: 366916 URL: https://svnweb.freebsd.org/changeset/base/366916 Log: cxgbe(4): display correct tid range for T6 based -SO cards. Reported by: Chelsio QA MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cWed Oct 21 18:45:48 2020 (r366915) +++ head/sys/dev/cxgbe/t4_main.cWed Oct 21 20:42:29 2020 (r366916) @@ -9325,8 +9325,10 @@ sysctl_tids(SYSCTL_HANDLER_ARGS) if (b) sbuf_printf(sb, "%u-%u, ", t->tid_base, b - 1); sbuf_printf(sb, "%u-%u", hb, t->ntids - 1); - } else - sbuf_printf(sb, "%u-%u", t->tid_base, t->ntids - 1); + } else { + sbuf_printf(sb, "%u-%u", t->tid_base, t->tid_base + + t->ntids - 1); + } sbuf_printf(sb, ", in use: %u\n", atomic_load_acq_int(&t->tids_in_use)); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366862 - in head: share/man/man4 sys/dev/cxgbe
Author: np Date: Mon Oct 19 21:11:49 2020 New Revision: 366862 URL: https://svnweb.freebsd.org/changeset/base/366862 Log: cxgbe(4): Updates to the drop features from r366532. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/share/man/man4/cxgbe.4 head/sys/dev/cxgbe/t4_main.c Modified: head/share/man/man4/cxgbe.4 == --- head/share/man/man4/cxgbe.4 Mon Oct 19 20:43:29 2020(r366861) +++ head/share/man/man4/cxgbe.4 Mon Oct 19 21:11:49 2020(r366862) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 8, 2020 +.Dd October 19, 2020 .Dt CXGBE 4 .Os .Sh NAME @@ -369,6 +369,7 @@ The attack filter will drop an incoming frame if any o true: src ip/ip6 == dst ip/ip6; tcp and src/dst ip is not unicast; src/dst ip is loopback (127.x.y.z); src ip6 is not unicast; src/dst ip6 is loopback (::1/128) or unspecified (::/128); tcp and src/dst ip6 is mcast (ff00::/8). +This facility is available on T4 and T5 based cards only. .It Va hw.cxgbe.drop_ip_fragments Set to 1 to drop all incoming IP fragments. Default is 0. @@ -378,9 +379,11 @@ Set to 1 to drop incoming frames with Layer 2 length o Default is 1. .It Va hw.cxgbe.drop_pkts_with_l3_errors Set to 1 to drop incoming frames with IP version, length, or checksum errors. +The IP checksum is validated for TCP or UDP packets only. Default is 0. .It Va hw.cxgbe.drop_pkts_with_l4_errors -Set to 1 to drop incoming frames with Layer 4 length, checksum, or other errors. +Set to 1 to drop incoming frames with Layer 4 (TCP or UDP) length, +checksum, or other errors. Default is 0. .El .Sh SUPPORT Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cMon Oct 19 20:43:29 2020 (r366861) +++ head/sys/dev/cxgbe/t4_main.cMon Oct 19 21:11:49 2020 (r366862) @@ -4823,7 +4823,7 @@ set_params__post_init(struct adapter *sc) F_DROPERRORIPHDRLEN | F_DROPERRORTCPHDRLEN | F_DROPERRORPKTLEN | F_DROPERRORTCPOPT | F_DROPERRORCSUMIP | F_DROPERRORCSUM; val = 0; - if (t4_attack_filter != 0) { + if (chip_id(sc) < CHELSIO_T6 && t4_attack_filter != 0) { t4_set_reg_field(sc, A_TP_GLOBAL_CONFIG, F_ATTACKFILTERENABLE, F_ATTACKFILTERENABLE); val |= F_DROPERRORATTACK; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366853 - head/sys/dev/cxgbe/common
Author: np Date: Mon Oct 19 20:08:47 2020 New Revision: 366853 URL: https://svnweb.freebsd.org/changeset/base/366853 Log: cxgbe(4): Fix page fault in t4_get_lb_stats with 2 port T5 cards. PR: 250449 Reported by: freqlabs@ MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c == --- head/sys/dev/cxgbe/common/t4_hw.c Mon Oct 19 20:04:03 2020 (r366852) +++ head/sys/dev/cxgbe/common/t4_hw.c Mon Oct 19 20:08:47 2020 (r366853) @@ -6957,7 +6957,6 @@ void t4_get_port_stats(struct adapter *adap, int idx, */ void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p) { - u32 bgmap = adap2pinfo(adap, idx)->mps_bg_map; #define GET_STAT(name) \ t4_read_reg64(adap, \ @@ -6982,14 +6981,18 @@ void t4_get_lb_stats(struct adapter *adap, int idx, st p->frames_1519_max = GET_STAT(1519B_MAX); p->drop = GET_STAT(DROP_FRAMES); - p->ovflow0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_LB_DROP_FRAME) : 0; - p->ovflow1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_LB_DROP_FRAME) : 0; - p->ovflow2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_LB_DROP_FRAME) : 0; - p->ovflow3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_LB_DROP_FRAME) : 0; - p->trunc0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_LB_TRUNC_FRAME) : 0; - p->trunc1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_LB_TRUNC_FRAME) : 0; - p->trunc2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_LB_TRUNC_FRAME) : 0; - p->trunc3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_LB_TRUNC_FRAME) : 0; + if (idx < adap->params.nports) { + u32 bg = adap2pinfo(adap, idx)->mps_bg_map; + + p->ovflow0 = (bg & 1) ? GET_STAT_COM(RX_BG_0_LB_DROP_FRAME) : 0; + p->ovflow1 = (bg & 2) ? GET_STAT_COM(RX_BG_1_LB_DROP_FRAME) : 0; + p->ovflow2 = (bg & 4) ? GET_STAT_COM(RX_BG_2_LB_DROP_FRAME) : 0; + p->ovflow3 = (bg & 8) ? GET_STAT_COM(RX_BG_3_LB_DROP_FRAME) : 0; + p->trunc0 = (bg & 1) ? GET_STAT_COM(RX_BG_0_LB_TRUNC_FRAME) : 0; + p->trunc1 = (bg & 2) ? GET_STAT_COM(RX_BG_1_LB_TRUNC_FRAME) : 0; + p->trunc2 = (bg & 4) ? GET_STAT_COM(RX_BG_2_LB_TRUNC_FRAME) : 0; + p->trunc3 = (bg & 8) ? GET_STAT_COM(RX_BG_3_LB_TRUNC_FRAME) : 0; + } #undef GET_STAT #undef GET_STAT_COM ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366696 - head/sys/dev/cxgbe/common
Author: np Date: Wed Oct 14 10:12:39 2020 New Revision: 366696 URL: https://svnweb.freebsd.org/changeset/base/366696 Log: cxgbe(4): Do not request FEC when requesting speeds that don't have FEC. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c == --- head/sys/dev/cxgbe/common/t4_hw.c Wed Oct 14 09:22:54 2020 (r366695) +++ head/sys/dev/cxgbe/common/t4_hw.c Wed Oct 14 10:12:39 2020 (r366696) @@ -3915,7 +3915,7 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int m speed = fwcap_top_speed(lc->pcaps); fec = 0; - if (fec_supported(lc->pcaps)) { + if (fec_supported(speed)) { if (lc->requested_fec == FEC_AUTO) { if (lc->pcaps & FW_PORT_CAP32_FORCE_FEC) { if (speed & FW_PORT_CAP32_SPEED_100G) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366694 - head/sys/dev/cxgbe/cudbg
Author: np Date: Wed Oct 14 08:04:39 2020 New Revision: 366694 URL: https://svnweb.freebsd.org/changeset/base/366694 Log: cxgbe(4): unimplemented cudbg routines should return the correct internal error code and not an errno. Submitted by: Krishnamraju Eraparaju @ Chelsio MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/cudbg/cudbg_lib.c Modified: head/sys/dev/cxgbe/cudbg/cudbg_lib.c == --- head/sys/dev/cxgbe/cudbg/cudbg_lib.cWed Oct 14 06:25:55 2020 (r366693) +++ head/sys/dev/cxgbe/cudbg/cudbg_lib.cWed Oct 14 08:04:39 2020 (r366694) @@ -2027,7 +2027,7 @@ err1: err: return rc; #endif - return (EDOOFUS); + return (CUDBG_STATUS_NOT_IMPLEMENTED); } /* CIM OBQ */ @@ -2664,7 +2664,7 @@ err1: err: return rc; #endif - return (EDOOFUS); + return (CUDBG_STATUS_NOT_IMPLEMENTED); } static void collect_mem_info(struct cudbg_init *pdbg_init, @@ -3130,7 +3130,7 @@ err1: err: return rc; #endif - return (EDOOFUS); + return (CUDBG_STATUS_NOT_IMPLEMENTED); } static int collect_pbt_tables(struct cudbg_init *pdbg_init, @@ -4450,5 +4450,5 @@ err1: err: return rc; #endif - return (EDOOFUS); + return (CUDBG_STATUS_NOT_IMPLEMENTED); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366589 - in head/sys/dev/cxgbe: . common
Author: np Date: Fri Oct 9 22:23:39 2020 New Revision: 366589 URL: https://svnweb.freebsd.org/changeset/base/366589 Log: cxgbe(4): More fixes for the T6 FCS error counter. r365732 was the first attempt to get an accurate count but it was writing to some read-only registers to clear them and that obviously didn't work. Instead, note the counter's value when it is supposed to be cleared and subtract it from future readings. dev..stats.rx_fcs_error should not be serviced from the MPS register for T6. The stats.* sysctls should all use T5_PORT_REG for T5 and above. This must have been missed in the initial T5 support years ago. Fix it while here. MFC after:3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hFri Oct 9 21:01:53 2020 (r366588) +++ head/sys/dev/cxgbe/adapter.hFri Oct 9 22:23:39 2020 (r366589) @@ -314,6 +314,8 @@ struct port_info { struct port_stats stats; u_int tnl_cong_drops; u_int tx_parse_error; + int fcs_reg; + uint64_t fcs_base; u_long tx_toe_tls_records; u_long tx_toe_tls_octets; u_long rx_toe_tls_records; Modified: head/sys/dev/cxgbe/common/t4_hw.c == --- head/sys/dev/cxgbe/common/t4_hw.c Fri Oct 9 21:01:53 2020 (r366588) +++ head/sys/dev/cxgbe/common/t4_hw.c Fri Oct 9 22:23:39 2020 (r366589) @@ -6852,8 +6852,8 @@ void t4_get_port_stats_offset(struct adapter *adap, in */ void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) { - u32 bgmap = adap2pinfo(adap, idx)->mps_bg_map; - struct link_config *lc = &adap->port[idx]->link_cfg; + struct port_info *pi = adap->port[idx]; + u32 bgmap = pi->mps_bg_map; u32 stat_ctl = t4_read_reg(adap, A_MPS_STAT_CTL); #define GET_STAT(name) \ @@ -6922,25 +6922,8 @@ void t4_get_port_stats(struct adapter *adap, int idx, p->rx_ppp6 = GET_STAT(RX_PORT_PPP6); p->rx_ppp7 = GET_STAT(RX_PORT_PPP7); - /* -* The T6's MPS's RX_PORT_CRC_ERROR register doesn't actually count CRC -* errors so get that information from the MAC instead. Which MAC is in -* use depends on speed and FEC. The MAC counters clear on reset or -* link state change so we are only reporting errors for this -* incarnation of the link here. -*/ - if (chip_id(adap) != CHELSIO_T6) - p->rx_fcs_err = GET_STAT(RX_PORT_CRC_ERROR); - else if (lc->link_ok) { - if (lc->speed > 25000 || - (lc->speed == 25000 && lc->fec == FEC_RS)) { - p->rx_fcs_err = t4_read_reg64(adap, T5_PORT_REG(idx, - A_MAC_PORT_AFRAMECHECKSEQUENCEERRORS)); - } else { - p->rx_fcs_err = t4_read_reg64(adap, T5_PORT_REG(idx, - A_MAC_PORT_MTIP_1G10G_RX_CRCERRORS)); - } - } + if (pi->fcs_reg != -1) + p->rx_fcs_err = t4_read_reg64(adap, pi->fcs_reg) - pi->fcs_base; if (chip_id(adap) >= CHELSIO_T5) { if (stat_ctl & F_COUNTPAUSESTATRX) { @@ -10769,12 +10752,6 @@ void t4_clr_port_stats(struct adapter *adap, int idx) t4_write_reg(adap, A_MPS_STAT_RX_BG_0_MAC_TRUNC_FRAME_L + i * 8, 0); } - if (chip_id(adap) == CHELSIO_T6) { - t4_write_reg64(adap, T5_PORT_REG(idx, - A_MAC_PORT_AFRAMECHECKSEQUENCEERRORS), 0); - t4_write_reg64(adap, T5_PORT_REG(idx, - A_MAC_PORT_MTIP_1G10G_RX_CRCERRORS), 0); - } } /** Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cFri Oct 9 21:01:53 2020 (r366588) +++ head/sys/dev/cxgbe/t4_main.cFri Oct 9 22:23:39 2020 (r366589) @@ -1253,6 +1253,23 @@ t4_attach(device_t dev) mtx_init(&pi->pi_lock, pi->lockname, 0, MTX_DEF); sc->chan_map[pi->tx_chan] = i; + /* +* The MPS counter for FCS errors doesn't work correctly on the +* T6 so we use the MAC counter here. Which MAC is in use +* depends on the link settings which will be known when the +* link comes up. +*/ + if (is_t6(sc)) { + pi->fcs_reg = -1; + } else if (is_t4(sc)) { + pi->fcs_reg = PORT_REG(pi->tx_chan, + A_MPS_P
svn commit: r366532 - in head: share/man/man4 sys/dev/cxgbe
Author: np Date: Thu Oct 8 10:00:13 2020 New Revision: 366532 URL: https://svnweb.freebsd.org/changeset/base/366532 Log: cxgbe(4): knobs to drop various kinds of undesirable frames on ingress. These kind of drops come for free in the sense that they do not use the filter TCAM or any other resource that wouldn't normally be used during rx. Frames dropped by the hardware get counted in the MAC's rx stats but are not delivered to the driver. hw.cxgbe.attack_filter Set to 1 to enable the "attack filter". Default is 0. The attack filter will drop an incoming frame if any of these conditions is true: src ip/ip6 == dst ip/ip6; tcp and src/dst ip is not unicast; src/dst ip is loopback (127.x.y.z); src ip6 is not unicast; src/dst ip6 is loopback (::1/128) or unspecified (::/128); tcp and src/dst ip6 is mcast (ff00::/8). hw.cxgbe.drop_ip_fragments Set to 1 to drop all incoming IP fragments. Default is 0. Note that this drops valid frames. hw.cxgbe.drop_pkts_with_l2_errors Set to 1 to drop incoming frames with Layer 2 length or checksum errors. Default is 1. hw.cxgbe.drop_pkts_with_l3_errors Set to 1 to drop incoming frames with IP version, length, or checksum errors. Default is 0. hw.cxgbe.drop_pkts_with_l4_errors Set to 1 to drop incoming frames with Layer 4 length, checksum, or other errors. Default is 0. MFC after:2 weeks Sponsored by: Chelsio Communications Modified: head/share/man/man4/cxgbe.4 head/sys/dev/cxgbe/t4_main.c Modified: head/share/man/man4/cxgbe.4 == --- head/share/man/man4/cxgbe.4 Thu Oct 8 04:00:31 2020(r366531) +++ head/share/man/man4/cxgbe.4 Thu Oct 8 10:00:13 2020(r366532) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 17, 2020 +.Dd October 8, 2020 .Dt CXGBE 4 .Os .Sh NAME @@ -362,6 +362,26 @@ The default value is 0 and should be changed only if P to communicate with each other. Different interfaces can be assigned different values using the dev..X.tx_vm_wr sysctl when the interface is administratively down. +.It Va hw.cxgbe.attack_filter +Set to 1 to enable the "attack filter". +Default is 0. +The attack filter will drop an incoming frame if any of these conditions is +true: src ip/ip6 == dst ip/ip6; tcp and src/dst ip is not unicast; src/dst ip is +loopback (127.x.y.z); src ip6 is not unicast; src/dst ip6 is loopback (::1/128) +or unspecified (::/128); tcp and src/dst ip6 is mcast (ff00::/8). +.It Va hw.cxgbe.drop_ip_fragments +Set to 1 to drop all incoming IP fragments. +Default is 0. +Note that this drops valid frames. +.It Va hw.cxgbe.drop_pkts_with_l2_errors +Set to 1 to drop incoming frames with Layer 2 length or checksum errors. +Default is 1. +.It Va hw.cxgbe.drop_pkts_with_l3_errors +Set to 1 to drop incoming frames with IP version, length, or checksum errors. +Default is 0. +.It Va hw.cxgbe.drop_pkts_with_l4_errors +Set to 1 to drop incoming frames with Layer 4 length, checksum, or other errors. +Default is 0. .El .Sh SUPPORT For general information and support, Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cThu Oct 8 04:00:31 2020 (r366531) +++ head/sys/dev/cxgbe/t4_main.cThu Oct 8 10:00:13 2020 (r366532) @@ -595,6 +595,46 @@ static int t4_tx_vm_wr = 0; SYSCTL_INT(_hw_cxgbe, OID_AUTO, tx_vm_wr, CTLFLAG_RWTUN, &t4_tx_vm_wr, 0, "Use VM work requests to transmit packets."); +/* + * Set to non-zero to enable the attack filter. A packet that matches any of + * these conditions will get dropped on ingress: + * 1) IP && source address == destination address. + * 2) TCP/IP && source address is not a unicast address. + * 3) TCP/IP && destination address is not a unicast address. + * 4) IP && source address is loopback (127.x.y.z). + * 5) IP && destination address is loopback (127.x.y.z). + * 6) IPv6 && source address == destination address. + * 7) IPv6 && source address is not a unicast address. + * 8) IPv6 && source address is loopback (::1/128). + * 9) IPv6 && destination address is loopback (::1/128). + * 10) IPv6 && source address is unspecified (::/128). + * 11) IPv6 && destination address is unspecified (::/128). + * 12) TCP/IPv6 && source address is multicast (ff00::/8). + * 13) TCP/IPv6 && destination address is multicast (ff00::/8). + */ +static int t4_attack_filter = 0; +SYSCTL_INT(_hw_cxgbe, OID_AUTO, attack_filter, CTLFLAG_RDTUN, +&t4_attack_filter, 0, "Drop suspicious traffic"); + +static int t4_drop_ip_fragments = 0; +SYSCTL_INT(_hw_cxgbe, OID_AUTO, drop_ip_fragments, CTLFLAG_RDTUN, +&t4_drop_ip_fragments, 0, "Drop IP fragments"); + +static int t4_drop_pkts_with_l2_errors = 1; +SYSCTL_INT(_hw_cxgbe, OID_AUTO, drop_pkts_with_l2_errors, CTLFLAG_RDTUN, +&t4_drop_pkts_with_l2_errors, 0, +"Drop all frames with Layer 2
svn commit: r366467 - head/sys/dev/cxgbe
Author: np Date: Mon Oct 5 22:18:04 2020 New Revision: 366467 URL: https://svnweb.freebsd.org/changeset/base/366467 Log: cxgbe(4) sysctls do not need Giant. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cMon Oct 5 20:57:44 2020 (r366466) +++ head/sys/dev/cxgbe/t4_main.cMon Oct 5 22:18:04 2020 (r366467) @@ -6327,7 +6327,7 @@ t4_sysctls(struct adapter *sc) sc->params.nports, "# of ports"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "doorbells", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, doorbells, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, doorbells, (uintptr_t)&sc->doorbells, sysctl_bitfield_8b, "A", "available doorbells"); @@ -6335,12 +6335,12 @@ t4_sysctls(struct adapter *sc) sc->params.vpd.cclk, "core clock frequency (in KHz)"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "holdoff_timers", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc->params.sge.timer_val, sizeof(sc->params.sge.timer_val), sysctl_int_array, "A", "interrupt holdoff timer values (us)"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "holdoff_pkt_counts", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc->params.sge.counter_val, sizeof(sc->params.sge.counter_val), sysctl_int_array, "A", "interrupt holdoff packet counter values"); @@ -6400,7 +6400,7 @@ t4_sysctls(struct adapter *sc) #define SYSCTL_CAP(name, n, text) \ SYSCTL_ADD_PROC(ctx, children, OID_AUTO, #name, \ - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, caps_decoder[n], \ + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, caps_decoder[n], \ (uintptr_t)&sc->name, sysctl_bitfield_16b, "A", \ "available " text " capabilities") @@ -6419,27 +6419,27 @@ t4_sysctls(struct adapter *sc) NULL, sc->tids.nftids, "number of filters"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "temperature", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 0, + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, sysctl_temperature, "I", "chip temperature (in Celsius)"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "reset_sensor", - CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, sysctl_reset_sensor, "I", "reset the chip's temperature sensor."); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "loadavg", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 0, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, sysctl_loadavg, "A", "microprocessor load averages (debug firmwares only)"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "core_vdd", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 0, sysctl_vdd, + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, sysctl_vdd, "I", "core Vdd (in mV)"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "local_cpus", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, LOCAL_CPUS, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, LOCAL_CPUS, sysctl_cpus, "A", "local CPUs"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_cpus", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, INTR_CPUS, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, INTR_CPUS, sysctl_cpus, "A", "preferred CPUs for interrupts"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "swintr", CTLFLAG_RW, @@ -6454,175 +6454,175 @@ t4_sysctls(struct adapter *sc) children = SYSCTL_CHILDREN(oid); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cctrl", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 0, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, sysctl_cctrl, "A", "congestion control"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cim_ibq_tp0", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 0, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, sysctl_cim_ibq_obq, "A", "CIM IBQ 0 (TP0)"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cim_ibq_tp1", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 1, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 1, sysctl_cim_ibq_obq, "A", "CIM IBQ 1 (TP1)"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cim_ibq_ulp", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 2, + C
svn commit: r366440 - head/tools/tools/cxgbtool
Author: np Date: Mon Oct 5 06:53:29 2020 New Revision: 366440 URL: https://svnweb.freebsd.org/changeset/base/366440 Log: Get tools/tools/cxgbtool to build with the latest clang. Reported by: olivier@ Modified: head/tools/tools/cxgbtool/Makefile Modified: head/tools/tools/cxgbtool/Makefile == --- head/tools/tools/cxgbtool/Makefile Mon Oct 5 06:38:56 2020 (r366439) +++ head/tools/tools/cxgbtool/Makefile Mon Oct 5 06:53:29 2020 (r366440) @@ -6,5 +6,6 @@ MAN= CFLAGS+= -I${.CURDIR}/../../../sys/dev/cxgb -I. CFLAGS+= -DCONFIG_T3_REGS -DCHELSIO_INTERNAL BINDIR?= /usr/sbin +WARNS?= 3 .include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366384 - head/sys/dev/cxgbe/tom
Author: np Date: Fri Oct 2 23:48:57 2020 New Revision: 366384 URL: https://svnweb.freebsd.org/changeset/base/366384 Log: cxgbe(4): set up the firmware flowc for the tid before send_abort_rpl. MFC after:3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_listen.c Modified: head/sys/dev/cxgbe/tom/t4_listen.c == --- head/sys/dev/cxgbe/tom/t4_listen.c Fri Oct 2 21:15:49 2020 (r366383) +++ head/sys/dev/cxgbe/tom/t4_listen.c Fri Oct 2 23:48:57 2020 (r366384) @@ -342,48 +342,32 @@ release_lctx(struct adapter *sc, struct listen_ctx *lc } static void -send_reset_synqe(struct toedev *tod, struct synq_entry *synqe) +send_flowc_wr_synqe(struct adapter *sc, struct synq_entry *synqe) { - struct adapter *sc = tod->tod_softc; struct mbuf *m = synqe->syn; struct ifnet *ifp = m->m_pkthdr.rcvif; struct vi_info *vi = ifp->if_softc; struct port_info *pi = vi->pi; - struct l2t_entry *e = &sc->l2t->l2tab[synqe->params.l2t_idx]; struct wrqe *wr; struct fw_flowc_wr *flowc; - struct cpl_abort_req *req; - int flowclen; struct sge_wrq *ofld_txq; struct sge_ofld_rxq *ofld_rxq; const int nparams = 6; + const int flowclen = sizeof(*flowc) + nparams * sizeof(struct fw_flowc_mnemval); const u_int pfvf = sc->pf << S_FW_VIID_PFN; INP_WLOCK_ASSERT(synqe->lctx->inp); + MPASS((synqe->flags & TPF_FLOWC_WR_SENT) == 0); - CTR5(KTR_CXGBE, "%s: synqe %p (0x%x), tid %d%s", - __func__, synqe, synqe->flags, synqe->tid, - synqe->flags & TPF_ABORT_SHUTDOWN ? - " (abort already in progress)" : ""); - if (synqe->flags & TPF_ABORT_SHUTDOWN) - return; /* abort already in progress */ - synqe->flags |= TPF_ABORT_SHUTDOWN; - ofld_txq = &sc->sge.ofld_txq[synqe->params.txq_idx]; ofld_rxq = &sc->sge.ofld_rxq[synqe->params.rxq_idx]; - /* The wrqe will have two WRs - a flowc followed by an abort_req */ - flowclen = sizeof(*flowc) + nparams * sizeof(struct fw_flowc_mnemval); - - wr = alloc_wrqe(roundup2(flowclen, EQ_ESIZE) + sizeof(*req), ofld_txq); + wr = alloc_wrqe(roundup2(flowclen, 16), ofld_txq); if (wr == NULL) { /* XXX */ panic("%s: allocation failure.", __func__); } flowc = wrtod(wr); - req = (void *)((caddr_t)flowc + roundup2(flowclen, EQ_ESIZE)); - - /* First the flowc ... */ memset(flowc, 0, wr->wr_len); flowc->op_to_nparams = htobe32(V_FW_WR_OP(FW_FLOWC_WR) | V_FW_FLOWC_WR_NPARAMS(nparams)); @@ -397,19 +381,47 @@ send_reset_synqe(struct toedev *tod, struct synq_entry flowc->mnemval[2].val = htobe32(pi->tx_chan); flowc->mnemval[3].mnemonic = FW_FLOWC_MNEM_IQID; flowc->mnemval[3].val = htobe32(ofld_rxq->iq.abs_id); - flowc->mnemval[4].mnemonic = FW_FLOWC_MNEM_SNDBUF; - flowc->mnemval[4].val = htobe32(512); - flowc->mnemval[5].mnemonic = FW_FLOWC_MNEM_MSS; - flowc->mnemval[5].val = htobe32(512); + flowc->mnemval[4].mnemonic = FW_FLOWC_MNEM_SNDBUF; + flowc->mnemval[4].val = htobe32(512); + flowc->mnemval[5].mnemonic = FW_FLOWC_MNEM_MSS; + flowc->mnemval[5].val = htobe32(512); + synqe->flags |= TPF_FLOWC_WR_SENT; + t4_wrq_tx(sc, wr); +} - /* ... then ABORT request */ +static void +send_reset_synqe(struct toedev *tod, struct synq_entry *synqe) +{ + struct adapter *sc = tod->tod_softc; + struct wrqe *wr; + struct cpl_abort_req *req; + + INP_WLOCK_ASSERT(synqe->lctx->inp); + + CTR5(KTR_CXGBE, "%s: synqe %p (0x%x), tid %d%s", + __func__, synqe, synqe->flags, synqe->tid, + synqe->flags & TPF_ABORT_SHUTDOWN ? + " (abort already in progress)" : ""); + if (synqe->flags & TPF_ABORT_SHUTDOWN) + return; /* abort already in progress */ + synqe->flags |= TPF_ABORT_SHUTDOWN; + + if (!(synqe->flags & TPF_FLOWC_WR_SENT)) + send_flowc_wr_synqe(sc, synqe); + + wr = alloc_wrqe(sizeof(*req), &sc->sge.ofld_txq[synqe->params.txq_idx]); + if (wr == NULL) { + /* XXX */ + panic("%s: allocation failure.", __func__); + } + req = wrtod(wr); INIT_TP_WR_MIT_CPL(req, CPL_ABORT_REQ, synqe->tid); req->rsvd0 = 0; /* don't have a snd_nxt */ req->rsvd1 = 1; /* no data sent yet */ req->cmd = CPL_ABORT_SEND_RST; - t4_l2t_send(sc, wr, e); + t4_l2t_send(sc, wr, &sc->l2t->l2tab[synqe->params.l2t_idx]); } static int @@ -891,6 +903,9 @@ do_abort_req_synqe(struct sge_iq *iq, const struct rss INP_WLOCK(inp); ofld_txq = &sc->sge.ofld_txq[synqe->params.txq_idx]; + + if (!(synqe->flags & TPF_FLOWC_WR_SENT)) +
svn commit: r366354 - head/sys/dev/cxgbe
Author: np Date: Fri Oct 2 05:59:55 2020 New Revision: 366354 URL: https://svnweb.freebsd.org/changeset/base/366354 Log: cxgbe(4): validate largest_rx_cluster and safest_rx_cluster. These tunables can only be set to a valid cluster size (2K, 4K, 9K, or 16K) as documented in the man page. Anything else could lead to a panic on interface up. Reported by: mav@ MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Fri Oct 2 01:25:08 2020(r366353) +++ head/sys/dev/cxgbe/t4_sge.c Fri Oct 2 05:59:55 2020(r366354) @@ -542,6 +542,28 @@ t4_sge_modload(void) tscale = 1; } + if (largest_rx_cluster != MCLBYTES && +#if MJUMPAGESIZE != MCLBYTES + largest_rx_cluster != MJUMPAGESIZE && +#endif + largest_rx_cluster != MJUM9BYTES && + largest_rx_cluster != MJUM16BYTES) { + printf("Invalid hw.cxgbe.largest_rx_cluster value (%d)," + " using %d instead.\n", largest_rx_cluster, MJUM16BYTES); + largest_rx_cluster = MJUM16BYTES; + } + + if (safest_rx_cluster != MCLBYTES && +#if MJUMPAGESIZE != MCLBYTES + safest_rx_cluster != MJUMPAGESIZE && +#endif + safest_rx_cluster != MJUM9BYTES && + safest_rx_cluster != MJUM16BYTES) { + printf("Invalid hw.cxgbe.safest_rx_cluster value (%d)," + " using %d instead.\n", safest_rx_cluster, MJUMPAGESIZE); + safest_rx_cluster = MJUMPAGESIZE; + } + extfree_refs = counter_u64_alloc(M_WAITOK); extfree_rels = counter_u64_alloc(M_WAITOK); pullups = counter_u64_alloc(M_WAITOK); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366247 - head/sys/dev/cxgbe
Author: np Date: Tue Sep 29 09:25:52 2020 New Revision: 366247 URL: https://svnweb.freebsd.org/changeset/base/366247 Log: cxgbe(4): Avoid unnecessary work in the firmware during netmap tx. Bind the netmap tx queues to a special '0xff' scheduling class which makes the firmware skip some processing related to rate limiting on the outgoing traffic. Future firmwares will do this automatically. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_netmap.c Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Tue Sep 29 09:11:51 2020 (r366246) +++ head/sys/dev/cxgbe/t4_netmap.c Tue Sep 29 09:25:52 2020 (r366247) @@ -329,6 +329,22 @@ alloc_nm_txq_hwq(struct vi_info *vi, struct sge_nm_txq nm_txq->udb = (volatile void *)udb; } + if (sc->params.fw_vers < FW_VERSION32(1, 25, 1, 0)) { + uint32_t param, val; + + param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DMAQ) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH) | + V_FW_PARAMS_PARAM_YZ(nm_txq->cntxt_id); + val = 0xff; + rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, ¶m, &val); + if (rc != 0) { + device_printf(vi->dev, + "failed to bind netmap txq %d to class 0xff: %d\n", + nm_txq->cntxt_id, rc); + rc = 0; + } + } + return (rc); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366246 - head/sys/dev/cxgbe
Author: np Date: Tue Sep 29 09:11:51 2020 New Revision: 366246 URL: https://svnweb.freebsd.org/changeset/base/366246 Log: Remove duplicate line. Modified: head/sys/dev/cxgbe/t4_netmap.c Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Tue Sep 29 07:51:06 2020 (r366245) +++ head/sys/dev/cxgbe/t4_netmap.c Tue Sep 29 09:11:51 2020 (r366246) @@ -216,9 +216,6 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DMAQ) | V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DMAQ_CONM_CTXT) | V_FW_PARAMS_PARAM_YZ(nm_rxq->iq_cntxt_id); - param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DMAQ) | - V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DMAQ_CONM_CTXT) | - V_FW_PARAMS_PARAM_YZ(nm_rxq->iq_cntxt_id); if (cong == 0) val = 1 << 19; else { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366245 - head/sys/dev/cxgbe
Author: np Date: Tue Sep 29 07:51:06 2020 New Revision: 366245 URL: https://svnweb.freebsd.org/changeset/base/366245 Log: cxgbe(4): adjust the doorbell threshold for netmap freelists to match the maximum burst size used when fetching descriptors from the list. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_netmap.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hTue Sep 29 07:36:21 2020 (r366244) +++ head/sys/dev/cxgbe/adapter.hTue Sep 29 07:51:06 2020 (r366245) @@ -730,6 +730,7 @@ struct sge_nm_rxq { uint32_t fl_sidx2; /* copy of fl_sidx */ uint32_t fl_db_val; u_int fl_db_saved; + u_int fl_db_threshold; /* in descriptors */ u_int fl_hwidx:4; /* Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Tue Sep 29 07:36:21 2020 (r366244) +++ head/sys/dev/cxgbe/t4_netmap.c Tue Sep 29 07:51:06 2020 (r366245) @@ -196,6 +196,9 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq nm_rxq->fl_cntxt_id = be16toh(c.fl0id); nm_rxq->fl_pidx = nm_rxq->fl_cidx = 0; + nm_rxq->fl_db_saved = 0; + /* matches the X_FETCHBURSTMAX_512B or X_FETCHBURSTMAX_256B above. */ + nm_rxq->fl_db_threshold = chip_id(sc) <= CHELSIO_T5 ? 8 : 4; MPASS(nm_rxq->fl_sidx == na->num_rx_desc); cntxt_id = nm_rxq->fl_cntxt_id - sc->sge.eq_start; if (cntxt_id >= sc->sge.neq) { @@ -1063,7 +1066,7 @@ cxgbe_netmap_rxsync(struct netmap_kring *kring, int fl fl_pidx = 0; slot = &ring->slot[0]; } - if (++dbinc == 8 && n >= 32) { + if (++dbinc == nm_rxq->fl_db_threshold) { wmb(); if (starve_fl) nm_rxq->fl_db_saved += dbinc; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366244 - head/sys/dev/cxgbe
Author: np Date: Tue Sep 29 07:36:21 2020 New Revision: 366244 URL: https://svnweb.freebsd.org/changeset/base/366244 Log: cxgbe(4): display an error message when netmap cannot be enabled because the interface is down. MFC after:1 week Modified: head/sys/dev/cxgbe/t4_netmap.c Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Tue Sep 29 05:49:45 2020 (r366243) +++ head/sys/dev/cxgbe/t4_netmap.c Tue Sep 29 07:36:21 2020 (r366244) @@ -536,8 +536,11 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi MPASS(vi->nnmtxq > 0); if ((vi->flags & VI_INIT_DONE) == 0 || - (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + if_printf(ifp, "cannot enable netmap operation because " + "interface is not UP.\n"); return (EAGAIN); + } rxb = &sc->sge.rx_buf_info[0]; for (i = 0; i < SW_ZONE_SIZES; i++, rxb++) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366242 - head/sys/dev/cxgbe
Author: np Date: Tue Sep 29 05:08:45 2020 New Revision: 366242 URL: https://svnweb.freebsd.org/changeset/base/366242 Log: cxgbe(4): fixes for netmap operation with only some queues active. - Only active netmap receive queues should be in the RSS lookup table. - The RSS table should be restored for NIC operation when the last active netmap queue is switched off, not the first one. - Support repeated netmap ON/OFF on a subset of the queues. This works whether the the queues being enabled and disabled are the only ones active or not. Some kring indexes have to be reset in the driver for the second case. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_netmap.c Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Tue Sep 29 02:03:24 2020 (r366241) +++ head/sys/dev/cxgbe/t4_netmap.c Tue Sep 29 05:08:45 2020 (r366242) @@ -347,6 +347,180 @@ free_nm_txq_hwq(struct vi_info *vi, struct sge_nm_txq } static int +cxgbe_netmap_simple_rss(struct adapter *sc, struct vi_info *vi, +struct ifnet *ifp, struct netmap_adapter *na) +{ + struct netmap_kring *kring; + struct sge_nm_rxq *nm_rxq; + int rc, i, j, nm_state, defq; + uint16_t *rss; + + /* +* Check if there's at least one active (or about to go active) netmap +* rx queue. +*/ + defq = -1; + for_each_nm_rxq(vi, j, nm_rxq) { + nm_state = atomic_load_int(&nm_rxq->nm_state); + kring = na->rx_rings[nm_rxq->nid]; + if ((nm_state != NM_OFF && !nm_kring_pending_off(kring)) || + (nm_state == NM_OFF && nm_kring_pending_on(kring))) { + MPASS(nm_rxq->iq_cntxt_id != INVALID_NM_RXQ_CNTXT_ID); + if (defq == -1) { + defq = nm_rxq->iq_abs_id; + break; + } + } + } + + if (defq == -1) { + /* No active netmap queues. Switch back to NIC queues. */ + rss = vi->rss; + defq = vi->rss[0]; + } else { + for (i = 0; i < vi->rss_size;) { + for_each_nm_rxq(vi, j, nm_rxq) { + nm_state = atomic_load_int(&nm_rxq->nm_state); + kring = na->rx_rings[nm_rxq->nid]; + if ((nm_state != NM_OFF && + !nm_kring_pending_off(kring)) || + (nm_state == NM_OFF && + nm_kring_pending_on(kring))) { + MPASS(nm_rxq->iq_cntxt_id != + INVALID_NM_RXQ_CNTXT_ID); + vi->nm_rss[i++] = nm_rxq->iq_abs_id; + if (i == vi->rss_size) + break; + } + } + } + rss = vi->nm_rss; + } + + rc = -t4_config_rss_range(sc, sc->mbox, vi->viid, 0, vi->rss_size, rss, + vi->rss_size); + if (rc != 0) + if_printf(ifp, "netmap rss_config failed: %d\n", rc); + + rc = -t4_config_vi_rss(sc, sc->mbox, vi->viid, vi->hashen, defq, 0, 0); + if (rc != 0) { + if_printf(ifp, "netmap defaultq config failed: %d\n", rc); + } + + return (rc); +} + +/* + * Odd number of rx queues work best for split RSS mode as the first queue can + * be dedicated for non-RSS traffic and the rest divided into two equal halves. + */ +static int +cxgbe_netmap_split_rss(struct adapter *sc, struct vi_info *vi, +struct ifnet *ifp, struct netmap_adapter *na) +{ + struct netmap_kring *kring; + struct sge_nm_rxq *nm_rxq; + int rc, i, j, nm_state, defq; + int nactive[2] = {0, 0}; + int dq[2] = {-1, -1}; + bool dq_norss; /* default queue should not be in RSS table. */ + + MPASS(nm_split_rss != 0); + MPASS(vi->nnmrxq > 1); + + for_each_nm_rxq(vi, i, nm_rxq) { + j = i / ((vi->nnmrxq + 1) / 2); + nm_state = atomic_load_int(&nm_rxq->nm_state); + kring = na->rx_rings[nm_rxq->nid]; + if ((nm_state != NM_OFF && !nm_kring_pending_off(kring)) || + (nm_state == NM_OFF && nm_kring_pending_on(kring))) { + MPASS(nm_rxq->iq_cntxt_id != INVALID_NM_RXQ_CNTXT_ID); + nactive[j]++; + if (dq[j] == -1) { + dq[j] = nm_rxq->iq_abs_id; + break; + } + } + } + + if (nactive[0] == 0 || nactive[
svn commit: r365993 - in head: share/man/man4 sys/dev/cxgbe
Author: np Date: Tue Sep 22 04:16:40 2020 New Revision: 365993 URL: https://svnweb.freebsd.org/changeset/base/365993 Log: cxgbe(4): let the PF driver use VM work requests for transmit. This allows the PF interfaces to communicate with the VF interfaces over the internal switch in the ASIC. Fix the GL limits for VM work requests while here. MFC after:3 days Sponsored by: Chelsio Communications Modified: head/share/man/man4/cxgbe.4 head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c Modified: head/share/man/man4/cxgbe.4 == --- head/share/man/man4/cxgbe.4 Tue Sep 22 03:57:48 2020(r365992) +++ head/share/man/man4/cxgbe.4 Tue Sep 22 04:16:40 2020(r365993) @@ -351,6 +351,17 @@ This tunable is for specialized applications only and normal operation. The capabilities for which hardware resources have been reserved are listed in dev..X.*caps sysctls. +.It Va hw.cxgbe.tx_vm_wr +Setting this to 1 instructs the driver to use VM work requests to transmit data. +This lets PF interfaces transmit frames to VF interfaces over the internal +switch in the ASIC. +Note that the +.Xr cxgbev 4 +VF driver always uses VM work requests and is not affected by this tunable. +The default value is 0 and should be changed only if PF and VF interfaces need +to communicate with each other. +Different interfaces can be assigned different values using the +dev..X.tx_vm_wr sysctl when the interface is administratively down. .El .Sh SUPPORT For general information and support, Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hTue Sep 22 03:57:48 2020 (r365992) +++ head/sys/dev/cxgbe/adapter.hTue Sep 22 04:16:40 2020 (r365993) @@ -118,6 +118,8 @@ enum { SGE_MAX_WR_NDESC = SGE_MAX_WR_LEN / EQ_ESIZE, /* max WR size in desc */ TX_SGL_SEGS = 39, TX_SGL_SEGS_TSO = 38, + TX_SGL_SEGS_VM = 38, + TX_SGL_SEGS_VM_TSO = 37, TX_SGL_SEGS_EO_TSO = 30,/* XXX: lower for IPv6. */ TX_SGL_SEGS_VXLAN_TSO = 37, TX_WR_FLITS = SGE_MAX_WR_LEN / 8 @@ -173,6 +175,7 @@ enum { DOOMED = (1 << 0), VI_INIT_DONE= (1 << 1), VI_SYSCTL_CTX = (1 << 2), + TX_USES_VM_WR = (1 << 3), /* adapter debug_flags */ DF_DUMP_MBOX= (1 << 0), /* Log all mbox cmd/rpl. */ @@ -1267,7 +1270,7 @@ void t4_intr_evt(void *); void t4_wrq_tx_locked(struct adapter *, struct sge_wrq *, struct wrqe *); void t4_update_fl_bufsize(struct ifnet *); struct mbuf *alloc_wr_mbuf(int, int); -int parse_pkt(struct adapter *, struct mbuf **); +int parse_pkt(struct mbuf **, bool); void *start_wrq_wr(struct sge_wrq *, int, struct wrq_cookie *); void commit_wrq_wr(struct sge_wrq *, void *, struct wrq_cookie *); int tnl_cong(struct port_info *, int); Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cTue Sep 22 03:57:48 2020 (r365992) +++ head/sys/dev/cxgbe/t4_main.cTue Sep 22 04:16:40 2020 (r365993) @@ -591,6 +591,10 @@ static int t4_panic_on_fatal_err = 0; SYSCTL_INT(_hw_cxgbe, OID_AUTO, panic_on_fatal_err, CTLFLAG_RDTUN, &t4_panic_on_fatal_err, 0, "panic on fatal errors"); +static int t4_tx_vm_wr = 0; +SYSCTL_INT(_hw_cxgbe, OID_AUTO, tx_vm_wr, CTLFLAG_RWTUN, &t4_tx_vm_wr, 0, +"Use VM work requests to transmit packets."); + #ifdef TCP_OFFLOAD /* * TOE tunables. @@ -695,6 +699,7 @@ static int sysctl_bitfield_8b(SYSCTL_HANDLER_ARGS); static int sysctl_bitfield_16b(SYSCTL_HANDLER_ARGS); static int sysctl_btphy(SYSCTL_HANDLER_ARGS); static int sysctl_noflowq(SYSCTL_HANDLER_ARGS); +static int sysctl_tx_vm_wr(SYSCTL_HANDLER_ARGS); static int sysctl_holdoff_tmr_idx(SYSCTL_HANDLER_ARGS); static int sysctl_holdoff_pktc_idx(SYSCTL_HANDLER_ARGS); static int sysctl_qsize_rxq(SYSCTL_HANDLER_ARGS); @@ -1723,6 +1728,8 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi) vi->xact_addr_filt = -1; callout_init(&vi->tick, 1); + if (sc->flags & IS_VF || t4_tx_vm_wr != 0) + vi->flags |= TX_USES_VM_WR; /* Allocate an ifnet and set it up */ ifp = if_alloc_dev(IFT_ETHER, dev); @@ -1775,7 +1782,10 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi) #endif ifp->if_hw_tsomax = IP_MAXPACKET; - ifp->if_hw_tsomaxsegcount = TX_SGL_SEGS_TSO; + if (vi->flags & TX_USES_VM_WR) + ifp->if_hw_tsomaxsegcount = TX_SGL_SEGS_VM_TSO; + else + ifp->if_hw_tsomaxsegcount = TX_SGL_SEGS_TSO; #ifdef RATELIMIT if (is_ethoffload(sc) && vi->nofldtxq != 0) ifp->if_hw_tsomaxsegcount = TX_SGL_SEGS_EO_TSO; @@ -2174,7 +2184,7 @@ cxgbe_transmi
svn commit: r365991 - head/sys/dev/cxgbe
Author: np Date: Tue Sep 22 03:06:36 2020 New Revision: 365991 URL: https://svnweb.freebsd.org/changeset/base/365991 Log: cxgbe(4): add counters for mbuf pullups and defrags. MFC after:3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Tue Sep 22 02:22:37 2020(r365990) +++ head/sys/dev/cxgbe/t4_sge.c Tue Sep 22 03:06:36 2020(r365991) @@ -204,6 +204,15 @@ static int lro_mbufs = 0; SYSCTL_INT(_hw_cxgbe, OID_AUTO, lro_mbufs, CTLFLAG_RDTUN, &lro_mbufs, 0, "Enable presorting of LRO frames"); +static counter_u64_t pullups; +SYSCTL_COUNTER_U64(_hw_cxgbe, OID_AUTO, pullups, CTLFLAG_RD, &pullups, +"Number of mbuf pullups performed"); + +static counter_u64_t defrags; +SYSCTL_COUNTER_U64(_hw_cxgbe, OID_AUTO, defrags, CTLFLAG_RD, &defrags, +"Number of mbuf defrags performed"); + + static int service_iq(struct sge_iq *, int); static int service_iq_fl(struct sge_iq *, int); static struct mbuf *get_fl_payload(struct adapter *, struct sge_fl *, uint32_t); @@ -535,8 +544,12 @@ t4_sge_modload(void) extfree_refs = counter_u64_alloc(M_WAITOK); extfree_rels = counter_u64_alloc(M_WAITOK); + pullups = counter_u64_alloc(M_WAITOK); + defrags = counter_u64_alloc(M_WAITOK); counter_u64_zero(extfree_refs); counter_u64_zero(extfree_rels); + counter_u64_zero(pullups); + counter_u64_zero(defrags); t4_init_shared_cpl_handlers(); t4_register_cpl_handler(CPL_FW4_MSG, handle_fw_msg); @@ -556,6 +569,8 @@ t4_sge_modunload(void) counter_u64_free(extfree_refs); counter_u64_free(extfree_rels); + counter_u64_free(pullups); + counter_u64_free(defrags); } uint64_t @@ -2714,16 +2729,22 @@ restart: } #endif if (nsegs > max_nsegs_allowed(m0)) { - if (defragged++ > 0 || (m = m_defrag(m0, M_NOWAIT)) == NULL) { + if (defragged++ > 0) { rc = EFBIG; goto fail; } + counter_u64_add(defrags, 1); + if ((m = m_defrag(m0, M_NOWAIT)) == NULL) { + rc = ENOMEM; + goto fail; + } *mp = m0 = m; /* update caller's copy after defrag */ goto restart; } if (__predict_false(nsegs > 2 && m0->m_pkthdr.len <= MHLEN && !(cflags & MC_NOMAP))) { + counter_u64_add(pullups, 1); m0 = m_pullup(m0, m0->m_pkthdr.len); if (m0 == NULL) { /* Should have left well enough alone. */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r365872 - head/sys/dev/cxgbe/firmware
Author: np Date: Fri Sep 18 03:11:47 2020 New Revision: 365872 URL: https://svnweb.freebsd.org/changeset/base/365872 Log: cxgbe(4): add the firmware binaries instead of the empty files that were added in r365861. Obtained from:Chelsio Communications MFC after:3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/firmware/t4fw-1.25.0.0.bin (contents, props changed) head/sys/dev/cxgbe/firmware/t5fw-1.25.0.0.bin (contents, props changed) head/sys/dev/cxgbe/firmware/t6fw-1.25.0.0.bin (contents, props changed) Modified: head/sys/dev/cxgbe/firmware/t4fw-1.25.0.0.bin == Binary file (source and/or target). No diff available. Modified: head/sys/dev/cxgbe/firmware/t5fw-1.25.0.0.bin == Binary file (source and/or target). No diff available. Modified: head/sys/dev/cxgbe/firmware/t6fw-1.25.0.0.bin == Binary file (source and/or target). No diff available. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r365871 - in head: share/man/man4 sys/dev/cxgbe sys/dev/cxgbe/common sys/dev/cxgbe/firmware
Author: np Date: Fri Sep 18 03:01:47 2020 New Revision: 365871 URL: https://svnweb.freebsd.org/changeset/base/365871 Log: cxgbe(4): add support for stateless offloads for VXLAN traffic. Hardware assistance includes checksumming (tx and rx), TSO, and RSS on the inner traffic in a VXLAN tunnel. Relnotes: Yes Sponsored by: Chelsio Communications Modified: head/share/man/man4/cxgbe.4 head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/firmware/t6fw_cfg.txt head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c Modified: head/share/man/man4/cxgbe.4 == --- head/share/man/man4/cxgbe.4 Fri Sep 18 02:37:57 2020(r365870) +++ head/share/man/man4/cxgbe.4 Fri Sep 18 03:01:47 2020(r365871) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Dec 10, 2019 +.Dd September 17, 2020 .Dt CXGBE 4 .Os .Sh NAME @@ -61,8 +61,8 @@ driver provides support for PCI Express Ethernet adapt the Chelsio Terminator 4, Terminator 5, and Terminator 6 ASICs (T4, T5, and T6). The driver supports Jumbo Frames, Transmit/Receive checksum offload, TCP segmentation offload (TSO), Large Receive Offload (LRO), VLAN -tag insertion/extraction, VLAN checksum offload, VLAN TSO, and -Receive Side Steering (RSS). +tag insertion/extraction, VLAN checksum offload, VLAN TSO, VXLAN checksum +offload, VXLAN TSO, and Receive Side Steering (RSS). For further hardware information and questions related to hardware requirements, see .Pa http://www.chelsio.com/ . Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hFri Sep 18 02:37:57 2020 (r365870) +++ head/sys/dev/cxgbe/adapter.hFri Sep 18 03:01:47 2020 (r365871) @@ -119,6 +119,7 @@ enum { TX_SGL_SEGS = 39, TX_SGL_SEGS_TSO = 38, TX_SGL_SEGS_EO_TSO = 30,/* XXX: lower for IPv6. */ + TX_SGL_SEGS_VXLAN_TSO = 37, TX_WR_FLITS = SGE_MAX_WR_LEN / 8 }; @@ -286,6 +287,7 @@ struct port_info { int nvi; int up_vis; int uld_vis; + bool vxlan_tcam_entry; struct tx_sched_params *sched_params; @@ -593,6 +595,8 @@ struct sge_txq { uint64_t txpkts0_pkts; /* # of frames in type0 coalesced tx WRs */ uint64_t txpkts1_pkts; /* # of frames in type1 coalesced tx WRs */ uint64_t raw_wrs; /* # of raw work requests (alloc_wr_mbuf) */ + uint64_t vxlan_tso_wrs; /* # of VXLAN TSO work requests */ + uint64_t vxlan_txcsum; uint64_t kern_tls_records; uint64_t kern_tls_short; @@ -625,6 +629,7 @@ struct sge_rxq { uint64_t rxcsum;/* # of times hardware assisted with checksum */ uint64_t vlan_extraction;/* # of times VLAN tag was extracted */ + uint64_t vxlan_rxcsum; /* stats for not-that-common events */ @@ -847,6 +852,11 @@ struct adapter { struct sge sge; int lro_timeout; int sc_do_rxcopy; + + int vxlan_port; + u_int vxlan_refcount; + int rawf_base; + int nrawf; struct taskqueue *tq[MAX_NCHAN];/* General purpose taskqueues */ struct task async_event_task; Modified: head/sys/dev/cxgbe/common/common.h == --- head/sys/dev/cxgbe/common/common.h Fri Sep 18 02:37:57 2020 (r365870) +++ head/sys/dev/cxgbe/common/common.h Fri Sep 18 03:01:47 2020 (r365871) @@ -249,7 +249,7 @@ struct tp_params { uint32_t max_rx_pdu; uint32_t max_tx_pdu; uint64_t hash_filter_mask; - __be16 err_vec_mask; + bool rx_pkt_encap; int8_t fcoe_shift; int8_t port_shift; Modified: head/sys/dev/cxgbe/common/t4_hw.c == --- head/sys/dev/cxgbe/common/t4_hw.c Fri Sep 18 02:37:57 2020 (r365870) +++ head/sys/dev/cxgbe/common/t4_hw.c Fri Sep 18 03:01:47 2020 (r365871) @@ -9647,19 +9647,11 @@ int t4_init_tp_params(struct adapter *adap, bool sleep read_filter_mode_and_ingress_config(adap, sleep_ok); - /* -* Cache a mask of the bits that represent the error vector portion of -* rx_pkt.err_vec. T6+ can use a compressed error vector to make room -* for information about outer encapsulation (GENEVE/VXLAN/NVGRE). -*/ - tpp->err_vec_mask = htobe16(0x); if (chip_id(adap) > CHELSIO_T5) { v = t4_read_reg(adap, A_TP_OUT_CONFIG); - if (v & F_CRXPKTENC) { - tpp->err_vec_mask = - htobe16(V_T6_COMPR_RXERR_VEC(M_T6_COMPR_RXERR_VEC)); - } - } + tpp->rx_pkt_encap = v & F_CRXPKTENC; + } else +
svn commit: r365870 - in head: share/man/man4 share/man/man9 sys/net sys/netinet sys/netinet6
Author: np Date: Fri Sep 18 02:37:57 2020 New Revision: 365870 URL: https://svnweb.freebsd.org/changeset/base/365870 Log: if_vxlan(4): add support for hardware assisted checksumming, TSO, and RSS. This lets a VXLAN pseudo-interface take advantage of hardware checksumming (tx and rx), TSO, and RSS if the NIC is capable of performing these operations on inner VXLAN traffic. A VXLAN interface inherits the capabilities of its vxlandev interface if one is specified or of the interface that hosts the vxlanlocal address. If other interfaces will carry traffic for that VXLAN then they must have the same hardware capabilities. On transmit, if_vxlan verifies that the outbound interface has the required capabilities and then translates the CSUM_ flags to their inner equivalents. This tells the hardware ifnet that it needs to operate on the inner frame and not the outer VXLAN headers. An event is generated when a VXLAN ifnet starts. This allows hardware drivers to configure their devices to expect VXLAN traffic on the specified incoming port. On receive, the hardware does RSS and checksum verification on the inner frame. if_vxlan now does a direct netisr dispatch to take full advantage of RSS. It is not very clear why it didn't do this already. Future work: Rx: it should be possible to avoid the first trip up the protocol stack to get the frame to if_vxlan just so it can decapsulate and requeue for a second trip up the stack. The hardware NIC driver could directly call an if_vxlan receive routine for VXLAN traffic instead. Rx: LRO. depends on what happens with the previous item. There will have to to be a mechanism to indicate that it's time for if_vxlan to flush its LRO state. Reviewed by: kib@ Relnotes: Yes Sponsored by: Chelsio Communications Differential Revision:https://reviews.freebsd.org/D25873 Modified: head/share/man/man4/vxlan.4 head/share/man/man9/EVENTHANDLER.9 head/sys/net/if_vxlan.c head/sys/net/if_vxlan.h head/sys/netinet/ip_output.c head/sys/netinet6/ip6_output.c Modified: head/share/man/man4/vxlan.4 == --- head/share/man/man4/vxlan.4 Fri Sep 18 02:21:15 2020(r365869) +++ head/share/man/man4/vxlan.4 Fri Sep 18 02:37:57 2020(r365870) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 31, 2017 +.Dd September 17, 2020 .Dt VXLAN 4 .Os .Sh NAME @@ -182,6 +182,39 @@ command may be used to reduce the MTU size on the .Nm interface to allow the encapsulated frame to fit in the current MTU of the physical network. +.Sh HARDWARE +The +.Nm +driver supports hardware checksum offload (receive and transmit) and TSO on the +encapsulated traffic over physical interfaces that support these features. +The +.Nm +interface examines the +.Cm vxlandev +interface, if one is specified, or the interface hosting the +.Cm vxlanlocal +address, and configures its capabilities based on the hardware offload +capabilities of that physical interface. +If multiple physical interfaces will transmit or receive traffic for the +.Nm +then they all must have the same hardware capabilities. +The transmit routine of a +.Nm +interface may fail with +.Er ENXIO +if an outbound physical interface does not support +an offload that the +.Nm +interface is requesting. +This can happen if there are multiple physical interfaces involved, with +different hardware capabilities, or an interface capability was disabled after +the +.Nm +interface had already started. +.Pp +At present, these devices are capable of generating checksums and performing TSO +on the inner frames in hardware: +.Xr cxgbe 4 . .Sh EXAMPLES Create a .Nm @@ -244,3 +277,7 @@ The .Nm driver was written by .An Bryan Venteicher Aq bry...@freebsd.org . +Support for stateless hardware offloads was added by +.An Navdeep Parhar Aq n...@freebsd.org +in +.Fx 13.0 . Modified: head/share/man/man9/EVENTHANDLER.9 == --- head/share/man/man9/EVENTHANDLER.9 Fri Sep 18 02:21:15 2020 (r365869) +++ head/share/man/man9/EVENTHANDLER.9 Fri Sep 18 02:37:57 2020 (r365870) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" $FreeBSD$ .\" -.Dd October 21, 2018 +.Dd September 17, 2020 .Dt EVENTHANDLER 9 .Os .Sh NAME @@ -389,6 +389,10 @@ Callback invoked when the vlan configuration has chang Callback invoked when a vlan is destroyed. .It Vt vm_lowmem Callbacks invoked when virtual memory is low. +.It Vt vxlan_start +Callback invoked when a vxlan interface starts. +.It Vt vxlan_stop +Callback invoked when a vxlan interface stops. .It Vt watchdog_list Callbacks invoked when the system watchdog timer is reinitialized. .El Modified: head/sys/net/if_vxlan.c == --- head/sys/net/if_vxlan.c
svn commit: r365869 - in head/sys: netinet netinet6
Author: np Date: Fri Sep 18 02:21:15 2020 New Revision: 365869 URL: https://svnweb.freebsd.org/changeset/base/365869 Log: Add a knob to allow zero UDP checksums for UDP/IPv6 traffic on the given UDP port. This will be used by some upcoming changes to if_vxlan(4). RFC 7348 (VXLAN) says that the UDP checksum "SHOULD be transmitted as zero. When a packet is received with a UDP checksum of zero, it MUST be accepted for decapsulation." But the original IPv6 RFCs did not allow zero UDP checksum. RFC 6935 attempts to resolve this. Reviewed by: kib@ Sponsored by: Chelsio Communications Differential Revision:https://reviews.freebsd.org/D25873 Modified: head/sys/netinet/udp_var.h head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet/udp_var.h == --- head/sys/netinet/udp_var.h Fri Sep 18 02:10:28 2020(r365868) +++ head/sys/netinet/udp_var.h Fri Sep 18 02:21:15 2020(r365869) @@ -154,6 +154,9 @@ VNET_DECLARE(int, udp_log_in_vain); #defineV_udp_blackhole VNET(udp_blackhole) #defineV_udp_log_in_vain VNET(udp_log_in_vain) +VNET_DECLARE(int, zero_checksum_port); +#defineV_zero_checksum_portVNET(zero_checksum_port) + static __inline struct inpcbinfo * udp_get_inpcbinfo(int protocol) { Modified: head/sys/netinet6/udp6_usrreq.c == --- head/sys/netinet6/udp6_usrreq.c Fri Sep 18 02:10:28 2020 (r365868) +++ head/sys/netinet6/udp6_usrreq.c Fri Sep 18 02:21:15 2020 (r365869) @@ -124,6 +124,11 @@ __FBSDID("$FreeBSD$"); #include +VNET_DEFINE(int, zero_checksum_port) = 0; +#defineV_zero_checksum_portVNET(zero_checksum_port) +SYSCTL_INT(_net_inet6_udp6, OID_AUTO, rfc6935_port, CTLFLAG_VNET | CTLFLAG_RW, +&VNET_NAME(zero_checksum_port), 0, +"Zero UDP checksum allowed for traffic to/from this port."); /* * UDP protocol implementation. * Per RFC 768, August, 1980. @@ -267,7 +272,14 @@ udp6_input(struct mbuf **mp, int *offp, int proto) } if (uh->uh_sum == 0) { UDPSTAT_INC(udps_nosum); - goto badunlocked; + /* +* dport 0 was rejected earlier so this is OK even if +* zero_checksum_port is 0 (which is its default value). +*/ + if (ntohs(uh->uh_dport) == V_zero_checksum_port) + goto skip_checksum; + else + goto badunlocked; } } @@ -287,6 +299,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) goto badunlocked; } +skip_checksum: /* * Construct sockaddr format source address. */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r365868 - in head: sbin/ifconfig sys/net
Author: np Date: Fri Sep 18 02:10:28 2020 New Revision: 365868 URL: https://svnweb.freebsd.org/changeset/base/365868 Log: Add two new ifnet capabilities for hw checksumming and TSO for VXLAN traffic. These are similar to the existing VLAN capabilities. Reviewed by: kib@ Sponsored by: Chelsio Communications Differential Revision:https://reviews.freebsd.org/D25873 Modified: head/sbin/ifconfig/ifconfig.8 head/sbin/ifconfig/ifconfig.c head/sbin/ifconfig/ifvxlan.c head/sys/net/if.h Modified: head/sbin/ifconfig/ifconfig.8 == --- head/sbin/ifconfig/ifconfig.8 Fri Sep 18 01:38:47 2020 (r365867) +++ head/sbin/ifconfig/ifconfig.8 Fri Sep 18 02:10:28 2020 (r365868) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd June 4, 2020 +.Dd September 17, 2020 .Dt IFCONFIG 8 .Os .Sh NAME @@ -587,7 +587,7 @@ If the driver offers user-configurable VLAN support, e reception of extended frames, tag processing in hardware, frame filtering in hardware, checksum offloading, or TSO on VLAN, respectively. -Note that this must be issued on a physical interface associated with +Note that this must be configured on a physical interface associated with .Xr vlan 4 , not on a .Xr vlan 4 @@ -597,6 +597,21 @@ If the driver offers user-configurable VLAN support, d reception of extended frames, tag processing in hardware, frame filtering in hardware, or TSO on VLAN, respectively. +.It Cm vxlanhwcsum , vxlanhwtso +If the driver offers user-configurable VXLAN support, enable inner checksum +offloading (receive and transmit) or TSO on VXLAN, respectively. +Note that this must be configured on a physical interface associated with +.Xr vxlan 4 , +not on a +.Xr vxlan 4 +interface itself. +The physical interface is either the interface specified as the vxlandev +or the interface hosting the vxlanlocal address. +The driver will offload as much checksum work and TSO as it can reliably +support, the exact level of offloading may vary between drivers. +.It Fl vxlanhwcsum , vxlanhwtso +If the driver offers user-configurable VXLAN support, disable checksum +offloading (receive and transmit) or TSO on VXLAN, respectively. .It Cm vnet Ar jail Move the interface to the .Xr jail 8 , Modified: head/sbin/ifconfig/ifconfig.c == --- head/sbin/ifconfig/ifconfig.c Fri Sep 18 01:38:47 2020 (r365867) +++ head/sbin/ifconfig/ifconfig.c Fri Sep 18 02:10:28 2020 (r365868) @@ -1344,7 +1344,8 @@ unsetifdescr(const char *val, int value, int s, const "\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \ "\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \ "\17TOE4\20TOE6\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE\25NETMAP" \ -"\26RXCSUM_IPV6\27TXCSUM_IPV6\31TXRTLMT\32HWRXTSTMP\33NOMAP\34TXTLS4\35TXTLS6" +"\26RXCSUM_IPV6\27TXCSUM_IPV6\31TXRTLMT\32HWRXTSTMP\33NOMAP\34TXTLS4\35TXTLS6" \ +"\36VXLAN_HWCSUM\37VXLAN_HWTSO" /* * Print the status of the interface. If an address family was Modified: head/sbin/ifconfig/ifvxlan.c == --- head/sbin/ifconfig/ifvxlan.cFri Sep 18 01:38:47 2020 (r365867) +++ head/sbin/ifconfig/ifvxlan.cFri Sep 18 02:10:28 2020 (r365868) @@ -620,6 +620,11 @@ static struct cmd vxlan_cmds[] = { DEF_CMD("vxlanflush", 0,setvxlan_flush), DEF_CMD("vxlanflushall", 1, setvxlan_flush), + + DEF_CMD("vxlanhwcsum", IFCAP_VXLAN_HWCSUM, setifcap), + DEF_CMD("-vxlanhwcsum", -IFCAP_VXLAN_HWCSUM,setifcap), + DEF_CMD("vxlanhwtso", IFCAP_VXLAN_HWTSO, setifcap), + DEF_CMD("-vxlanhwtso", -IFCAP_VXLAN_HWTSO, setifcap), }; static struct afswtch af_vxlan = { Modified: head/sys/net/if.h == --- head/sys/net/if.h Fri Sep 18 01:38:47 2020(r365867) +++ head/sys/net/if.h Fri Sep 18 02:10:28 2020(r365868) @@ -248,6 +248,8 @@ struct if_data { #defineIFCAP_NOMAP 0x400 /* can TX unmapped mbufs */ #defineIFCAP_TXTLS40x800 /* can do TLS encryption and segmentation for TCP */ #defineIFCAP_TXTLS60x1000 /* can do TLS encryption and segmentation for TCP6 */ +#defineIFCAP_VXLAN_HWCSUM 0x2000 /* can do IFCAN_HWCSUM on VXLANs */ +#defineIFCAP_VXLAN_HWTSO 0x4000 /* can do IFCAP_TSO on VXLANs */ #define IFCAP_HWCSUM_IPV6 (IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "
svn commit: r365867 - head/sys/sys
Author: np Date: Fri Sep 18 01:38:47 2020 New Revision: 365867 URL: https://svnweb.freebsd.org/changeset/base/365867 Log: mbuf checksum flags and fields to support tunneling protocols. These are being added to support VXLAN but will work for GENEVE as well. ENCAP_RSVD1 will likely become ENCAP_GENEVE in the future. The size of struct mbuf does not change and that means this change can be MFC'd. If size wasn't a constraint a cleaner way may have been to add inner_csum_flags and inner_csum_data to go with csum_flags and csum_data. Reviewed by: kib@ Sponsored by: Chelsio Communications Differential Revision:https://reviews.freebsd.org/D25873 Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h == --- head/sys/sys/mbuf.h Fri Sep 18 01:11:11 2020(r365866) +++ head/sys/sys/mbuf.h Fri Sep 18 01:38:47 2020(r365867) @@ -171,7 +171,10 @@ struct pkthdr { uint8_t l3hlen;/* layer 3 hdr len */ uint8_t l4hlen;/* layer 4 hdr len */ uint8_t l5hlen;/* layer 5 hdr len */ - uint32_t spare; + uint8_t inner_l2hlen; + uint8_t inner_l3hlen; + uint8_t inner_l4hlen; + uint8_t inner_l5hlen; }; }; union { @@ -616,7 +619,13 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgof * Outbound flags that are set by upper protocol layers requesting lower * layers, or ideally the hardware, to perform these offloading tasks. * For outbound packets this field and its flags can be directly tested - * against ifnet if_hwassist. + * against ifnet if_hwassist. Note that the outbound and the inbound flags do + * not collide right now but they could be allowed to (as long as the flags are + * scrubbed appropriately when the direction of an mbuf changes). CSUM_BITS + * would also have to split into CSUM_BITS_TX and CSUM_BITS_RX. + * + * CSUM_INNER_ is the same as CSUM_ but it applies to the inner frame. + * The CSUM_ENCAP_ bits identify the outer encapsulation. */ #defineCSUM_IP 0x0001 /* IP header checksum offload */ #defineCSUM_IP_UDP 0x0002 /* UDP checksum offload */ @@ -625,13 +634,28 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgof #defineCSUM_IP_TSO 0x0010 /* TCP segmentation offload */ #defineCSUM_IP_ISCSI 0x0020 /* iSCSI checksum offload */ +#defineCSUM_INNER_IP6_UDP 0x0040 +#defineCSUM_INNER_IP6_TCP 0x0080 +#defineCSUM_INNER_IP6_TSO 0x0100 #defineCSUM_IP6_UDP0x0200 /* UDP checksum offload */ #defineCSUM_IP6_TCP0x0400 /* TCP checksum offload */ #defineCSUM_IP6_SCTP 0x0800 /* SCTP checksum offload */ #defineCSUM_IP6_TSO0x1000 /* TCP segmentation offload */ #defineCSUM_IP6_ISCSI 0x2000 /* iSCSI checksum offload */ +#defineCSUM_INNER_IP 0x4000 +#defineCSUM_INNER_IP_UDP 0x8000 +#defineCSUM_INNER_IP_TCP 0x0001 +#defineCSUM_INNER_IP_TSO 0x0002 + +#defineCSUM_ENCAP_VXLAN0x0004 /* VXLAN outer encapsulation */ +#defineCSUM_ENCAP_RSVD10x0008 + /* Inbound checksum support where the checksum was verified by hardware. */ +#defineCSUM_INNER_L3_CALC 0x0010 +#defineCSUM_INNER_L3_VALID 0x0020 +#defineCSUM_INNER_L4_CALC 0x0040 +#defineCSUM_INNER_L4_VALID 0x0080 #defineCSUM_L3_CALC0x0100 /* calculated layer 3 csum */ #defineCSUM_L3_VALID 0x0200 /* checksum is correct */ #defineCSUM_L4_CALC0x0400 /* calculated layer 4 csum */ @@ -642,16 +666,31 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgof #defineCSUM_SND_TAG0x8000 /* Packet header has send tag */ +#define CSUM_FLAGS_TX (CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP | CSUM_IP_SCTP | \ +CSUM_IP_TSO | CSUM_IP_ISCSI | CSUM_INNER_IP6_UDP | CSUM_INNER_IP6_TCP | \ +CSUM_INNER_IP6_TSO | CSUM_IP6_UDP | CSUM_IP6_TCP | CSUM_IP6_SCTP | \ +CSUM_IP6_TSO | CSUM_IP6_ISCSI | CSUM_INNER_IP | CSUM_INNER_IP_UDP | \ +CSUM_INNER_IP_TCP | CSUM_INNER_IP_TSO | CSUM_ENCAP_VXLAN | \ +CSUM_ENCAP_RSVD1 | CSUM_SND_TAG) + +#define CSUM_FLAGS_RX (CSUM_INNER_L3_CALC | CSUM_INNER_L3_VALID | \ +CSUM_INNER_L4_CALC | CSUM_INNER_L4_VALID | CSUM_L3_CALC | CSUM_L3_VALID | \ +CSUM_L4_CALC | CSUM_L4_VALID | CSUM_L5_CALC | CSU
svn commit: r365861 - in head/sys: conf dev/cxgbe/firmware modules/cxgbe/t4_firmware modules/cxgbe/t5_firmware modules/cxgbe/t6_firmware
Author: np Date: Thu Sep 17 22:14:11 2020 New Revision: 365861 URL: https://svnweb.freebsd.org/changeset/base/365861 Log: cxgbe(4): Update T4/5/6 firmwares to 1.25.0.0. Obtained from:Chelsio Communications MFC after:3 days Sponsored by: Chelsio Communications Added: head/sys/dev/cxgbe/firmware/t4fw-1.25.0.0.bin (contents, props changed) head/sys/dev/cxgbe/firmware/t5fw-1.25.0.0.bin (contents, props changed) head/sys/dev/cxgbe/firmware/t6fw-1.25.0.0.bin (contents, props changed) Deleted: head/sys/dev/cxgbe/firmware/t4fw-1.24.12.0.bin head/sys/dev/cxgbe/firmware/t5fw-1.24.12.0.bin head/sys/dev/cxgbe/firmware/t6fw-1.24.12.0.bin Modified: head/sys/conf/files head/sys/dev/cxgbe/firmware/t4fw_interface.h head/sys/dev/cxgbe/firmware/t6fw_cfg.txt head/sys/dev/cxgbe/firmware/t6fw_cfg_uwire.txt head/sys/modules/cxgbe/t4_firmware/Makefile head/sys/modules/cxgbe/t5_firmware/Makefile head/sys/modules/cxgbe/t6_firmware/Makefile Modified: head/sys/conf/files == --- head/sys/conf/files Thu Sep 17 21:51:05 2020(r365860) +++ head/sys/conf/files Thu Sep 17 22:14:11 2020(r365861) @@ -1514,7 +1514,7 @@ t4fw.fwo optional cxgbe \ no-implicit-rule\ clean "t4fw.fwo" t4fw.fwoptional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t4fw-1.24.12.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t4fw-1.25.0.0.bin" \ compile-with"${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t4fw.fw" @@ -1548,7 +1548,7 @@ t5fw.fwo optional cxgbe \ no-implicit-rule\ clean "t5fw.fwo" t5fw.fwoptional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t5fw-1.24.12.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t5fw-1.25.0.0.bin" \ compile-with"${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t5fw.fw" @@ -1582,7 +1582,7 @@ t6fw.fwo optional cxgbe \ no-implicit-rule\ clean "t6fw.fwo" t6fw.fwoptional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t6fw-1.24.12.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t6fw-1.25.0.0.bin" \ compile-with"${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t6fw.fw" Added: head/sys/dev/cxgbe/firmware/t4fw-1.25.0.0.bin == Modified: head/sys/dev/cxgbe/firmware/t4fw_interface.h == --- head/sys/dev/cxgbe/firmware/t4fw_interface.hThu Sep 17 21:51:05 2020(r365860) +++ head/sys/dev/cxgbe/firmware/t4fw_interface.hThu Sep 17 22:14:11 2020(r365861) @@ -4690,6 +4690,7 @@ enum fw_caps_config_crypto { FW_CAPS_CONFIG_CRYPTO_LOOKASIDE = 0x0001, FW_CAPS_CONFIG_TLSKEYS = 0x0002, FW_CAPS_CONFIG_IPSEC_INLINE = 0x0004, + FW_CAPS_CONFIG_TLS_HW = 0x0008, }; enum fw_caps_config_fcoe { @@ -4838,6 +4839,7 @@ enum fw_params_param_dev { FW_PARAMS_PARAM_DEV_TCB_CACHE_FLUSH = 0x2D, FW_PARAMS_PARAM_DEV_FILTER = 0x2E, FW_PARAMS_PARAM_DEV_CLIP2_CMD = 0x2F, + FW_PARAMS_PARAM_DEV_KTLS_HW = 0x31, }; /* @@ -4874,6 +4876,13 @@ enum fw_params_param_dev_filter{ FW_PARAM_DEV_FILTER_MODE_MASK = 0x01, }; +enum fw_params_param_dev_ktls_hw { + FW_PARAMS_PARAM_DEV_KTLS_HW_DISABLE = 0x00, + FW_PARAMS_PARAM_DEV_KTLS_HW_ENABLE = 0x01, + FW_PARAMS_PARAM_DEV_KTLS_HW_USER_DISABLE = 0x00, + FW_PARAMS_PARAM_DEV_KTLS_HW_USER_ENABLE = 0x01, +}; + enum fw_params_param_dev_fwcache { FW_PARAM_DEV_FWCACHE_FLUSH = 0x00, FW_PARAM_DEV_FWCACHE_FLUSHINV = 0x01, @@ -9638,6 +9647,7 @@ struct fw_debug_cmd { enum fw_diag_cmd_type { FW_DIAG_CMD_TYPE_OFLDIAG = 0, + FW_DIAG_CMD_TYPE_MEM_TEST_DIAG, }; enum fw_diag_cmd_ofldiag_op { @@ -9654,6 +9664,22 @@ enum fw_diag_cmd_ofldiag_status { FW_DIAG_CMD_OFLDIAG_STATUS_PASSED, }; +enum fw_diag_cmd_memdiag_op { + FW_DIAG_CMD_MEMDIAG_TEST_START=1, + FW_DIAG_CMD_MEMDIAG_TEST_STOP, + FW_DIAG_CMD_MEMDIAG_TEST_STATUS
svn commit: r365732 - head/sys/dev/cxgbe/common
Author: np Date: Mon Sep 14 22:15:54 2020 New Revision: 365732 URL: https://svnweb.freebsd.org/changeset/base/365732 Log: cxgbe(4): Get the count of FCS errors from the MAC and not MPS for T6 ports. The MPS register on the T6 counts something other than FCS errors despite its name. MFC after:3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c == --- head/sys/dev/cxgbe/common/t4_hw.c Mon Sep 14 21:33:11 2020 (r365731) +++ head/sys/dev/cxgbe/common/t4_hw.c Mon Sep 14 22:15:54 2020 (r365732) @@ -6853,6 +6853,7 @@ void t4_get_port_stats_offset(struct adapter *adap, in void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) { u32 bgmap = adap2pinfo(adap, idx)->mps_bg_map; + struct link_config *lc = &adap->port[idx]->link_cfg; u32 stat_ctl = t4_read_reg(adap, A_MPS_STAT_CTL); #define GET_STAT(name) \ @@ -6902,7 +6903,6 @@ void t4_get_port_stats(struct adapter *adap, int idx, p->rx_ucast_frames = GET_STAT(RX_PORT_UCAST); p->rx_too_long = GET_STAT(RX_PORT_MTU_ERROR); p->rx_jabber= GET_STAT(RX_PORT_MTU_CRC_ERROR); - p->rx_fcs_err = GET_STAT(RX_PORT_CRC_ERROR); p->rx_len_err = GET_STAT(RX_PORT_LEN_ERROR); p->rx_symbol_err= GET_STAT(RX_PORT_SYM_ERROR); p->rx_runt = GET_STAT(RX_PORT_LESS_64B); @@ -6922,6 +6922,26 @@ void t4_get_port_stats(struct adapter *adap, int idx, p->rx_ppp6 = GET_STAT(RX_PORT_PPP6); p->rx_ppp7 = GET_STAT(RX_PORT_PPP7); + /* +* The T6's MPS's RX_PORT_CRC_ERROR register doesn't actually count CRC +* errors so get that information from the MAC instead. Which MAC is in +* use depends on speed and FEC. The MAC counters clear on reset or +* link state change so we are only reporting errors for this +* incarnation of the link here. +*/ + if (chip_id(adap) != CHELSIO_T6) + p->rx_fcs_err = GET_STAT(RX_PORT_CRC_ERROR); + else if (lc->link_ok) { + if (lc->speed > 25000 || + (lc->speed == 25000 && lc->fec == FEC_RS)) { + p->rx_fcs_err = t4_read_reg64(adap, T5_PORT_REG(idx, + A_MAC_PORT_AFRAMECHECKSEQUENCEERRORS)); + } else { + p->rx_fcs_err = t4_read_reg64(adap, T5_PORT_REG(idx, + A_MAC_PORT_MTIP_1G10G_RX_CRCERRORS)); + } + } + if (chip_id(adap) >= CHELSIO_T5) { if (stat_ctl & F_COUNTPAUSESTATRX) { p->rx_frames -= p->rx_pause; @@ -10757,6 +10777,12 @@ void t4_clr_port_stats(struct adapter *adap, int idx) t4_write_reg(adap, A_MPS_STAT_RX_BG_0_MAC_TRUNC_FRAME_L + i * 8, 0); } + if (chip_id(adap) == CHELSIO_T6) { + t4_write_reg64(adap, T5_PORT_REG(idx, + A_MAC_PORT_AFRAMECHECKSEQUENCEERRORS), 0); + t4_write_reg64(adap, T5_PORT_REG(idx, + A_MAC_PORT_MTIP_1G10G_RX_CRCERRORS), 0); + } } /** ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r365014 - head/sys/dev/cxgbe
Author: np Date: Mon Aug 31 22:44:59 2020 New Revision: 365014 URL: https://svnweb.freebsd.org/changeset/base/365014 Log: cxgbe(4): Check for descriptors before writing a TLS or raw work request. This fixes a regression in r362905. Submitted by: jhb@ Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Mon Aug 31 21:57:01 2020(r365013) +++ head/sys/dev/cxgbe/t4_sge.c Mon Aug 31 22:44:59 2020(r365014) @@ -3004,6 +3004,14 @@ eth_tx(struct mp_ring *r, u_int cidx, u_int pidx, bool MPASS(rc != 0 && rc != EAGAIN); MPASS(txp->npkt == 0); + + n = tx_len16_to_desc(mbuf_len16(m0)); + if (__predict_false(avail < n)) { + avail += reclaim_tx_descs(txq, min(n, 32)); + if (avail < n) + break; /* out of descriptors */ + } + wr = &eq->desc[eq->pidx]; if (mbuf_cflags(m0) & MC_RAW_WR) { n = write_raw_wr(txq, wr, m0, avail); @@ -3014,12 +3022,6 @@ eth_tx(struct mp_ring *r, u_int cidx, u_int pidx, bool avail); #endif } else { - n = tx_len16_to_desc(mbuf_len16(m0)); - if (__predict_false(avail < n)) { - avail += reclaim_tx_descs(txq, 32); - if (avail < n) - break; /* out of descriptors */ - } ETHER_BPF_MTAP(ifp, m0); if (sc->flags & IS_VF) n = write_txpkt_vm_wr(sc, txq, m0); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364497 - in head/sys/dev/cxgbe: . common
Author: np Date: Sun Aug 23 04:16:20 2020 New Revision: 364497 URL: https://svnweb.freebsd.org/changeset/base/364497 Log: cxgbe(4): Use large clusters for TOE rx queues when TOE+TLS is enabled. Rx is more efficient within the chip when the receive buffer size matches the TLS PDU size. MFC after:3 days Sponsored by: Chelsio Communications Differential Revision:https://reviews.freebsd.org/D26127 Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/common/common.h == --- head/sys/dev/cxgbe/common/common.h Sat Aug 22 22:56:50 2020 (r364496) +++ head/sys/dev/cxgbe/common/common.h Sun Aug 23 04:16:20 2020 (r364497) @@ -246,6 +246,8 @@ struct tp_params { uint32_t vlan_pri_map; uint32_t ingress_config; + uint32_t max_rx_pdu; + uint32_t max_tx_pdu; uint64_t hash_filter_mask; __be16 err_vec_mask; Modified: head/sys/dev/cxgbe/common/t4_hw.c == --- head/sys/dev/cxgbe/common/t4_hw.c Sat Aug 22 22:56:50 2020 (r364496) +++ head/sys/dev/cxgbe/common/t4_hw.c Sun Aug 23 04:16:20 2020 (r364497) @@ -9614,7 +9614,7 @@ static void read_filter_mode_and_ingress_config(struct int t4_init_tp_params(struct adapter *adap, bool sleep_ok) { int chan; - u32 v; + u32 tx_len, rx_len, r, v; struct tp_params *tpp = &adap->params.tp; v = t4_read_reg(adap, A_TP_TIMER_RESOLUTION); @@ -9640,6 +9640,21 @@ int t4_init_tp_params(struct adapter *adap, bool sleep htobe16(V_T6_COMPR_RXERR_VEC(M_T6_COMPR_RXERR_VEC)); } } + + rx_len = t4_read_reg(adap, A_TP_PMM_RX_PAGE_SIZE); + tx_len = t4_read_reg(adap, A_TP_PMM_TX_PAGE_SIZE); + + r = t4_read_reg(adap, A_TP_PARA_REG2); + rx_len = min(rx_len, G_MAXRXDATA(r)); + tx_len = min(tx_len, G_MAXRXDATA(r)); + + r = t4_read_reg(adap, A_TP_PARA_REG7); + v = min(G_PMMAXXFERLEN0(r), G_PMMAXXFERLEN1(r)); + rx_len = min(rx_len, v); + tx_len = min(tx_len, v); + + tpp->max_tx_pdu = tx_len; + tpp->max_rx_pdu = rx_len; return 0; } Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cSat Aug 22 22:56:50 2020 (r364496) +++ head/sys/dev/cxgbe/t4_main.cSun Aug 23 04:16:20 2020 (r364497) @@ -736,6 +736,7 @@ static int sysctl_ulprx_la(SYSCTL_HANDLER_ARGS); static int sysctl_wcwr_stats(SYSCTL_HANDLER_ARGS); static int sysctl_cpus(SYSCTL_HANDLER_ARGS); #ifdef TCP_OFFLOAD +static int sysctl_tls(SYSCTL_HANDLER_ARGS); static int sysctl_tls_rx_ports(SYSCTL_HANDLER_ARGS); static int sysctl_tp_tick(SYSCTL_HANDLER_ARGS); static int sysctl_tp_dack_timer(SYSCTL_HANDLER_ARGS); @@ -6607,8 +6608,9 @@ t4_sysctls(struct adapter *sc) CTLFLAG_RW, &sc->tt.rx_coalesce, 0, "receive coalescing"); sc->tt.tls = 0; - SYSCTL_ADD_INT(ctx, children, OID_AUTO, "tls", CTLFLAG_RW, - &sc->tt.tls, 0, "Inline TLS allowed"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "tls", CTLTYPE_INT | + CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, sysctl_tls, "I", + "Inline TLS allowed"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "tls_rx_ports", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, @@ -9699,6 +9701,37 @@ sysctl_cpus(SYSCTL_HANDLER_ARGS) } #ifdef TCP_OFFLOAD +static int +sysctl_tls(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + int i, j, v, rc; + struct vi_info *vi; + + v = sc->tt.tls; + rc = sysctl_handle_int(oidp, &v, 0, req); + if (rc != 0 || req->newptr == NULL) + return (rc); + + if (v != 0 && !(sc->cryptocaps & FW_CAPS_CONFIG_TLSKEYS)) + return (ENOTSUP); + + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4stls"); + if (rc) + return (rc); + sc->tt.tls = !!v; + for_each_port(sc, i) { + for_each_vi(sc->port[i], j, vi) { + if (vi->flags & VI_INIT_DONE) + t4_update_fl_bufsize(vi->ifp); + } + } + end_synchronized_op(sc, 0); + + return (0); + +} + static int sysctl_tls_rx_ports(SYSCTL_HANDLER_ARGS) { Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Sat Aug 22 22:56:50 2020(r364496) +++ head/sys/dev/cxgbe/t4_sge.c Sun Aug 23 04:16:20 2020(r364497) @@ -1032,14 +1032,19 @@ t4_teardown_ada
svn commit: r364444 - head/sys/dev/cxgbe/cxgbei
Author: np Date: Fri Aug 21 00:34:33 2020 New Revision: 36 URL: https://svnweb.freebsd.org/changeset/base/36 Log: cxgbei: destroy the worker threads' CV and mutex in stop_worker_threads. Reported by: bz@ MFC after:3 days Modified: head/sys/dev/cxgbe/cxgbei/cxgbei.c Modified: head/sys/dev/cxgbe/cxgbei/cxgbei.c == --- head/sys/dev/cxgbe/cxgbei/cxgbei.c Fri Aug 21 00:27:06 2020 (r364443) +++ head/sys/dev/cxgbe/cxgbei/cxgbei.c Fri Aug 21 00:34:33 2020 (r36) @@ -715,6 +715,8 @@ stop_worker_threads(void) cv_wait(&cwt->cwt_cv, &cwt->cwt_lock); } while (cwt->cwt_state != CWT_STOPPED); mtx_unlock(&cwt->cwt_lock); + mtx_destroy(&cwt->cwt_lock); + cv_destroy(&cwt->cwt_cv); } free(cwt_softc, M_CXGBE); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363498 - in head/sys/dev/cxgbe: common cudbg
Author: np Date: Fri Jul 24 23:15:42 2020 New Revision: 363498 URL: https://svnweb.freebsd.org/changeset/base/363498 Log: cxgbe(4): Some updates to the common code. Obtained from:Chelsio Communications MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/common/t4_hw.h head/sys/dev/cxgbe/cudbg/cudbg_lib.c Modified: head/sys/dev/cxgbe/common/common.h == --- head/sys/dev/cxgbe/common/common.h Fri Jul 24 21:14:59 2020 (r363497) +++ head/sys/dev/cxgbe/common/common.h Fri Jul 24 23:15:42 2020 (r363498) @@ -299,6 +299,7 @@ struct chip_params { u16 vfcount; u32 sge_fl_db; u16 mps_tcam_size; + u16 rss_nentries; }; /* VF-only parameters. */ @@ -377,6 +378,7 @@ struct adapter_params { unsigned int hash_filter:1; unsigned int filter2_wr_support:1; unsigned int port_caps32:1; + unsigned int smac_add_support:1; unsigned int ofldq_wr_cred; unsigned int eo_wr_cred; @@ -783,8 +785,27 @@ int t4_set_rxmode(struct adapter *adap, unsigned int m int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox, unsigned int viid, bool free, unsigned int naddr, const u8 **addr, u16 *idx, u64 *hash, bool sleep_ok); +int t4_free_mac_filt(struct adapter *adap, unsigned int mbox, + unsigned int viid, unsigned int naddr, + const u8 **addr, bool sleep_ok); +int t4_free_encap_mac_filt(struct adapter *adap, unsigned int viid, + int idx, bool sleep_ok); +int t4_free_raw_mac_filt(struct adapter *adap, unsigned int viid, +const u8 *addr, const u8 *mask, unsigned int idx, +u8 lookup_type, u8 port_id, bool sleep_ok); +int t4_alloc_raw_mac_filt(struct adapter *adap, unsigned int viid, + const u8 *addr, const u8 *mask, unsigned int idx, + u8 lookup_type, u8 port_id, bool sleep_ok); +int t4_alloc_encap_mac_filt(struct adapter *adap, unsigned int viid, + const u8 *addr, const u8 *mask, unsigned int vni, + unsigned int vni_mask, u8 dip_hit, u8 lookup_type, + bool sleep_ok); int t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, int idx, const u8 *addr, bool persist, uint16_t *smt_idx); +int t4_del_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, + const u8 *addr, bool smac); +int t4_add_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, + int idx, const u8 *addr, bool persist, u8 *smt_idx, bool smac); int t4_set_addr_hash(struct adapter *adap, unsigned int mbox, unsigned int viid, bool ucast, u64 vec, bool sleep_ok); int t4_enable_vi_params(struct adapter *adap, unsigned int mbox, @@ -797,6 +818,10 @@ int t4_mdio_rd(struct adapter *adap, unsigned int mbox unsigned int mmd, unsigned int reg, unsigned int *valp); int t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, unsigned int mmd, unsigned int reg, unsigned int val); +int t4_i2c_io(struct adapter *adap, unsigned int mbox, + int port, unsigned int devid, + unsigned int offset, unsigned int len, + u8 *buf, bool write); int t4_i2c_rd(struct adapter *adap, unsigned int mbox, int port, unsigned int devid, unsigned int offset, unsigned int len, @@ -821,7 +846,7 @@ int t4_sge_ctxt_rd(struct adapter *adap, unsigned int enum ctxt_type ctype, u32 *data); int t4_sge_ctxt_rd_bd(struct adapter *adap, unsigned int cid, enum ctxt_type ctype, u32 *data); -int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox); +int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox, int ctxt_type); const char *t4_link_down_rc_str(unsigned char link_down_rc); int t4_update_port_info(struct port_info *pi); int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl); @@ -854,6 +879,10 @@ void t4_tp_tm_pio_read(struct adapter *adap, u32 *buff u32 start_index, bool sleep_ok); void t4_tp_mib_read(struct adapter *adap, u32 *buff, u32 nregs, u32 start_index, bool sleep_ok); +int t4_configure_ringbb(struct adapter *adap); +int t4_configure_add_smac(struct adapter *adap); +int t4_set_vlan_acl(struct adapter *adap, unsigned int mbox, unsigned int vf, + u16 vlan); static inline int t4vf_query_params(struct adapter *adapter, unsigned int nparams, const u32 *params, Modified: head/sys/dev/cxgbe/common/t4_hw.c ==
svn commit: r363167 - head/sys/dev/cxgbe
Author: np Date: Mon Jul 13 19:15:29 2020 New Revision: 363167 URL: https://svnweb.freebsd.org/changeset/base/363167 Log: cxgbev(4): Compare at most 16 bytes of the Ethernet header when trying to coalesce tx work requests. Note that Coverity will still treat this as an out-of-bounds access. We do want to compare 16B starting from ethmacdst but cmp_l2hdr was was going beyond that by 2B. cmp_l2hdr was introduced in r362905. Reported by: Coverity (CID 1430284) Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Mon Jul 13 19:10:16 2020(r363166) +++ head/sys/dev/cxgbe/t4_sge.c Mon Jul 13 19:15:29 2020(r363167) @@ -4700,6 +4700,8 @@ csum_to_ctrl(struct adapter *sc, struct mbuf *m) return (ctrl); } +#define VM_TX_L2HDR_LEN16 /* ethmacdst to vlantci */ + /* * Write a VM txpkt WR for this packet to the hardware descriptors, update the * software descriptor, and advance the pidx. It is guaranteed that enough @@ -4748,7 +4750,7 @@ write_txpkt_vm_wr(struct adapter *sc, struct sge_txq * * conditional. Also, it seems that we do not have to set * vlantci or fake the ethtype when doing VLAN tag insertion. */ - m_copydata(m0, 0, sizeof(struct ether_header) + 2, wr->ethmacdst); + m_copydata(m0, 0, VM_TX_L2HDR_LEN, wr->ethmacdst); if (needs_tso(m0)) { struct cpl_tx_pkt_lso_core *lso = (void *)(wr + 1); @@ -4985,10 +4987,10 @@ cmp_l2hdr(struct txpkts *txp, struct mbuf *m) int len; MPASS(txp->npkt > 0); - MPASS(m->m_len >= 16); /* type1 implies 1 GL with all of the frame. */ + MPASS(m->m_len >= VM_TX_L2HDR_LEN); if (txp->ethtype == be16toh(ETHERTYPE_VLAN)) - len = sizeof(struct ether_vlan_header); + len = VM_TX_L2HDR_LEN; else len = sizeof(struct ether_header); @@ -4998,9 +5000,9 @@ cmp_l2hdr(struct txpkts *txp, struct mbuf *m) static inline void save_l2hdr(struct txpkts *txp, struct mbuf *m) { - MPASS(m->m_len >= 16); /* type1 implies 1 GL with all of the frame. */ + MPASS(m->m_len >= VM_TX_L2HDR_LEN); - memcpy(&txp->ethmacdst[0], mtod(m, const void *), 16); + memcpy(&txp->ethmacdst[0], mtod(m, const void *), VM_TX_L2HDR_LEN); } static int ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362938 - head/sys/dev/cxgbe
Author: np Date: Sun Jul 5 05:14:33 2020 New Revision: 362938 URL: https://svnweb.freebsd.org/changeset/base/362938 Log: cxgbe(4): Fix a bug (introduced in r362905) where some tx traffic wasn't being reported to BPF. Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Sun Jul 5 00:19:08 2020(r362937) +++ head/sys/dev/cxgbe/t4_sge.c Sun Jul 5 05:14:33 2020(r362938) @@ -3013,6 +3013,7 @@ eth_tx(struct mp_ring *r, u_int cidx, u_int pidx, bool if (avail < n) break; /* out of descriptors */ } + ETHER_BPF_MTAP(ifp, m0); if (sc->flags & IS_VF) n = write_txpkt_vm_wr(sc, txq, m0); else ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362905 - in head/sys/dev/cxgbe: . common
Author: np Date: Fri Jul 3 04:44:23 2020 New Revision: 362905 URL: https://svnweb.freebsd.org/changeset/base/362905 Log: cxgbe(4): changes in the Tx path to help increase tx coalescing. - Ask the firmware for the number of frames that can be stuffed in one work request. - Modify mp_ring to increase the likelihood of tx coalescing when there are just one or two threads that are doing most of the tx. Add teeth to the abdication mechanism by pushing the consumer lock into mp_ring. This reduces the likelihood that a consumer will get stuck with all the work even though it is above its budget. - Add support for coalesced tx WR to the VF driver. This, with the changes above, results in a 7x improvement in the tx pps of the VF driver for some common cases. The firmware vets the L2 headers submitted by the VF driver and it's a big win if the checks are performed for a batch of packets and not each one individually. Reviewed by: jhb@ MFC after:2 weeks Sponsored by: Chelsio Communications Differential Revision:https://reviews.freebsd.org/D25454 Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_mp_ring.c head/sys/dev/cxgbe/t4_mp_ring.h head/sys/dev/cxgbe/t4_sge.c head/sys/dev/cxgbe/t4_vf.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hFri Jul 3 02:02:34 2020 (r362904) +++ head/sys/dev/cxgbe/adapter.hFri Jul 3 04:44:23 2020 (r362905) @@ -550,6 +550,23 @@ struct sge_fl { struct mp_ring; +struct txpkts { + uint8_t wr_type;/* type 0 or type 1 */ + uint8_t npkt; /* # of packets in this work request */ + uint8_t len16; /* # of 16B pieces used by this work request */ + uint8_t score; /* 1-10. coalescing attempted if score > 3 */ + uint8_t max_npkt; /* maximum number of packets allowed */ + uint16_t plen; /* total payload (sum of all packets) */ + + /* straight from fw_eth_tx_pkts_vm_wr. */ + __u8 ethmacdst[6]; + __u8 ethmacsrc[6]; + __be16 ethtype; + __be16 vlantci; + + struct mbuf *mb[15]; +}; + /* txq: SGE egress queue + what's needed for Ethernet NIC */ struct sge_txq { struct sge_eq eq; /* MUST be first */ @@ -560,6 +577,7 @@ struct sge_txq { struct sglist *gl; __be32 cpl_ctrl0; /* for convenience */ int tc_idx; /* traffic class */ + struct txpkts txp; struct task tx_reclaim_task; /* stats for common events first */ Modified: head/sys/dev/cxgbe/common/common.h == --- head/sys/dev/cxgbe/common/common.h Fri Jul 3 02:02:34 2020 (r362904) +++ head/sys/dev/cxgbe/common/common.h Fri Jul 3 04:44:23 2020 (r362905) @@ -389,6 +389,7 @@ struct adapter_params { bool ulptx_memwrite_dsgl; /* use of T5 DSGL allowed */ bool fr_nsmr_tpte_wr_support; /* FW support for FR_NSMR_TPTE_WR */ bool viid_smt_extn_support; /* FW returns vin, vfvld & smt index? */ + unsigned int max_pkts_per_eth_tx_pkts_wr; }; #define CHELSIO_T4 0x4 Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cFri Jul 3 02:02:34 2020 (r362904) +++ head/sys/dev/cxgbe/t4_main.cFri Jul 3 04:44:23 2020 (r362905) @@ -2191,7 +2191,7 @@ cxgbe_transmit(struct ifnet *ifp, struct mbuf *m) vi->rsrv_noflowq); items[0] = m; - rc = mp_ring_enqueue(txq->r, items, 1, 4096); + rc = mp_ring_enqueue(txq->r, items, 1, 256); if (__predict_false(rc != 0)) m_freem(m); @@ -2212,7 +2212,7 @@ cxgbe_qflush(struct ifnet *ifp) txq->eq.flags |= EQ_QFLUSH; TXQ_UNLOCK(txq); while (!mp_ring_is_idle(txq->r)) { - mp_ring_check_drainage(txq->r, 0); + mp_ring_check_drainage(txq->r, 4096); pause("qflush", 1); } TXQ_LOCK(txq); @@ -2261,7 +2261,7 @@ vi_get_counter(struct ifnet *ifp, ift_counter c) struct sge_txq *txq; for_each_txq(vi, i, txq) - drops += counter_u64_fetch(txq->r->drops); + drops += counter_u64_fetch(txq->r->dropped); } return (drops); @@ -2326,7 +2326,7 @@ cxgbe_get_counter(struct ifnet *ifp, ift_counter c) struct sge_txq *txq; for_eac
svn commit: r362616 - in head/sys/dev/cxgbe: . crypto cxgbei tom
Author: np Date: Thu Jun 25 17:04:22 2020 New Revision: 362616 URL: https://svnweb.freebsd.org/changeset/base/362616 Log: cxgbe(4): Add a pointer to the adapter softc in vi_info. There were quite a few places where port_info was being accessed only to get to the adapter. Reviewed by: jhb@ MFC after:1 week Sponsored by: Chelsio Communications Differential Revision:https://reviews.freebsd.org/D25432 Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/crypto/t4_kern_tls.c head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/cxgbe/t4_sge.c head/sys/dev/cxgbe/t4_vf.c head/sys/dev/cxgbe/tom/t4_listen.c head/sys/dev/cxgbe/tom/t4_tom.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hThu Jun 25 16:46:27 2020 (r362615) +++ head/sys/dev/cxgbe/adapter.hThu Jun 25 17:04:22 2020 (r362616) @@ -190,6 +190,7 @@ enum { struct vi_info { device_t dev; struct port_info *pi; + struct adapter *adapter; struct ifnet *ifp; struct pfil_head *pfil; @@ -953,22 +954,22 @@ struct adapter { #define TXQ_LOCK_ASSERT_NOTOWNED(txq) EQ_LOCK_ASSERT_NOTOWNED(&(txq)->eq) #define for_each_txq(vi, iter, q) \ - for (q = &vi->pi->adapter->sge.txq[vi->first_txq], iter = 0; \ + for (q = &vi->adapter->sge.txq[vi->first_txq], iter = 0; \ iter < vi->ntxq; ++iter, ++q) #define for_each_rxq(vi, iter, q) \ - for (q = &vi->pi->adapter->sge.rxq[vi->first_rxq], iter = 0; \ + for (q = &vi->adapter->sge.rxq[vi->first_rxq], iter = 0; \ iter < vi->nrxq; ++iter, ++q) #define for_each_ofld_txq(vi, iter, q) \ - for (q = &vi->pi->adapter->sge.ofld_txq[vi->first_ofld_txq], iter = 0; \ + for (q = &vi->adapter->sge.ofld_txq[vi->first_ofld_txq], iter = 0; \ iter < vi->nofldtxq; ++iter, ++q) #define for_each_ofld_rxq(vi, iter, q) \ - for (q = &vi->pi->adapter->sge.ofld_rxq[vi->first_ofld_rxq], iter = 0; \ + for (q = &vi->adapter->sge.ofld_rxq[vi->first_ofld_rxq], iter = 0; \ iter < vi->nofldrxq; ++iter, ++q) #define for_each_nm_txq(vi, iter, q) \ - for (q = &vi->pi->adapter->sge.nm_txq[vi->first_nm_txq], iter = 0; \ + for (q = &vi->adapter->sge.nm_txq[vi->first_nm_txq], iter = 0; \ iter < vi->nnmtxq; ++iter, ++q) #define for_each_nm_rxq(vi, iter, q) \ - for (q = &vi->pi->adapter->sge.nm_rxq[vi->first_nm_rxq], iter = 0; \ + for (q = &vi->adapter->sge.nm_rxq[vi->first_nm_rxq], iter = 0; \ iter < vi->nnmrxq; ++iter, ++q) #define for_each_vi(_pi, _iter, _vi) \ for ((_vi) = (_pi)->vi, (_iter) = 0; (_iter) < (_pi)->nvi; \ Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c == --- head/sys/dev/cxgbe/crypto/t4_kern_tls.c Thu Jun 25 16:46:27 2020 (r362615) +++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Thu Jun 25 17:04:22 2020 (r362616) @@ -587,7 +587,7 @@ cxgbe_tls_tag_alloc(struct ifnet *ifp, union if_snd_ta } vi = ifp->if_softc; - sc = vi->pi->adapter; + sc = vi->adapter; tlsp = alloc_tlspcb(ifp, vi, M_WAITOK); Modified: head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c == --- head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Thu Jun 25 16:46:27 2020 (r362615) +++ head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Thu Jun 25 17:04:22 2020 (r362616) @@ -673,7 +673,7 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) MPASS(tp->tod != NULL); MPASS(tp->t_toe != NULL); toep = tp->t_toe; - MPASS(toep->vi->pi->adapter == icc->sc); + MPASS(toep->vi->adapter == icc->sc); icc->toep = toep; icc->cwt = cxgbei_select_worker_thread(icc); Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cThu Jun 25 16:46:27 2020 (r362615) +++ head/sys/dev/cxgbe/t4_main.cThu Jun 25 17:04:22 2020 (r362616) @@ -1345,6 +1345,7 @@ t4_attach(device_t dev) pi->nvi = num_vis; for_each_vi(pi, j, vi) { vi->pi = pi; + vi->adapter = sc; vi->qsize_rxq = t4_qsize_rxq; vi->qsize_txq = t4_qsize_txq; @@ -1748,11 +1749,11 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi) ifp->if_capabilities = T4_CAP; ifp->if_capenable = T4_CAP_ENABLE; #ifdef TCP_OFFLOAD - if (vi->nofldrxq != 0 && (vi->pi->adapter->flags & KERN_TLS_OK) == 0) + if (vi->nofldrxq != 0 && (vi->adapter->flags & KE
svn commit: r362532 - in head/sys/dev/cxgbe: . crypto
Author: np Date: Tue Jun 23 07:33:29 2020 New Revision: 362532 URL: https://svnweb.freebsd.org/changeset/base/362532 Log: cxgbe(4): Add a tx_len16_to_desc helper. No functional change. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/crypto/t4_kern_tls.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hTue Jun 23 06:42:39 2020 (r362531) +++ head/sys/dev/cxgbe/adapter.hTue Jun 23 07:33:29 2020 (r362532) @@ -1347,4 +1347,12 @@ write_via_memwin(struct adapter *sc, int idx, uint32_t return (rw_via_memwin(sc, idx, addr, (void *)(uintptr_t)val, len, 1)); } + +/* Number of len16 -> number of descriptors */ +static inline int +tx_len16_to_desc(int len16) +{ + + return (howmany(len16, EQ_ESIZE / 16)); +} #endif Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c == --- head/sys/dev/cxgbe/crypto/t4_kern_tls.c Tue Jun 23 06:42:39 2020 (r362531) +++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Tue Jun 23 07:33:29 2020 (r362532) @@ -1375,7 +1375,7 @@ ktls_write_tcp_options(struct sge_txq *txq, void *dst, pktlen = m->m_len; ctrl = sizeof(struct cpl_tx_pkt_core) + pktlen; len16 = howmany(sizeof(struct fw_eth_tx_pkt_wr) + ctrl, 16); - ndesc = howmany(len16, EQ_ESIZE / 16); + ndesc = tx_len16_to_desc(len16); MPASS(ndesc <= available); /* Firmware work request header */ @@ -1475,7 +1475,7 @@ ktls_write_tunnel_packet(struct sge_txq *txq, void *ds pktlen = m->m_len + m_tls->m_len; ctrl = sizeof(struct cpl_tx_pkt_core) + pktlen; len16 = howmany(sizeof(struct fw_eth_tx_pkt_wr) + ctrl, 16); - ndesc = howmany(len16, EQ_ESIZE / 16); + ndesc = tx_len16_to_desc(len16); MPASS(ndesc <= available); /* Firmware work request header */ @@ -2116,7 +2116,7 @@ ktls_write_tcp_fin(struct sge_txq *txq, void *dst, str pktlen = m->m_len; ctrl = sizeof(struct cpl_tx_pkt_core) + pktlen; len16 = howmany(sizeof(struct fw_eth_tx_pkt_wr) + ctrl, 16); - ndesc = howmany(len16, EQ_ESIZE / 16); + ndesc = tx_len16_to_desc(len16); MPASS(ndesc <= available); /* Firmware work request header */ Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Tue Jun 23 06:42:39 2020(r362531) +++ head/sys/dev/cxgbe/t4_sge.c Tue Jun 23 07:33:29 2020(r362532) @@ -2708,7 +2708,7 @@ start_wrq_wr(struct sge_wrq *wrq, int len16, struct wr void *w; MPASS(len16 > 0); - ndesc = howmany(len16, EQ_ESIZE / 16); + ndesc = tx_len16_to_desc(len16); MPASS(ndesc > 0 && ndesc <= SGE_MAX_WR_NDESC); EQ_LOCK(eq); @@ -2920,10 +2920,9 @@ eth_tx(struct mp_ring *r, u_int cidx, u_int pidx) M_ASSERTPKTHDR(m0); MPASS(m0->m_nextpkt == NULL); - if (available < howmany(mbuf_len16(m0), EQ_ESIZE / 16)) { - MPASS(howmany(mbuf_len16(m0), EQ_ESIZE / 16) <= 64); + if (available < tx_len16_to_desc(mbuf_len16(m0))) { available += reclaim_tx_descs(txq, 64); - if (available < howmany(mbuf_len16(m0), EQ_ESIZE / 16)) + if (available < tx_len16_to_desc(mbuf_len16(m0))) break; /* out of descriptors */ } @@ -4678,7 +4677,7 @@ write_txpkt_vm_wr(struct adapter *sc, struct sge_txq * ctrl = sizeof(struct cpl_tx_pkt_core); if (needs_tso(m0)) ctrl += sizeof(struct cpl_tx_pkt_lso_core); - ndesc = howmany(len16, EQ_ESIZE / 16); + ndesc = tx_len16_to_desc(len16); MPASS(ndesc <= available); /* Firmware work request header */ @@ -4789,7 +4788,7 @@ write_raw_wr(struct sge_txq *txq, void *wr, struct mbu int len16, ndesc; len16 = mbuf_len16(m0); - ndesc = howmany(len16, EQ_ESIZE / 16); + ndesc = tx_len16_to_desc(len16); MPASS(ndesc <= available); dst = wr; @@ -4842,7 +4841,7 @@ write_txpkt_wr(struct adapter *sc, struct sge_txq *txq sizeof(struct cpl_tx_pkt_core) + pktlen, 16); nsegs = 0; } - ndesc = howmany(len16, EQ_ESIZE / 16); + ndesc = tx_len16_to_desc(len16); MPASS(ndesc <= available); /* Firmware work request header */ @@ -4948,7 +4947,7 @@ try_txpkts(struct mbuf *m, struct mbuf *n, struct txpk l2 = txpkts0_len16(nsegs2); } txp->len16 = howmany(sizeof(struct fw_eth_tx_pkts_wr), 16) + l1 + l2; - needed = howmany(txp->len16, EQ_ESIZE / 16)
svn commit: r361261 - in head/sys/dev/cxgbe: . iw_cxgbe
Author: np Date: Tue May 19 16:28:20 2020 New Revision: 361261 URL: https://svnweb.freebsd.org/changeset/base/361261 Log: cxgbe/iw_cxgbe: Add an async callback to notify iw_cxgbe in case of a fatal error. Submitted by: Krishnamraju Eraparaju @ Chelsio MFC after:2 weeks Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/iw_cxgbe/cm.c head/sys/dev/cxgbe/iw_cxgbe/device.c head/sys/dev/cxgbe/offload.h head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hTue May 19 16:06:03 2020 (r361260) +++ head/sys/dev/cxgbe/adapter.hTue May 19 16:28:20 2020 (r361261) @@ -830,6 +830,7 @@ struct adapter { int sc_do_rxcopy; struct taskqueue *tq[MAX_NCHAN];/* General purpose taskqueues */ + struct task async_event_task; struct port_info *port[MAX_NPORTS]; uint8_t chan_map[MAX_NCHAN];/* channel -> port */ Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c == --- head/sys/dev/cxgbe/iw_cxgbe/cm.cTue May 19 16:06:03 2020 (r361260) +++ head/sys/dev/cxgbe/iw_cxgbe/cm.cTue May 19 16:28:20 2020 (r361261) @@ -1085,7 +1085,7 @@ c4iw_so_upcall(struct socket *so, void *arg, int waitf * Wake up any threads waiting in rdma_init()/rdma_fini(), * with locks held. */ - if (so->so_error) + if (so->so_error || (ep->com.dev->rdev.flags & T4_FATAL_ERROR)) c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET); add_ep_to_req_list(ep, C4IW_EVENT_SOCKET); @@ -2700,6 +2700,11 @@ c4iw_create_listen(struct iw_cm_id *cm_id, int backlog CTR3(KTR_IW_CXGBE, "%s: cm_id %p, backlog %s", __func__, cm_id, backlog); + if (c4iw_fatal_error(&dev->rdev)) { + CTR2(KTR_IW_CXGBE, "%s: cm_id %p, fatal error", __func__, + cm_id); + return -EIO; + } lep = alloc_ep(sizeof(*lep), GFP_KERNEL); lep->com.cm_id = cm_id; ref_cm_id(&lep->com); @@ -2800,7 +2805,6 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, { int ret = 0; int close = 0; - int fatal = 0; struct c4iw_rdev *rdev; @@ -2809,12 +2813,14 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, rdev = &ep->com.dev->rdev; if (c4iw_fatal_error(rdev)) { - - CTR2(KTR_IW_CXGBE, "%s:ced1 %p", __func__, ep); - fatal = 1; + CTR3(KTR_IW_CXGBE, "%s:ced1 fatal error %p %s", __func__, ep, + states[ep->com.state]); + if (ep->com.state != DEAD) { + send_abort(ep); + ep->com.state = DEAD; + } close_complete_upcall(ep, -ECONNRESET); - send_abort(ep); - ep->com.state = DEAD; + return ECONNRESET; } CTR3(KTR_IW_CXGBE, "%s:ced2 %p %s", __func__, ep, states[ep->com.state]); @@ -2877,9 +2883,7 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, CTR2(KTR_IW_CXGBE, "%s:ced4 %p", __func__, ep); set_bit(EP_DISC_ABORT, &ep->com.history); close_complete_upcall(ep, -ECONNRESET); - ret = send_abort(ep); - if (ret) - fatal = 1; + send_abort(ep); } else { CTR2(KTR_IW_CXGBE, "%s:ced5 %p", __func__, ep); @@ -2889,33 +2893,28 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, ep->com.state = MORIBUND; CURVNET_SET(ep->com.so->so_vnet); - sodisconnect(ep->com.so); + ret = sodisconnect(ep->com.so); CURVNET_RESTORE(); - } - - } - - if (fatal) { - set_bit(EP_DISC_FAIL, &ep->com.history); - if (!abrupt) { - STOP_EP_TIMER(ep); - close_complete_upcall(ep, -EIO); - } - if (ep->com.qp) { - struct c4iw_qp_attributes attrs = {0}; - - attrs.next_state = C4IW_QP_STATE_ERROR; - ret = c4iw_modify_qp(ep->com.dev, ep->com.qp, - C4IW_QP_ATTR_NEXT_STATE, - &attrs, 1); if (ret) { - CTR2(KTR_IW_CXGBE, "%s:ced7 %p", __func__, ep); - printf("%s - qp <- error failed!\n", __func__); + CTR2(KTR
Re: svn commit: r360581 - in head/sys: dev/cxgbe dev/cxgbe/crypto dev/cxgbe/tom dev/mlx5/mlx5_en kern netinet sys
On Sun, May 03, 2020 at 12:21:11AM +, Gleb Smirnoff wrote: > Author: glebius > Date: Sun May 3 00:21:11 2020 > New Revision: 360581 > URL: https://svnweb.freebsd.org/changeset/base/360581 > > Log: > Step 4.1: mechanically rename M_NOMAP to M_EXTPG Hello Gleb, This looks incomplete. mbuf.9 still refers to M_NOMAP. ifnet cap is still IFCAP_NOMAP and shown as NOMAP by ifconfig, and ifconfig still uses (-)nomap to enable/disable the capability. This looks a bit gratuitous to me but if you're going to do it then at least use the same name consistently throughout the tree. Regards, Navdeep > > Reviewed by:gallatin > Differential Revision: https://reviews.freebsd.org/D24598 > > Modified: > head/sys/dev/cxgbe/crypto/t4_kern_tls.c > head/sys/dev/cxgbe/t4_sge.c > head/sys/dev/cxgbe/tom/t4_cpl_io.c > head/sys/dev/cxgbe/tom/t4_tls.c > head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c > head/sys/kern/kern_mbuf.c > head/sys/kern/kern_sendfile.c > head/sys/kern/subr_bus_dma.c > head/sys/kern/subr_sglist.c > head/sys/kern/uipc_ktls.c > head/sys/kern/uipc_mbuf.c > head/sys/kern/uipc_sockbuf.c > head/sys/kern/uipc_socket.c > head/sys/netinet/tcp_output.c > head/sys/netinet/tcp_pcap.c > head/sys/sys/mbuf.h > > Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c > == > --- head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sun May 3 00:15:18 2020 > (r360580) > +++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sun May 3 00:21:11 2020 > (r360581) > @@ -1208,7 +1208,7 @@ t6_ktls_parse_pkt(struct mbuf *m, int *nsegsp, int *le > > /* Assume all headers are in 'm' for now. */ > MPASS(m->m_next != NULL); > - MPASS(m->m_next->m_flags & M_NOMAP); > + MPASS(m->m_next->m_flags & M_EXTPG); > > tot_len = 0; > > @@ -1218,7 +1218,7 @@ t6_ktls_parse_pkt(struct mbuf *m, int *nsegsp, int *le >*/ > *nsegsp = 0; > for (m_tls = m->m_next; m_tls != NULL; m_tls = m_tls->m_next) { > - MPASS(m_tls->m_flags & M_NOMAP); > + MPASS(m_tls->m_flags & M_EXTPG); > > wr_len = ktls_wr_len(tlsp, m, m_tls, &nsegs); > #ifdef VERBOSE_TRACES > @@ -2265,7 +2265,7 @@ t6_ktls_write_wr(struct sge_txq *txq, void *dst, struc >* for that record. >*/ > for (m_tls = m->m_next; m_tls != NULL; m_tls = m_tls->m_next) { > - MPASS(m_tls->m_flags & M_NOMAP); > + MPASS(m_tls->m_flags & M_EXTPG); > > /* >* Determine the initial TCP sequence number for this > > Modified: head/sys/dev/cxgbe/t4_sge.c > == > --- head/sys/dev/cxgbe/t4_sge.c Sun May 3 00:15:18 2020 > (r360580) > +++ head/sys/dev/cxgbe/t4_sge.c Sun May 3 00:21:11 2020 > (r360581) > @@ -2497,7 +2497,7 @@ count_mbuf_nsegs(struct mbuf *m, int skip, uint8_t *cf > skip -= len; > continue; > } > - if ((m->m_flags & M_NOMAP) != 0) { > + if ((m->m_flags & M_EXTPG) != 0) { > *cflags |= MC_NOMAP; > nsegs += count_mbuf_ext_pgs(m, skip, &nextaddr); > skip = 0; > @@ -5836,7 +5836,7 @@ write_ethofld_wr(struct cxgbe_rate_tag *cst, struct fw > immhdrs -= m0->m_len; > continue; > } > - if (m0->m_flags & M_NOMAP) > + if (m0->m_flags & M_EXTPG) > sglist_append_mbuf_epg(&sg, m0, > mtod(m0, vm_offset_t), m0->m_len); > else > > Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c > == > --- head/sys/dev/cxgbe/tom/t4_cpl_io.cSun May 3 00:15:18 2020 > (r360580) > +++ head/sys/dev/cxgbe/tom/t4_cpl_io.cSun May 3 00:21:11 2020 > (r360581) > @@ -610,7 +610,7 @@ write_tx_sgl(void *dst, struct mbuf *start, struct mbu > > i = -1; > for (m = start; m != stop; m = m->m_next) { > - if (m->m_flags & M_NOMAP) > + if (m->m_flags & M_EXTPG) > rc = sglist_append_mbuf_epg(&sg, m, > mtod(m, vm_offset_t), m->m_len); > else > @@ -731,7 +731,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep > for (m = sndptr; m != NULL; m = m->m_next) { > int n; > > - if (m->m_flags & M_NOMAP) { > + if (m->m_flags & M_EXTPG) { > #ifdef KERN_TLS > if (m->m_epg_tls != NULL) { > toep->flags |= TPF_KTLS; > @@ -772,7 +772,7 @@ t4_push_frames(struct adapter *sc, struct to
svn commit: r360232 - head/sys/dev/cxgbe/crypto
Author: np Date: Thu Apr 23 23:54:23 2020 New Revision: 360232 URL: https://svnweb.freebsd.org/changeset/base/360232 Log: cxgbe/crypto: Fix the key size in a couple of places to catch up with the recent OCF refactor. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c == --- head/sys/dev/cxgbe/crypto/t4_kern_tls.c Thu Apr 23 21:16:51 2020 (r360231) +++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Thu Apr 23 23:54:23 2020 (r360232) @@ -812,11 +812,11 @@ ktls_setup_keys(struct tlspcb *tlsp, const struct ktls if (tlsp->enc_mode == SCMD_CIPH_MODE_AES_GCM) { memcpy(khdr->txsalt, tls->params.iv, SALT_SIZE); t4_init_gmac_hash(tls->params.cipher_key, - tls->params.cipher_key_len * 8, + tls->params.cipher_key_len, (char *)key + tls->params.cipher_key_len); } else { t4_init_hmac_digest(axf, partial_digest_len, - tls->params.auth_key, tls->params.auth_key_len * 8, + tls->params.auth_key, tls->params.auth_key_len, (char *)key + tls->params.cipher_key_len); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r360211 - head/sys/dev/cxgbe/iw_cxgbe
Author: np Date: Wed Apr 22 21:54:21 2020 New Revision: 360211 URL: https://svnweb.freebsd.org/changeset/base/360211 Log: cxgbe/iw_cxgbe: Create a LinuxKPI pci device for an adapter and use it as the dma_device during RDMA registration. cxgbe's struct device cannot be used as-is because it's a native FreeBSD driver and ibcore is LinuxKPI based. MFC after:1 week MFC after:r360196 Modified: head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h head/sys/dev/cxgbe/iw_cxgbe/provider.c Modified: head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h == --- head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Wed Apr 22 21:45:43 2020 (r360210) +++ head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Wed Apr 22 21:54:21 2020 (r360211) @@ -261,6 +261,7 @@ out: struct c4iw_dev { struct ib_device ibdev; + struct pci_dev pdev; struct c4iw_rdev rdev; u32 device_cap_flags; struct idr cqidr; Modified: head/sys/dev/cxgbe/iw_cxgbe/provider.c == --- head/sys/dev/cxgbe/iw_cxgbe/provider.c Wed Apr 22 21:45:43 2020 (r360210) +++ head/sys/dev/cxgbe/iw_cxgbe/provider.c Wed Apr 22 21:54:21 2020 (r360211) @@ -434,6 +434,9 @@ c4iw_register_device(struct c4iw_dev *dev) CTR3(KTR_IW_CXGBE, "%s c4iw_dev %p, adapter %p", __func__, dev, sc); BUG_ON(!sc->port[0]); + ret = linux_pci_attach_device(sc->dev, NULL, NULL, &dev->pdev); + if (ret) + return (ret); strlcpy(ibdev->name, device_get_nameunit(sc->dev), sizeof(ibdev->name)); memset(&ibdev->node_guid, 0, sizeof(ibdev->node_guid)); memcpy(&ibdev->node_guid, sc->port[0]->vi[0].hw_addr, ETHER_ADDR_LEN); @@ -465,7 +468,7 @@ c4iw_register_device(struct c4iw_dev *dev) strlcpy(ibdev->node_desc, C4IW_NODE_DESC, sizeof(ibdev->node_desc)); ibdev->phys_port_cnt = sc->params.nports; ibdev->num_comp_vectors = 1; - ibdev->dma_device = NULL; + ibdev->dma_device = &dev->pdev.dev; ibdev->query_device = c4iw_query_device; ibdev->query_port = c4iw_query_port; ibdev->modify_port = c4iw_modify_port; @@ -517,8 +520,10 @@ c4iw_register_device(struct c4iw_dev *dev) ibdev->iwcm = iwcm; ret = ib_register_device(&dev->ibdev, NULL); - if (ret) + if (ret) { kfree(iwcm); + linux_pci_detach_device(&dev->pdev); + } return (ret); } @@ -531,6 +536,7 @@ c4iw_unregister_device(struct c4iw_dev *dev) dev->rdev.adap); ib_unregister_device(&dev->ibdev); kfree(dev->ibdev.iwcm); + linux_pci_detach_device(&dev->pdev); return; } #endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r359952 - head/sys/dev/cxgbe/iw_cxgbe
Author: np Date: Wed Apr 15 03:40:33 2020 New Revision: 359952 URL: https://svnweb.freebsd.org/changeset/base/359952 Log: cxgbe/iw_cxgbe: Do not start the EP timer if soaccept fails. This fixes a panic that would occur when the timer tried to close a stale socket. Submitted by: Krishnamraju Eraparaju @ Chelsio MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c == --- head/sys/dev/cxgbe/iw_cxgbe/cm.cWed Apr 15 02:34:44 2020 (r359951) +++ head/sys/dev/cxgbe/iw_cxgbe/cm.cWed Apr 15 03:40:33 2020 (r359952) @@ -1013,7 +1013,6 @@ process_newconn(struct c4iw_listen_ep *master_lep, str c4iw_get_ep(&real_lep->com); init_timer(&new_ep->timer); new_ep->com.state = MPA_REQ_WAIT; - START_EP_TIMER(new_ep); setiwsockopt(new_so); ret = soaccept(new_so, (struct sockaddr **)&remote); @@ -1023,13 +1022,14 @@ process_newconn(struct c4iw_listen_ep *master_lep, str __func__, master_lep->com.so, new_so, ret); if (remote != NULL) free(remote, M_SONAME); - uninit_iwarp_socket(new_so); soclose(new_so); c4iw_put_ep(&new_ep->com); c4iw_put_ep(&real_lep->com); return; } free(remote, M_SONAME); + + START_EP_TIMER(new_ep); /* MPA request might have been queued up on the socket already, so we * initialize the socket/upcall_handler under lock to prevent processing ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r359897 - head/sys/dev/cxgbe/tom
Author: np Date: Mon Apr 13 20:12:47 2020 New Revision: 359897 URL: https://svnweb.freebsd.org/changeset/base/359897 Log: cxgbe(4): Make sure 'flags' is at the same offset in structs toepcb and synq_entry. TAILQ_ENTRY isn't always the same size as two pointers. Reported by: rmacklem@ MFC after:3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/tom/t4_tom.h == --- head/sys/dev/cxgbe/tom/t4_tom.h Mon Apr 13 20:00:44 2020 (r359896) +++ head/sys/dev/cxgbe/tom/t4_tom.h Mon Apr 13 20:12:47 2020 (r359897) @@ -176,11 +176,11 @@ struct ddp_pcb { }; struct toepcb { - TAILQ_ENTRY(toepcb) link; /* toep_list */ - u_int flags;/* miscellaneous flags */ - int refcount; struct tom_data *td; struct inpcb *inp; /* backpointer to host stack's PCB */ + u_int flags;/* miscellaneous flags */ + TAILQ_ENTRY(toepcb) link; /* toep_list */ + int refcount; struct vnet *vnet; struct vi_info *vi; /* virtual interface */ struct sge_wrq *ofld_txq; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r359159 - head/sys/dev/cxgbe
Author: np Date: Fri Mar 20 05:12:16 2020 New Revision: 359159 URL: https://svnweb.freebsd.org/changeset/base/359159 Log: cxgbe(4): Split sge_nm_rxq into three cachelines. This reduces the lines bouncing around between the driver rx ithread and the netmap rxsync thread. There is no net change in the size of the struct (it continues to waste a lot of space). This kind of split was originally proposed in D17869 by Marc De La Gueronniere @ Verisign, Inc. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hFri Mar 20 04:13:39 2020 (r359158) +++ head/sys/dev/cxgbe/adapter.hFri Mar 20 05:12:16 2020 (r359159) @@ -685,7 +685,9 @@ struct sge_wrq { #define INVALID_NM_RXQ_CNTXT_ID ((uint16_t)(-1)) struct sge_nm_rxq { - volatile int nm_state; /* NM_OFF, NM_ON, or NM_BUSY */ + /* Items used by the driver rx ithread are in this cacheline. */ + volatile int nm_state __aligned(CACHE_LINE_SIZE); /* NM_OFF, NM_ON, or NM_BUSY */ + u_int nid; /* netmap ring # for this queue */ struct vi_info *vi; struct iq_desc *iq_desc; @@ -694,20 +696,23 @@ struct sge_nm_rxq { uint16_t iq_cidx; uint16_t iq_sidx; uint8_t iq_gen; + uint32_t fl_sidx; - __be64 *fl_desc; + /* Items used by netmap rxsync are in this cacheline. */ + __be64 *fl_desc __aligned(CACHE_LINE_SIZE); uint16_t fl_cntxt_id; - uint32_t fl_cidx; uint32_t fl_pidx; - uint32_t fl_sidx; + uint32_t fl_sidx2; /* copy of fl_sidx */ uint32_t fl_db_val; + u_int fl_db_saved; u_int fl_hwidx:4; - u_int fl_db_saved; - u_int nid; /* netmap ring # for this queue */ + /* +* fl_cidx is used by both the ithread and rxsync, the rest are not used +* in the rx fast path. +*/ + uint32_t fl_cidx __aligned(CACHE_LINE_SIZE); - /* infrequently used items after this */ - bus_dma_tag_t iq_desc_tag; bus_dmamap_t iq_desc_map; bus_addr_t iq_ba; @@ -716,7 +721,7 @@ struct sge_nm_rxq { bus_dma_tag_t fl_desc_tag; bus_dmamap_t fl_desc_map; bus_addr_t fl_ba; -} __aligned(CACHE_LINE_SIZE); +}; #define INVALID_NM_TXQ_CNTXT_ID ((u_int)(-1)) struct sge_nm_txq { Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Fri Mar 20 04:13:39 2020 (r359158) +++ head/sys/dev/cxgbe/t4_netmap.c Fri Mar 20 05:12:16 2020 (r359159) @@ -921,7 +921,7 @@ cxgbe_netmap_rxsync(struct netmap_kring *kring, int fl MPASS((n & 7) == 0); IDXINCR(kring->nr_hwcur, n, kring->nkr_num_slots); - IDXINCR(nm_rxq->fl_pidx, n, nm_rxq->fl_sidx); + IDXINCR(nm_rxq->fl_pidx, n, nm_rxq->fl_sidx2); while (n > 0) { for (i = 0; i < 8; i++, fl_pidx++, slot++) { @@ -929,10 +929,10 @@ cxgbe_netmap_rxsync(struct netmap_kring *kring, int fl MPASS(ba != 0); nm_rxq->fl_desc[fl_pidx] = htobe64(ba | hwidx); slot->flags &= ~NS_BUF_CHANGED; - MPASS(fl_pidx <= nm_rxq->fl_sidx); + MPASS(fl_pidx <= nm_rxq->fl_sidx2); } n -= 8; - if (fl_pidx == nm_rxq->fl_sidx) { + if (fl_pidx == nm_rxq->fl_sidx2) { fl_pidx = 0; slot = &ring->slot[0]; } Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Fri Mar 20 04:13:39 2020(r359158) +++ head/sys/dev/cxgbe/t4_sge.c Fri Mar 20 05:12:16 2020(r359159) @@ -3655,6 +3655,7 @@ alloc_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm nm_rxq->iq_gen = F_RSPD_GEN; nm_rxq->fl_pidx = nm_rxq->fl_cidx = 0; nm_rxq->fl_sidx = na->num_rx_desc; + nm_rxq->fl_sidx2 = nm_rxq->fl_sidx; /* copy for rxsync cacheline */ nm_rxq->intr_idx = intr_idx; nm_rxq->iq_cntxt_id = INVALID_NM_RXQ_CNTXT_ID; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r359057 - head/sys/dev/pci
Author: np Date: Wed Mar 18 01:09:40 2020 New Revision: 359057 URL: https://svnweb.freebsd.org/changeset/base/359057 Log: Remove spurious warning about invalid VPD data. The warning used to be displayed for valid VPDs about 512B or above in size. Fix the size check and add a break while here so that the routine stops if if detects any problem. Tested with "pciconf -lV" Reviewed by: kib@, jhb@ MFC after:1 week Sponsored by: Chelsio Communications Differential Revision:https://reviews.freebsd.org/D23679 Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c == --- head/sys/dev/pci/pci.c Tue Mar 17 23:58:58 2020(r359056) +++ head/sys/dev/pci/pci.c Wed Mar 18 01:09:40 2020(r359057) @@ -1102,16 +1102,16 @@ pci_read_vpd(device_t pcib, pcicfgregs *cfg) break; } remain |= byte2 << 8; - if (remain > (0x7f*4 - vrs.off)) { - state = -1; - pci_printf(cfg, - "invalid VPD data, remain %#x\n", - remain); - } name = byte & 0x7f; } else { remain = byte & 0x7; name = (byte >> 3) & 0xf; + } + if (vrs.off + remain - vrs.bytesinval > 0x8000) { + pci_printf(cfg, + "VPD data overflow, remain %#x\n", remain); + state = -1; + break; } switch (name) { case 0x2: /* String */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358924 - head/sys/dev/cxgbe
Author: np Date: Fri Mar 13 00:12:15 2020 New Revision: 358924 URL: https://svnweb.freebsd.org/changeset/base/358924 Log: cxgbe(4): Do not display error messages related to the CLIP table if it's not in use by TOE or KTLS. Reviewed by: jhb@ MFC after:1 week Sponsored by: Chelsio Communications Differential Revision:https://reviews.freebsd.org/D24046 Modified: head/sys/dev/cxgbe/t4_clip.c Modified: head/sys/dev/cxgbe/t4_clip.c == --- head/sys/dev/cxgbe/t4_clip.cThu Mar 12 23:04:40 2020 (r358923) +++ head/sys/dev/cxgbe/t4_clip.cFri Mar 13 00:12:15 2020 (r358924) @@ -273,8 +273,12 @@ update_clip_table(struct adapter *sc) inet_ntop(AF_INET6, &ce->lip, &ip[0], sizeof(ip)); - log(LOG_ERR, "%s: could not add %s (%d)\n", - __func__, ip, rc); + if (sc->flags & KERN_TLS_OK || + sc->active_ulds != 0) { + log(LOG_ERR, + "%s: could not add %s (%d)\n", + __func__, ip, rc); + } free(ce, M_CXGBE); } next: ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358860 - head/sys/dev/cxgbe/tom
Author: np Date: Tue Mar 10 21:49:56 2020 New Revision: 358860 URL: https://svnweb.freebsd.org/changeset/base/358860 Log: cxgbe/t4_tom: The MSS in a FLOWC work request must not be 0. Submitted by: jhb@ MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c == --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Tue Mar 10 21:44:20 2020 (r358859) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Tue Mar 10 21:49:56 2020 (r358860) @@ -135,11 +135,12 @@ send_flowc_wr(struct toepcb *toep, struct tcpcb *tp) FLOWC_PARAM(PORT, pi->tx_chan); FLOWC_PARAM(IQID, toep->ofld_rxq->iq.abs_id); FLOWC_PARAM(SNDBUF, toep->params.sndbuf); - FLOWC_PARAM(MSS, toep->params.emss); if (tp) { + FLOWC_PARAM(MSS, toep->params.emss); FLOWC_PARAM(SNDNXT, tp->snd_nxt); FLOWC_PARAM(RCVNXT, tp->rcv_nxt); - } + } else + FLOWC_PARAM(MSS, 512); CTR6(KTR_CXGBE, "%s: tid %u, mss %u, sndbuf %u, snd_nxt 0x%x, rcv_nxt 0x%x", __func__, toep->tid, toep->params.emss, toep->params.sndbuf, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358859 - head/sys/dev/cxgbe
Author: np Date: Tue Mar 10 21:44:20 2020 New Revision: 358859 URL: https://svnweb.freebsd.org/changeset/base/358859 Log: cxgbe(4): Do not try to use 0 as an rx buffer address when the driver is already allocating from the safe zone and the allocation fails. This bug was introduced in r357481. MFC after:3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Tue Mar 10 20:30:21 2020(r358858) +++ head/sys/dev/cxgbe/t4_sge.c Tue Mar 10 21:44:20 2020(r358859) @@ -4382,10 +4382,12 @@ refill_fl(struct adapter *sc, struct sge_fl *fl, int n MPASS(sd->cl == NULL); rxb = &sc->sge.rx_buf_info[fl->zidx]; cl = uma_zalloc(rxb->zone, M_NOWAIT); - if (__predict_false(cl == NULL) && fl->zidx != fl->safe_zidx) { - rxb = &sc->sge.rx_buf_info[fl->safe_zidx]; - cl = uma_zalloc(rxb->zone, M_NOWAIT); - if (__predict_false(cl == NULL)) + if (__predict_false(cl == NULL)) { + if (fl->zidx != fl->safe_zidx) { + rxb = &sc->sge.rx_buf_info[fl->safe_zidx]; + cl = uma_zalloc(rxb->zone, M_NOWAIT); + } + if (cl == NULL) break; } fl->cl_allocated++; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358717 - head/sys/dev/cxgbe/tom
Author: np Date: Fri Mar 6 19:56:12 2020 New Revision: 358717 URL: https://svnweb.freebsd.org/changeset/base/358717 Log: cxgbe/t4_tom: Do not uninitialize a toepcb that has not been initialized. This fixes the following panic: --- trap 0xc, rip = 0x80c00411, rsp = 0xfe0025192840, rbp = 0xfe0025192860 --- vmem_xfree() at vmem_xfree+0xd1/frame 0xfe0025192860 tls_uninit_toep() at tls_uninit_toep+0x78/frame 0xfe0025192880 free_toepcb() at free_toepcb+0x32/frame 0xfe00251928a0 t4_connect() at t4_connect+0x3be/frame 0xfe0025192950 tcp_offload_connect() at tcp_offload_connect+0xa4/frame 0xfe0025192990 tcp_usr_connect() at tcp_usr_connect+0xec/frame 0xfe00251929f0 soconnect() at soconnect+0xae/frame 0xfe0025192a30 kern_connectat() at kern_connectat+0xe2/frame 0xfe0025192a90 sys_connect() at sys_connect+0x75/frame 0xfe0025192ad0 amd64_syscall() at amd64_syscall+0x137/frame 0xfe0025192bf0 fast_syscall_common() at fast_syscall_common+0x101/frame 0xfe0025192bf0 --- syscall (98, FreeBSD ELF64, sys_connect), rip = 0x8008e9d8a, rsp = 0x7fffc0f8, rbp = 0x7fffc130 --- Reviewed by: jhb@ MFC after:3 days Sponsored by: Chelsio Communications Differential Revision:https://reviews.freebsd.org/D23989 Modified: head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/tom/t4_tom.c == --- head/sys/dev/cxgbe/tom/t4_tom.c Fri Mar 6 19:10:00 2020 (r358716) +++ head/sys/dev/cxgbe/tom/t4_tom.c Fri Mar 6 19:56:12 2020 (r358717) @@ -187,6 +187,8 @@ init_toepcb(struct vi_info *vi, struct toepcb *toep) if (ulp_mode(toep) == ULP_MODE_TCPDDP) ddp_init_toep(toep); + toep->flags |= TPF_INITIALIZED; + return (0); } @@ -210,9 +212,11 @@ free_toepcb(struct toepcb *toep) KASSERT(!(toep->flags & TPF_CPL_PENDING), ("%s: CPL pending", __func__)); - if (ulp_mode(toep) == ULP_MODE_TCPDDP) - ddp_uninit_toep(toep); - tls_uninit_toep(toep); + if (toep->flags & TPF_INITIALIZED) { + if (ulp_mode(toep) == ULP_MODE_TCPDDP) + ddp_uninit_toep(toep); + tls_uninit_toep(toep); + } free(toep, M_CXGBE); } Modified: head/sys/dev/cxgbe/tom/t4_tom.h == --- head/sys/dev/cxgbe/tom/t4_tom.h Fri Mar 6 19:10:00 2020 (r358716) +++ head/sys/dev/cxgbe/tom/t4_tom.h Fri Mar 6 19:56:12 2020 (r358717) @@ -73,6 +73,7 @@ enum { TPF_SYNQE_EXPANDED = (1 << 9), /* toepcb ready, tid context updated */ TPF_FORCE_CREDITS = (1 << 10), /* always send credits */ TPF_KTLS = (1 << 11), /* send TLS records from KTLS */ + TPF_INITIALIZED= (1 << 12), /* init_toepcb has been called */ }; enum { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358086 - in head/sys/dev/cxgbe: . common
Author: np Date: Wed Feb 19 00:48:58 2020 New Revision: 358086 URL: https://svnweb.freebsd.org/changeset/base/358086 Log: cxgbe(4): Congestion drops are maintained per E-channel and not per buffer group. This fixes a bug where congestion drops on port 1 of a T6 card would incorrectly be counted as drops on port 0. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/common/t4_hw.c == --- head/sys/dev/cxgbe/common/t4_hw.c Tue Feb 18 23:56:23 2020 (r358085) +++ head/sys/dev/cxgbe/common/t4_hw.c Wed Feb 19 00:48:58 2020 (r358086) @@ -6781,9 +6781,10 @@ static unsigned int t4_get_mps_bg_map(struct adapter * static unsigned int t4_get_rx_e_chan_map(struct adapter *adap, int idx) { u32 n = G_NUMPORTS(t4_read_reg(adap, A_MPS_CMN_CTL)); + const u32 all_chan = (1 << adap->chip_params->nchan) - 1; if (n == 0) - return idx == 0 ? 0xf : 0; + return idx == 0 ? all_chan : 0; if (n == 1 && chip_id(adap) <= CHELSIO_T5) return idx < 2 ? (3 << (2 * idx)) : 0; return 1 << idx; Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cTue Feb 18 23:56:23 2020 (r358085) +++ head/sys/dev/cxgbe/t4_main.cWed Feb 19 00:48:58 2020 (r358086) @@ -6137,7 +6137,7 @@ vi_refresh_stats(struct adapter *sc, struct vi_info *v static void cxgbe_refresh_stats(struct adapter *sc, struct port_info *pi) { - u_int i, v, tnl_cong_drops, bg_map; + u_int i, v, tnl_cong_drops, chan_map; struct timeval tv; const struct timeval interval = {0, 25};/* 250ms */ @@ -6148,15 +6148,15 @@ cxgbe_refresh_stats(struct adapter *sc, struct port_in tnl_cong_drops = 0; t4_get_port_stats(sc, pi->tx_chan, &pi->stats); - bg_map = pi->mps_bg_map; - while (bg_map) { - i = ffs(bg_map) - 1; + chan_map = pi->rx_e_chan_map; + while (chan_map) { + i = ffs(chan_map) - 1; mtx_lock(&sc->reg_lock); t4_read_indirect(sc, A_TP_MIB_INDEX, A_TP_MIB_DATA, &v, 1, A_TP_MIB_TNL_CNG_DROP_0 + i); mtx_unlock(&sc->reg_lock); tnl_cong_drops += v; - bg_map &= ~(1 << i); + chan_map &= ~(1 << i); } pi->tnl_cong_drops = tnl_cong_drops; getmicrotime(&pi->last_refreshed); @@ -10292,7 +10292,7 @@ read_i2c(struct adapter *sc, struct t4_i2c_data *i2cd) static int clear_stats(struct adapter *sc, u_int port_id) { - int i, v, bg_map; + int i, v, chan_map; struct port_info *pi; struct vi_info *vi; struct sge_rxq *rxq; @@ -10317,13 +10317,13 @@ clear_stats(struct adapter *sc, u_int port_id) if (vi->flags & VI_INIT_DONE) t4_clr_vi_stats(sc, vi->vin); } - bg_map = pi->mps_bg_map; + chan_map = pi->rx_e_chan_map; v = 0; /* reuse */ - while (bg_map) { - i = ffs(bg_map) - 1; + while (chan_map) { + i = ffs(chan_map) - 1; t4_write_indirect(sc, A_TP_MIB_INDEX, A_TP_MIB_DATA, &v, 1, A_TP_MIB_TNL_CNG_DROP_0 + i); - bg_map &= ~(1 << i); + chan_map &= ~(1 << i); } mtx_unlock(&sc->reg_lock); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358082 - head/sys/dev/cxgbe/iw_cxgbe
Author: np Date: Tue Feb 18 20:43:10 2020 New Revision: 358082 URL: https://svnweb.freebsd.org/changeset/base/358082 Log: cxgbe/iw_cxgbe: correctly enforce the max reg_mr depth. Reported by: Andrew Zhu @ Netapp Obtained from:Chelsio Communications MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/iw_cxgbe/mem.c Modified: head/sys/dev/cxgbe/iw_cxgbe/mem.c == --- head/sys/dev/cxgbe/iw_cxgbe/mem.c Tue Feb 18 19:53:36 2020 (r358081) +++ head/sys/dev/cxgbe/iw_cxgbe/mem.c Tue Feb 18 20:43:10 2020 (r358082) @@ -682,7 +682,7 @@ static int c4iw_set_page(struct ib_mr *ibmr, u64 addr) { struct c4iw_mr *mhp = to_c4iw_mr(ibmr); - if (unlikely(mhp->mpl_len == mhp->max_mpl_len)) + if (unlikely(mhp->mpl_len == mhp->attr.pbl_size)) return -ENOMEM; mhp->mpl[mhp->mpl_len++] = addr; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357793 - in head/sys: conf dev/cxgbe/firmware modules/cxgbe/t4_firmware modules/cxgbe/t5_firmware modules/cxgbe/t6_firmware
Author: np Date: Wed Feb 12 02:55:06 2020 New Revision: 357793 URL: https://svnweb.freebsd.org/changeset/base/357793 Log: cxgbe(4): Update T4/5/6 firmwares to 1.24.12.0. Obtained from:Chelsio Communications MFC after:1 month Sponsored by: Chelsio Communications Added: head/sys/dev/cxgbe/firmware/t4fw-1.24.12.0.bin (contents, props changed) head/sys/dev/cxgbe/firmware/t5fw-1.24.12.0.bin (contents, props changed) head/sys/dev/cxgbe/firmware/t6fw-1.24.12.0.bin (contents, props changed) Deleted: head/sys/dev/cxgbe/firmware/t4fw-1.24.11.0.bin head/sys/dev/cxgbe/firmware/t5fw-1.24.11.0.bin head/sys/dev/cxgbe/firmware/t6fw-1.24.11.0.bin Modified: head/sys/conf/files head/sys/dev/cxgbe/firmware/t4fw_interface.h head/sys/modules/cxgbe/t4_firmware/Makefile head/sys/modules/cxgbe/t5_firmware/Makefile head/sys/modules/cxgbe/t6_firmware/Makefile Modified: head/sys/conf/files == --- head/sys/conf/files Wed Feb 12 02:17:20 2020(r357792) +++ head/sys/conf/files Wed Feb 12 02:55:06 2020(r357793) @@ -1473,7 +1473,7 @@ t4fw.fwo optional cxgbe \ no-implicit-rule\ clean "t4fw.fwo" t4fw.fwoptional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t4fw-1.24.11.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t4fw-1.24.12.0.bin" \ compile-with"${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t4fw.fw" @@ -1507,7 +1507,7 @@ t5fw.fwo optional cxgbe \ no-implicit-rule\ clean "t5fw.fwo" t5fw.fwoptional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t5fw-1.24.11.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t5fw-1.24.12.0.bin" \ compile-with"${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t5fw.fw" @@ -1541,7 +1541,7 @@ t6fw.fwo optional cxgbe \ no-implicit-rule\ clean "t6fw.fwo" t6fw.fwoptional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t6fw-1.24.11.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t6fw-1.24.12.0.bin" \ compile-with"${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t6fw.fw" Added: head/sys/dev/cxgbe/firmware/t4fw-1.24.12.0.bin == Binary file. No diff available. Modified: head/sys/dev/cxgbe/firmware/t4fw_interface.h == --- head/sys/dev/cxgbe/firmware/t4fw_interface.hWed Feb 12 02:17:20 2020(r357792) +++ head/sys/dev/cxgbe/firmware/t4fw_interface.hWed Feb 12 02:55:06 2020(r357793) @@ -9940,17 +9940,17 @@ enum fw_hdr_chip { enum { T4FW_VERSION_MAJOR = 1, T4FW_VERSION_MINOR = 24, - T4FW_VERSION_MICRO = 11, + T4FW_VERSION_MICRO = 12, T4FW_VERSION_BUILD = 0, T5FW_VERSION_MAJOR = 1, T5FW_VERSION_MINOR = 24, - T5FW_VERSION_MICRO = 11, + T5FW_VERSION_MICRO = 12, T5FW_VERSION_BUILD = 0, T6FW_VERSION_MAJOR = 1, T6FW_VERSION_MINOR = 24, - T6FW_VERSION_MICRO = 11, + T6FW_VERSION_MICRO = 12, T6FW_VERSION_BUILD = 0, }; Added: head/sys/dev/cxgbe/firmware/t5fw-1.24.12.0.bin == Binary file. No diff available. Added: head/sys/dev/cxgbe/firmware/t6fw-1.24.12.0.bin == Binary file. No diff available. Modified: head/sys/modules/cxgbe/t4_firmware/Makefile == --- head/sys/modules/cxgbe/t4_firmware/Makefile Wed Feb 12 02:17:20 2020 (r357792) +++ head/sys/modules/cxgbe/t4_firmware/Makefile Wed Feb 12 02:55:06 2020 (r357793) @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T4FW_VER= 1.24.11.0 +T4FW_VER= 1.24.12.0 FIRMWS+= t4fw-${T4FW_VER}.bin:t4fw:${T4FW_VER} .include Modified: head/sys/modules/cxgbe/t5_firmware/Makef
Re: svn commit: r357553 - head/sys/dev/cxgbe
On 2/5/20 3:19 AM, Slawa Olhovchenkov wrote: > On Wed, Feb 05, 2020 at 12:13:15AM +0000, Navdeep Parhar wrote: > >> Author: np >> Date: Wed Feb 5 00:13:15 2020 >> New Revision: 357553 >> URL: https://svnweb.freebsd.org/changeset/base/357553 >> >> Log: >> cxgbe(4): Add a knob to allow netmap tx traffic to be checksummed by >> the hardware. >> >> hw.cxgbe.nm_txcsum=1 > > Very interesting. > Please, describe some more detail about using this feture (for > example, set this before driver loading? first netmap open? any netmap > open? on the fly?) > If you set this to 1 then all netmap Tx traffic that is recognized as valid TCP/UDP on IP/IPv6 by the chip will get L3 and L4 checksums inserted in proper places automatically. This means a netmap application trying to send legitimate traffic doesn't have to calculate checksums in software. It is safe to change this at any time and it will take effect immediately. netmap(4) says that hw checksum should be disabled on the interface but cxgbe has always had a way to bypass this. It used to be via the normal csum capabilities of the interface but those sometimes caused confusion because they aren't supposed to be set with netmap so r355673 removed netmap tx checksumming. This rev brought it back with a driver-specific knob. Regards, Navdeep ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357606 - head/sys/dev/cxgbe
Author: np Date: Wed Feb 5 22:29:01 2020 New Revision: 357606 URL: https://svnweb.freebsd.org/changeset/base/357606 Log: cxgbe(4): Add native netmap support to the main interface. This means that extra virtual interfaces (VIs) created with hw.cxgbe.num_vis are no longer required to use netmap. Use this tunable to enable native netmap support on the main interface: hw.cxgbe.native_netmap="3" There is no change in default behavior. Suggested by: jch@ MFC after:2 weeks Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cWed Feb 5 21:30:31 2020 (r357605) +++ head/sys/dev/cxgbe/t4_main.cWed Feb 5 22:29:01 2020 (r357606) @@ -401,6 +401,22 @@ SYSCTL_INT(_hw_cxgbe_toe_rexmt_backoff, OID_AUTO, 15, #endif #ifdef DEV_NETMAP +#define NN_MAIN_VI (1 << 0)/* Native netmap on the main VI */ +#define NN_EXTRA_VI(1 << 1)/* Native netmap on the extra VI(s) */ +static int t4_native_netmap = NN_EXTRA_VI; +SYSCTL_INT(_hw_cxgbe, OID_AUTO, native_netmap, CTLFLAG_RDTUN, &t4_native_netmap, +0, "Native netmap support. bit 0 = main VI, bit 1 = extra VIs"); + +#define NNMTXQ 8 +static int t4_nnmtxq = -NNMTXQ; +SYSCTL_INT(_hw_cxgbe, OID_AUTO, nnmtxq, CTLFLAG_RDTUN, &t4_nnmtxq, 0, +"Number of netmap TX queues"); + +#define NNMRXQ 8 +static int t4_nnmrxq = -NNMRXQ; +SYSCTL_INT(_hw_cxgbe, OID_AUTO, nnmrxq, CTLFLAG_RDTUN, &t4_nnmrxq, 0, +"Number of netmap RX queues"); + #define NNMTXQ_VI 2 static int t4_nnmtxq_vi = -NNMTXQ_VI; SYSCTL_INT(_hw_cxgbe, OID_AUTO, nnmtxq_vi, CTLFLAG_RDTUN, &t4_nnmtxq_vi, 0, @@ -621,6 +637,8 @@ struct intrs_and_queues { uint16_t nrxq; /* # of NIC rxq's for each port */ uint16_t nofldtxq; /* # of TOE/ETHOFLD txq's for each port */ uint16_t nofldrxq; /* # of TOE rxq's for each port */ + uint16_t nnmtxq;/* # of netmap txq's */ + uint16_t nnmrxq;/* # of netmap rxq's */ /* The vcxgbe/vcxl interfaces use these and not the ones above. */ uint16_t ntxq_vi; /* # of NIC txq's */ @@ -1247,10 +1265,16 @@ t4_attach(device_t dev) } #endif #ifdef DEV_NETMAP - if (num_vis > 1) { - s->nnmrxq = nports * (num_vis - 1) * iaq.nnmrxq_vi; - s->nnmtxq = nports * (num_vis - 1) * iaq.nnmtxq_vi; + s->nnmrxq = 0; + s->nnmtxq = 0; + if (t4_native_netmap & NN_MAIN_VI) { + s->nnmrxq += nports * iaq.nnmrxq; + s->nnmtxq += nports * iaq.nnmtxq; } + if (num_vis > 1 && t4_native_netmap & NN_EXTRA_VI) { + s->nnmrxq += nports * (num_vis - 1) * iaq.nnmrxq_vi; + s->nnmtxq += nports * (num_vis - 1) * iaq.nnmtxq_vi; + } s->neq += s->nnmtxq + s->nnmrxq; s->niq += s->nnmrxq; @@ -1344,14 +1368,17 @@ t4_attach(device_t dev) ofld_rqidx += vi->nofldrxq; #endif #ifdef DEV_NETMAP - if (j > 0) { - vi->first_nm_rxq = nm_rqidx; - vi->first_nm_txq = nm_tqidx; + vi->first_nm_rxq = nm_rqidx; + vi->first_nm_txq = nm_tqidx; + if (j == 0) { + vi->nnmrxq = iaq.nnmrxq; + vi->nnmtxq = iaq.nnmtxq; + } else { vi->nnmrxq = iaq.nnmrxq_vi; vi->nnmtxq = iaq.nnmtxq_vi; - nm_rqidx += vi->nnmrxq; - nm_tqidx += vi->nnmtxq; } + nm_rqidx += vi->nnmrxq; + nm_tqidx += vi->nnmtxq; #endif } } @@ -3316,10 +3343,10 @@ fixup_devlog_params(struct adapter *sc) static void update_nirq(struct intrs_and_queues *iaq, int nports) { - int extra = T4_EXTRA_INTR; - iaq->nirq = extra; - iaq->nirq += nports * (iaq->nrxq + iaq->nofldrxq); + iaq->nirq = T4_EXTRA_INTR; + iaq->nirq += nports * max(iaq->nrxq, iaq->nnmrxq); + iaq->nirq += nports * iaq->nofldrxq; iaq->nirq += nports * (iaq->num_vis - 1) * max(iaq->nrxq_vi, iaq->nnmrxq_vi); iaq->nirq += nports * (iaq->num_vis - 1) * iaq->nofldrxq_vi; @@ -3358,8 +3385,14 @@ calculate_iaq(struct adapter *sc, struct intrs_and_que } #endif #ifdef DEV_NETMAP - iaq->nnmtxq_vi = t4_nnmtxq_vi; - iaq->nnmrxq_vi = t4_nnmrxq_vi; + if (t4_native_netmap & NN_MAIN_VI) { + iaq->nnmtxq = t4_nnmtxq; + iaq->nnmrxq = t4_nnmrxq; + } + if (t4_native_netmap & NN_EXTRA_VI) { + iaq->nnmtxq_vi = t4_nnmtxq_vi; + iaq->nnmrxq_vi
svn commit: r357553 - head/sys/dev/cxgbe
Author: np Date: Wed Feb 5 00:13:15 2020 New Revision: 357553 URL: https://svnweb.freebsd.org/changeset/base/357553 Log: cxgbe(4): Add a knob to allow netmap tx traffic to be checksummed by the hardware. hw.cxgbe.nm_txcsum=1 MFC after:2 weeks Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_netmap.c Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Wed Feb 5 00:08:58 2020 (r357552) +++ head/sys/dev/cxgbe/t4_netmap.c Wed Feb 5 00:13:15 2020 (r357553) @@ -110,6 +110,16 @@ static int nm_split_rss = 0; SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_split_rss, CTLFLAG_RWTUN, &nm_split_rss, 0, "Split the netmap rx queues into two groups."); +/* + * netmap(4) says "netmap does not use features such as checksum offloading, TCP + * segmentation offloading, encryption, VLAN encapsulation/decapsulation, etc." + * but this knob can be used to get the hardware to checksum all tx traffic + * anyway. + */ +static int nm_txcsum = 0; +SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_txcsum, CTLFLAG_RWTUN, +&nm_txcsum, 0, "Enable transmit checksum offloading."); + static int alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int cong) { @@ -696,13 +706,8 @@ cxgbe_nm_tx(struct adapter *sc, struct sge_nm_txq *nm_ cpl->ctrl0 = nm_txq->cpl_ctrl0; cpl->pack = 0; cpl->len = htobe16(slot->len); - /* -* netmap(4) says "netmap does not use features such as -* checksum offloading, TCP segmentation offloading, -* encryption, VLAN encapsulation/decapsulation, etc." -*/ - cpl->ctrl1 = htobe64(F_TXPKT_IPCSUM_DIS | - F_TXPKT_L4CSUM_DIS); + cpl->ctrl1 = nm_txcsum ? 0 : + htobe64(F_TXPKT_IPCSUM_DIS | F_TXPKT_L4CSUM_DIS); usgl = (void *)(cpl + 1); usgl->cmd_nsge = htobe32(V_ULPTX_CMD(ULP_TX_SC_DSGL) | ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357552 - head/sys/dev/cxgbe
Author: np Date: Wed Feb 5 00:08:58 2020 New Revision: 357552 URL: https://svnweb.freebsd.org/changeset/base/357552 Log: cxgbe(4): Allow nm_black_hole and nm_cong_drop to be set at any time. The cong_drop setting will apply to queues created after the setting is changed and not to existing queues. MFC after:2 weeks Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_netmap.c Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Tue Feb 4 23:55:21 2020 (r357551) +++ head/sys/dev/cxgbe/t4_netmap.c Wed Feb 5 00:08:58 2020 (r357552) @@ -63,7 +63,7 @@ extern int fl_pad;/* XXXNM */ * 2 = supermassive black hole (buffer packing enabled) */ int black_hole = 0; -SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_black_hole, CTLFLAG_RDTUN, &black_hole, 0, +SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_black_hole, CTLFLAG_RWTUN, &black_hole, 0, "Sink incoming packets."); int rx_ndesc = 256; @@ -85,7 +85,7 @@ SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_holdoff_tmr_idx, CT * 1: no backpressure, drop packets for the congested queue immediately. */ static int nm_cong_drop = 1; -SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_cong_drop, CTLFLAG_RDTUN, +SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_cong_drop, CTLFLAG_RWTUN, &nm_cong_drop, 0, "Congestion control for netmap rx queues (0 = backpressure, 1 = drop"); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357551 - head/sys/dev/cxgbe
Author: np Date: Tue Feb 4 23:55:21 2020 New Revision: 357551 URL: https://svnweb.freebsd.org/changeset/base/357551 Log: cxgbe(4): Report accurate rx_buf_maxsize to netmap. MFC after:2 weeks Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_netmap.c Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Tue Feb 4 22:40:45 2020 (r357550) +++ head/sys/dev/cxgbe/t4_netmap.c Tue Feb 4 23:55:21 2020 (r357551) @@ -991,6 +991,7 @@ cxgbe_nm_attach(struct vi_info *vi) na.nm_register = cxgbe_netmap_reg; na.num_tx_rings = vi->nnmtxq; na.num_rx_rings = vi->nnmrxq; + na.rx_buf_maxsize = MAX_MTU; netmap_attach(&na); /* This adds IFCAP_NETMAP to if_capabilities */ } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357483 - head/sys/dev/cxgbe
Author: np Date: Tue Feb 4 01:09:02 2020 New Revision: 357483 URL: https://svnweb.freebsd.org/changeset/base/357483 Log: cxgbe(4): Add pfil(9) hooks to the driver's rx. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hTue Feb 4 01:01:35 2020 (r357482) +++ head/sys/dev/cxgbe/adapter.hTue Feb 4 01:09:02 2020 (r357483) @@ -54,6 +54,7 @@ #include #include #include +#include #include #include @@ -191,6 +192,7 @@ struct vi_info { struct port_info *pi; struct ifnet *ifp; + struct pfil_head *pfil; unsigned long flags; int if_flags; Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cTue Feb 4 01:01:35 2020 (r357482) +++ head/sys/dev/cxgbe/t4_main.cTue Feb 4 01:09:02 2020 (r357483) @@ -1673,6 +1673,7 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi) { struct ifnet *ifp; struct sbuf *sb; + struct pfil_head_args pa; vi->xact_addr_filt = -1; callout_init(&vi->tick, 1); @@ -1768,6 +1769,12 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi) vi_sysctls(vi); + pa.pa_version = PFIL_VERSION; + pa.pa_flags = PFIL_IN; + pa.pa_type = PFIL_TYPE_ETHERNET; + pa.pa_headname = ifp->if_xname; + vi->pfil = pfil_head_register(&pa); + return (0); } @@ -1807,6 +1814,11 @@ static void cxgbe_vi_detach(struct vi_info *vi) { struct ifnet *ifp = vi->ifp; + + if (vi->pfil != NULL) { + pfil_head_unregister(vi->pfil); + vi->pfil = NULL; + } ether_ifdetach(ifp); Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Tue Feb 4 01:01:35 2020(r357482) +++ head/sys/dev/cxgbe/t4_sge.c Tue Feb 4 01:09:02 2020(r357483) @@ -1851,12 +1851,73 @@ get_segment: } static int +skip_scatter_segment(struct adapter *sc, struct sge_fl *fl, int fr_offset, +int remaining) +{ + struct fl_sdesc *sd = &fl->sdesc[fl->cidx]; + struct rx_buf_info *rxb = &sc->sge.rx_buf_info[sd->zidx]; + int len, blen; + + if (fl->flags & FL_BUF_PACKING) { + u_int l, pad; + + blen = rxb->size2 - fl->rx_offset; /* max possible in this buf */ + len = min(remaining, blen); + + l = fr_offset + len; + pad = roundup2(l, fl->buf_boundary) - l; + if (fl->rx_offset + len + pad < rxb->size2) + blen = len + pad; + fl->rx_offset += blen; + MPASS(fl->rx_offset <= rxb->size2); + if (fl->rx_offset < rxb->size2) + return (len); /* without advancing the cidx */ + } else { + MPASS(fl->rx_offset == 0); /* not packing */ + blen = rxb->size1; + len = min(remaining, blen); + } + move_to_next_rxbuf(fl); + return (len); +} + +static inline void +skip_fl_payload(struct adapter *sc, struct sge_fl *fl, int plen) +{ + int remaining, fr_offset, len; + + fr_offset = 0; + remaining = plen; + while (remaining > 0) { + len = skip_scatter_segment(sc, fl, fr_offset, remaining); + fr_offset += len; + remaining -= len; + } +} + +static inline int +get_segment_len(struct adapter *sc, struct sge_fl *fl, int plen) +{ + int len; + struct fl_sdesc *sd = &fl->sdesc[fl->cidx]; + struct rx_buf_info *rxb = &sc->sge.rx_buf_info[sd->zidx]; + + if (fl->flags & FL_BUF_PACKING) + len = rxb->size2 - fl->rx_offset; + else + len = rxb->size1; + + return (min(plen, len)); +} + +static int eth_rx(struct adapter *sc, struct sge_rxq *rxq, const struct iq_desc *d, u_int plen) { struct mbuf *m0; struct ifnet *ifp = rxq->ifp; struct sge_fl *fl = &rxq->fl; + struct vi_info *vi = ifp->if_softc; const struct cpl_rx_pkt *cpl; #if defined(INET) || defined(INET6) struct lro_ctrl *lro = &rxq->lro; @@ -1869,6 +1930,30 @@ eth_rx(struct adapter *sc, struct sge_rxq *rxq, const }; MPASS(plen > sc->params.sge.fl_pktshift); + if (vi->pfil != NULL && PFIL_HOOKED_IN(vi->pfil) && + __predict_true((fl->flags & FL_BUF_RESUME) == 0)) { + struct fl_sdesc *sd = &fl->sdesc[fl->cidx]; + caddr_t frame; + int rc, slen; + + slen = get_segment_len(sc, fl, plen) - +
svn commit: r357482 - head/sys/dev/cxgbe
Author: np Date: Tue Feb 4 01:01:35 2020 New Revision: 357482 URL: https://svnweb.freebsd.org/changeset/base/357482 Log: cxgbe(4): Treat NIC rx as special and run its handler directly and not via the t4_cpl_handler dispatch table. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Tue Feb 4 00:51:10 2020(r357481) +++ head/sys/dev/cxgbe/t4_sge.c Tue Feb 4 01:01:35 2020(r357482) @@ -219,7 +219,8 @@ struct sgl { static int service_iq(struct sge_iq *, int); static int service_iq_fl(struct sge_iq *, int); static struct mbuf *get_fl_payload(struct adapter *, struct sge_fl *, uint32_t); -static int t4_eth_rx(struct sge_iq *, const struct rss_header *, struct mbuf *); +static int eth_rx(struct adapter *, struct sge_rxq *, const struct iq_desc *, +u_int); static inline void init_iq(struct sge_iq *, struct adapter *, int, int, int); static inline void init_fl(struct adapter *, struct sge_fl *, int, int, char *); static inline void init_eq(struct adapter *, struct sge_eq *, int, int, uint8_t, @@ -550,7 +551,6 @@ t4_sge_modload(void) t4_register_cpl_handler(CPL_FW4_MSG, handle_fw_msg); t4_register_cpl_handler(CPL_FW6_MSG, handle_fw_msg); t4_register_cpl_handler(CPL_SGE_EGR_UPDATE, handle_sge_egr_update); - t4_register_cpl_handler(CPL_RX_PKT, t4_eth_rx); #ifdef RATELIMIT t4_register_shared_cpl_handler(CPL_FW4_ACK, ethofld_fw4_ack, CPL_COOKIE_ETHOFLD); @@ -1611,25 +1611,15 @@ service_iq_fl(struct sge_iq *iq, int budget) fl_hw_cidx = fl->hw_cidx; } + if (d->rss.opcode == CPL_RX_PKT) { + if (__predict_true(eth_rx(sc, rxq, d, lq) == 0)) + break; + goto out; + } m0 = get_fl_payload(sc, fl, lq); if (__predict_false(m0 == NULL)) goto out; - if (iq->flags & IQ_RX_TIMESTAMP) { - /* -* Fill up rcv_tstmp but do not set M_TSTMP. -* rcv_tstmp is not in the format that the -* kernel expects and we don't want to mislead -* it. For now this is only for custom code -* that knows how to interpret cxgbe's stamp. -*/ - m0->m_pkthdr.rcv_tstmp = - last_flit_to_ns(sc, d->rsp.u.last_flit); -#ifdef notyet - m0->m_flags |= M_TSTMP; -#endif - } - /* fall through */ case X_RSPD_TYPE_CPL: @@ -1861,12 +1851,13 @@ get_segment: } static int -t4_eth_rx(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m0) +eth_rx(struct adapter *sc, struct sge_rxq *rxq, const struct iq_desc *d, +u_int plen) { - struct sge_rxq *rxq = iq_to_rxq(iq); + struct mbuf *m0; struct ifnet *ifp = rxq->ifp; - struct adapter *sc = iq->adapter; - const struct cpl_rx_pkt *cpl = (const void *)(rss + 1); + struct sge_fl *fl = &rxq->fl; + const struct cpl_rx_pkt *cpl; #if defined(INET) || defined(INET6) struct lro_ctrl *lro = &rxq->lro; #endif @@ -1877,17 +1868,20 @@ t4_eth_rx(struct sge_iq *iq, const struct rss_header * {M_HASHTYPE_RSS_UDP_IPV4, M_HASHTYPE_RSS_UDP_IPV6}, }; - KASSERT(m0 != NULL, ("%s: no payload with opcode %02x", __func__, - rss->opcode)); + MPASS(plen > sc->params.sge.fl_pktshift); + m0 = get_fl_payload(sc, fl, plen); + if (__predict_false(m0 == NULL)) + return (ENOMEM); m0->m_pkthdr.len -= sc->params.sge.fl_pktshift; m0->m_len -= sc->params.sge.fl_pktshift; m0->m_data += sc->params.sge.fl_pktshift; m0->m_pkthdr.rcvif = ifp; - M_HASHTYPE_SET(m0, sw_hashtype[rss->hash_type][rss->ipv6]); - m0->m_pkthdr.flowid = be32toh(rss->hash_val); + M_HASHTYPE_SET(m0, sw_hashtype[d->rss.hash_type][d->rss.ipv6]); + m0->m_pkthdr.flowid = be32toh(d->rss.hash_val); + cpl = (const void *)(&d->rss + 1); if (cpl->csum_calc && !(cpl->err_vec & sc->params.tp.err_vec_mask)) { if (ifp->if_capenable & IFCAP_RXCSUM && cpl->l2info & htobe32(F_RXF_IP)) { @@ -1913,11 +1907,26 @@ t4_eth_rx(struct sge_iq *iq, const struct rss_header * rxq->vlan_extraction++; } + if (rxq->iq.flags & IQ_RX_TIMESTAMP) { + /* +* Fill up rcv_t
svn commit: r357481 - in head: share/man/man4 sys/dev/cxgbe
Author: np Date: Tue Feb 4 00:51:10 2020 New Revision: 357481 URL: https://svnweb.freebsd.org/changeset/base/357481 Log: cxgbe(4): Retire the allow_mbufs_in_cluster optimization. This simplifies the driver's rx fast path as well as the bookkeeping code that tracks various rx buffer sizes and layouts. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/share/man/man4/cxgbe.4 head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/cxgbe/t4_sge.c Modified: head/share/man/man4/cxgbe.4 == --- head/share/man/man4/cxgbe.4 Tue Feb 4 00:06:16 2020(r357480) +++ head/share/man/man4/cxgbe.4 Tue Feb 4 00:51:10 2020(r357481) @@ -317,11 +317,6 @@ Allow the hardware to deliver multiple frames in the s opportunistically. The default is -1 which lets the driver decide. 0 or 1 explicitly disable or enable this feature. -.It Va hw.cxgbe.allow_mbufs_in_cluster -1 allows the driver to lay down one or more mbufs within the receive buffer -opportunistically. -This is the default. -0 prohibits the driver from doing so. .It Va hw.cxgbe.largest_rx_cluster .It Va hw.cxgbe.safest_rx_cluster Sizes of rx clusters. Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hTue Feb 4 00:06:16 2020 (r357480) +++ head/sys/dev/cxgbe/adapter.hTue Feb 4 00:51:10 2020 (r357481) @@ -316,15 +316,6 @@ struct port_info { #defineIS_MAIN_VI(vi) ((vi) == &((vi)->pi->vi[0])) -/* Where the cluster came from, how it has been carved up. */ -struct cluster_layout { - int8_t zidx; - int8_t hwidx; - uint16_t region1; /* mbufs laid out within this region */ - /* region2 is the DMA region */ - uint16_t region3; /* cluster_metadata within this region */ -}; - struct cluster_metadata { uma_zone_t zone; caddr_t cl; @@ -334,7 +325,8 @@ struct cluster_metadata { struct fl_sdesc { caddr_t cl; uint16_t nmbuf; /* # of driver originated mbufs with ref on cluster */ - struct cluster_layout cll; + int16_t moff; /* offset of metadata from cl */ + uint8_t zidx; }; struct tx_desc { @@ -466,20 +458,17 @@ struct sge_eq { char lockname[16]; }; -struct sw_zone_info { +struct rx_buf_info { uma_zone_t zone;/* zone that this cluster comes from */ - int size; /* size of cluster: 2K, 4K, 9K, 16K, etc. */ - int type; /* EXT_xxx type of the cluster */ - int8_t head_hwidx; - int8_t tail_hwidx; + uint16_t size1; /* same as size of cluster: 2K/4K/9K/16K. +* hwsize[hwidx1] = size1. No spare. */ + uint16_t size2; /* hwsize[hwidx2] = size2. +* spare in cluster = size1 - size2. */ + int8_t hwidx1; /* SGE bufsize idx for size1 */ + int8_t hwidx2; /* SGE bufsize idx for size2 */ + uint8_t type; /* EXT_xxx type of the cluster */ }; -struct hw_buf_info { - int8_t zidx;/* backpointer to zone; -ve means unused */ - int8_t next;/* next hwidx for this zone; -1 means no more */ - int size; -}; - enum { NUM_MEMWIN = 3, @@ -519,7 +508,8 @@ struct sge_fl { struct mtx fl_lock; __be64 *desc; /* KVA of descriptor ring, ptr to addresses */ struct fl_sdesc *sdesc; /* KVA of software descriptor ring */ - struct cluster_layout cll_def; /* default refill zone, layout */ + uint16_t zidx; /* refill zone idx */ + uint16_t safe_zidx; uint16_t lowat; /* # of buffers <= this means fl needs help */ int flags; uint16_t buf_boundary; @@ -537,8 +527,6 @@ struct sge_fl { u_int rx_offset;/* offset in fl buf (when buffer packing) */ volatile uint32_t *udb; - uint64_t mbuf_allocated;/* # of mbuf allocated from zone_mbuf */ - uint64_t mbuf_inlined; /* # of mbuf created within clusters */ uint64_t cl_allocated; /* # of clusters allocated */ uint64_t cl_recycled; /* # of clusters recycled */ uint64_t cl_fast_recycled; /* # of clusters recycled (fast) */ @@ -555,7 +543,6 @@ struct sge_fl { bus_dmamap_t desc_map; char lockname[16]; bus_addr_t ba; /* bus address of descriptor ring */ - struct cluster_layout cll_alt; /* alternate refill zone, layout */ }; struct mp_ring; @@ -781,10 +768,8 @@ struct sge { struct sge_iq **iqmap; /* iq->cntxt_id to iq mapping */ struct sge_eq **eqmap; /* eq->cntxt_id to eq mapping */ - int8_t safe_hwidx1; /* may not have room for metadata */ -
svn commit: r357479 - head/sys/dev/cxgbe
Author: np Date: Mon Feb 3 23:50:29 2020 New Revision: 357479 URL: https://svnweb.freebsd.org/changeset/base/357479 Log: cxgbe(4): Avoid ext_arg2 in rxb_free. ext_arg2 is the only item in the third cacheline in an mbuf and could be cold by the time rxb_free runs. Put the information needed by rxb_free in the same line as the refcount, which is very likely to be hot given that rxb_free runs when the refcount is decremented and reaches 0. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hMon Feb 3 23:40:27 2020 (r357478) +++ head/sys/dev/cxgbe/adapter.hMon Feb 3 23:50:29 2020 (r357479) @@ -326,6 +326,8 @@ struct cluster_layout { }; struct cluster_metadata { + uma_zone_t zone; + caddr_t cl; u_int refcount; }; Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Mon Feb 3 23:40:27 2020(r357478) +++ head/sys/dev/cxgbe/t4_sge.c Mon Feb 3 23:50:29 2020(r357479) @@ -1804,10 +1804,9 @@ cl_metadata(struct adapter *sc, struct sge_fl *fl, str static void rxb_free(struct mbuf *m) { - uma_zone_t zone = m->m_ext.ext_arg1; - void *cl = m->m_ext.ext_arg2; + struct cluster_metadata *clm = m->m_ext.ext_arg1; - uma_zfree(zone, cl); + uma_zfree(clm->zone, clm->cl); counter_u64_add(extfree_rels, 1); } @@ -1880,10 +1879,12 @@ get_scatter_segment(struct adapter *sc, struct sge_fl fl->mbuf_inlined++; if (sd->nmbuf++ == 0) { clm->refcount = 1; + clm->zone = swz->zone; + clm->cl = sd->cl; counter_u64_add(extfree_refs, 1); } - m_extaddref(m, payload, blen, &clm->refcount, rxb_free, - swz->zone, sd->cl); + m_extaddref(m, payload, blen, &clm->refcount, rxb_free, clm, + NULL); } else { /* @@ -1899,10 +1900,12 @@ get_scatter_segment(struct adapter *sc, struct sge_fl if (clm != NULL) { if (sd->nmbuf++ == 0) { clm->refcount = 1; + clm->zone = swz->zone; + clm->cl = sd->cl; counter_u64_add(extfree_refs, 1); } m_extaddref(m, payload, blen, &clm->refcount, - rxb_free, swz->zone, sd->cl); + rxb_free, clm, NULL); } else { m_cljset(m, sd->cl, swz->type); sd->cl = NULL; /* consumed, not a recycle candidate */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357476 - head/sys/dev/cxgbe
Author: np Date: Mon Feb 3 23:30:39 2020 New Revision: 357476 URL: https://svnweb.freebsd.org/changeset/base/357476 Log: cxgbe(4): Do not use pack boundary > 512B unless it is explicitly requested. This is a tradeoff between PCIe efficiency during large packet rx and packing efficiency during small packet rx. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Mon Feb 3 23:25:12 2020(r357475) +++ head/sys/dev/cxgbe/t4_sge.c Mon Feb 3 23:30:39 2020(r357476) @@ -589,6 +589,9 @@ t4_sge_extfree_refs(void) return (refs - rels); } +/* max 4096 */ +#define MAX_PACK_BOUNDARY 512 + static inline void setup_pad_and_pack_boundaries(struct adapter *sc) { @@ -635,7 +638,10 @@ setup_pad_and_pack_boundaries(struct adapter *sc) pack = fl_pack; if (fl_pack < 16 || fl_pack == 32 || fl_pack > 4096 || !powerof2(fl_pack)) { - pack = max(sc->params.pci.mps, CACHE_LINE_SIZE); + if (sc->params.pci.mps > MAX_PACK_BOUNDARY) + pack = MAX_PACK_BOUNDARY; + else + pack = max(sc->params.pci.mps, CACHE_LINE_SIZE); MPASS(powerof2(pack)); if (pack < 16) pack = 16; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357475 - head/sys/dev/cxgbe
Author: np Date: Mon Feb 3 23:25:12 2020 New Revision: 357475 URL: https://svnweb.freebsd.org/changeset/base/357475 Log: cxgbe(4): Initialize the rx buffer's metadata on first-use and not on allocation. refill_fl doesn't touch any part of a freshly allocated cluster after this change. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hMon Feb 3 23:06:42 2020 (r357474) +++ head/sys/dev/cxgbe/adapter.hMon Feb 3 23:25:12 2020 (r357475) @@ -327,7 +327,6 @@ struct cluster_layout { struct cluster_metadata { u_int refcount; - struct fl_sdesc *sd;/* For debug only. Could easily be stale */ }; struct fl_sdesc { Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Mon Feb 3 23:06:42 2020(r357474) +++ head/sys/dev/cxgbe/t4_sge.c Mon Feb 3 23:25:12 2020(r357475) @@ -1872,11 +1872,12 @@ get_scatter_segment(struct adapter *sc, struct sge_fl fr_offset == 0 ? M_PKTHDR | M_NOFREE : M_NOFREE)) return (NULL); fl->mbuf_inlined++; + if (sd->nmbuf++ == 0) { + clm->refcount = 1; + counter_u64_add(extfree_refs, 1); + } m_extaddref(m, payload, blen, &clm->refcount, rxb_free, swz->zone, sd->cl); - if (sd->nmbuf++ == 0) - counter_u64_add(extfree_refs, 1); - } else { /* @@ -1890,10 +1891,12 @@ get_scatter_segment(struct adapter *sc, struct sge_fl return (NULL); fl->mbuf_allocated++; if (clm != NULL) { + if (sd->nmbuf++ == 0) { + clm->refcount = 1; + counter_u64_add(extfree_refs, 1); + } m_extaddref(m, payload, blen, &clm->refcount, rxb_free, swz->zone, sd->cl); - if (sd->nmbuf++ == 0) - counter_u64_add(extfree_refs, 1); } else { m_cljset(m, sd->cl, swz->type); sd->cl = NULL; /* consumed, not a recycle candidate */ @@ -4401,7 +4404,7 @@ refill_fl(struct adapter *sc, struct sge_fl *fl, int n if (clm != NULL) MPASS(clm->refcount == 1); #endif - goto recycled_fast; + goto recycled; } /* @@ -4440,16 +4443,8 @@ alloc: sd->cl = cl; sd->cll = *cll; *d = htobe64(pa | cll->hwidx); - clm = cl_metadata(sc, fl, cll, cl); - if (clm != NULL) { recycled: -#ifdef INVARIANTS - clm->sd = sd; -#endif - clm->refcount = 1; - } sd->nmbuf = 0; -recycled_fast: d++; sd++; if (__predict_false(++fl->pidx % 8 == 0)) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357474 - head/sys/dev/cxgbe
Author: np Date: Mon Feb 3 23:06:42 2020 New Revision: 357474 URL: https://svnweb.freebsd.org/changeset/base/357474 Log: cxgbe(4): Only checksummed TCP should be considered for LRO. This avoids the per-packet nanouptime in tcp_lro_rx for traffic that's not even TCP. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Mon Feb 3 22:49:05 2020(r357473) +++ head/sys/dev/cxgbe/t4_sge.c Mon Feb 3 23:06:42 2020(r357474) @@ -2040,7 +2040,9 @@ t4_eth_rx(struct sge_iq *iq, const struct rss_header * m0->m_pkthdr.numa_domain = ifp->if_numa_domain; #endif #if defined(INET) || defined(INET6) - if (iq->flags & IQ_LRO_ENABLED) { + if (iq->flags & IQ_LRO_ENABLED && + (M_HASHTYPE_GET(m0) == M_HASHTYPE_RSS_TCP_IPV4 || + M_HASHTYPE_GET(m0) == M_HASHTYPE_RSS_TCP_IPV6)) { if (sort_before_lro(lro)) { tcp_lro_queue_mbuf(lro, m0); return (0); /* queued for sort, then LRO */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357318 - head/sys/netinet6
Author: np Date: Fri Jan 31 02:23:48 2020 New Revision: 357318 URL: https://svnweb.freebsd.org/changeset/base/357318 Log: Fix NOINET builds. Modified: head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet6/udp6_usrreq.c == --- head/sys/netinet6/udp6_usrreq.c Fri Jan 31 02:18:56 2020 (r357317) +++ head/sys/netinet6/udp6_usrreq.c Fri Jan 31 02:23:48 2020 (r357318) @@ -1177,7 +1177,9 @@ udp6_close(struct socket *so) static int udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) { +#ifdef INET struct epoch_tracker et; +#endif struct inpcb *inp; struct inpcbinfo *pcbinfo; struct sockaddr_in6 *sin6; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r356713 - head/sys/dev/cxgbe/iw_cxgbe
Author: np Date: Tue Jan 14 01:43:04 2020 New Revision: 356713 URL: https://svnweb.freebsd.org/changeset/base/356713 Log: cxgbe/iw_cxgbe: Do not allow memory registrations with page size greater than 128MB, which is the maximum supported by the hardware in RDMA mode. Obtained from:Chelsio Communications MFC after:3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h head/sys/dev/cxgbe/iw_cxgbe/mem.c head/sys/dev/cxgbe/iw_cxgbe/qp.c Modified: head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h == --- head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Tue Jan 14 00:51:35 2020 (r356712) +++ head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Tue Jan 14 01:43:04 2020 (r356713) @@ -91,6 +91,7 @@ static inline void *cplhdr(struct mbuf *m) #define C4IW_ID_TABLE_F_RANDOM 1 /* Pseudo-randomize the id's returned */ #define C4IW_ID_TABLE_F_EMPTY 2 /* Table is initially empty */ +#define C4IW_MAX_PAGE_SIZE 0x800 struct c4iw_id_table { u32 flags; Modified: head/sys/dev/cxgbe/iw_cxgbe/mem.c == --- head/sys/dev/cxgbe/iw_cxgbe/mem.c Tue Jan 14 00:51:35 2020 (r356712) +++ head/sys/dev/cxgbe/iw_cxgbe/mem.c Tue Jan 14 01:43:04 2020 (r356713) @@ -287,6 +287,8 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 if (reset_tpt_entry) memset(&tpt, 0, sizeof(tpt)); else { + if (page_size > ilog2(C4IW_MAX_PAGE_SIZE) - 12) + return -EINVAL; tpt.valid_to_pdid = cpu_to_be32(F_FW_RI_TPTE_VALID | V_FW_RI_TPTE_STAGKEY((*stag & M_FW_RI_TPTE_STAGKEY)) | V_FW_RI_TPTE_STAGSTATE(stag_state) | Modified: head/sys/dev/cxgbe/iw_cxgbe/qp.c == --- head/sys/dev/cxgbe/iw_cxgbe/qp.cTue Jan 14 00:51:35 2020 (r356712) +++ head/sys/dev/cxgbe/iw_cxgbe/qp.cTue Jan 14 01:43:04 2020 (r356713) @@ -669,11 +669,14 @@ static void complete_rq_drain_wr(struct c4iw_qp *qhp, spin_unlock_irqrestore(&rchp->comp_handler_lock, flag); } -static void build_tpte_memreg(struct fw_ri_fr_nsmr_tpte_wr *fr, +static int build_tpte_memreg(struct fw_ri_fr_nsmr_tpte_wr *fr, struct ib_reg_wr *wr, struct c4iw_mr *mhp, u8 *len16) { __be64 *p = (__be64 *)fr->pbl; + if (wr->mr->page_size > C4IW_MAX_PAGE_SIZE) + return -EINVAL; + fr->r2 = cpu_to_be32(0); fr->stag = cpu_to_be32(mhp->ibmr.rkey); @@ -698,6 +701,7 @@ static void build_tpte_memreg(struct fw_ri_fr_nsmr_tpt p[1] = cpu_to_be64((u64)mhp->mpl[1]); *len16 = DIV_ROUND_UP(sizeof(*fr), 16); + return 0; } static int build_memreg(struct t4_sq *sq, union t4_wr *wqe, @@ -712,6 +716,8 @@ static int build_memreg(struct t4_sq *sq, union t4_wr if (mhp->mpl_len > t4_max_fr_depth(use_dsgl && dsgl_supported)) return -EINVAL; + if (wr->mr->page_size > C4IW_MAX_PAGE_SIZE) + return -EINVAL; wqe->fr.qpbinde_to_dcacpu = 0; wqe->fr.pgsz_shift = ilog2(wr->mr->page_size) - 12; @@ -852,16 +858,16 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_ if (rdev->adap->params.fr_nsmr_tpte_wr_support && !mhp->attr.state && mhp->mpl_len <= 2) { fw_opcode = FW_RI_FR_NSMR_TPTE_WR; - build_tpte_memreg(&wqe->fr_tpte, reg_wr(wr), + err = build_tpte_memreg(&wqe->fr_tpte, reg_wr(wr), mhp, &len16); } else { fw_opcode = FW_RI_FR_NSMR_WR; err = build_memreg(&qhp->wq.sq, wqe, reg_wr(wr), mhp, &len16, rdev->adap->params.ulptx_memwrite_dsgl); - if (err) - break; } + if (err) + break; mhp->attr.state = 1; break; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355886 - head/sys/dev/cxgbe
Author: np Date: Wed Dec 18 19:10:30 2019 New Revision: 355886 URL: https://svnweb.freebsd.org/changeset/base/355886 Log: cxgbe(4): check if the firmware supports FW_RI_FR_NSMR_TPTE_WR work request. This is used by iw_cxgbe to figure out how best to register memory. MFC after:1 month Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cWed Dec 18 18:44:16 2019 (r355885) +++ head/sys/dev/cxgbe/t4_main.cWed Dec 18 19:10:30 2019 (r355886) @@ -4379,6 +4379,14 @@ get_params__post_init(struct adapter *sc) else sc->params.ulptx_memwrite_dsgl = false; + /* FW_RI_FR_NSMR_TPTE_WR support */ + param[0] = FW_PARAM_DEV(RI_FR_NSMR_TPTE_WR); + rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, param, val); + if (rc == 0) + sc->params.fr_nsmr_tpte_wr_support = val[0] != 0; + else + sc->params.fr_nsmr_tpte_wr_support = false; + /* get capabilites */ bzero(&caps, sizeof(caps)); caps.op_to_write = htobe32(V_FW_CMD_OP(FW_CAPS_CONFIG_CMD) | ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355730 - in head/sys/dev/cxgbe: . crypto
Author: np Date: Fri Dec 13 20:38:58 2019 New Revision: 355730 URL: https://svnweb.freebsd.org/changeset/base/355730 Log: cxgbe(4): Use the _XT variant of the CPL used to transmit NIC traffic. CPL_TX_PKT_XT disables the internal parser on the chip and instead relies on the driver to provide the exact length of the L2 and L3 headers. This allows hw checksumming and TSO to be used with L2 and L3 encapsulations that the chip doesn't understand directly. Note that netmap tx still uses the old CPL as it never uses the hw to generate the checksum on tx. Reviewed by: jhb@ MFC after:1 month Sponsored by: Chelsio Communications Differential Revision:https://reviews.freebsd.org/D22788 Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c head/sys/dev/cxgbe/t4_sched.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c == --- head/sys/dev/cxgbe/crypto/t4_kern_tls.c Fri Dec 13 20:30:26 2019 (r355729) +++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Fri Dec 13 20:38:58 2019 (r355730) @@ -1394,15 +1394,10 @@ ktls_write_tcp_options(struct sge_txq *txq, void *dst, cpl = (void *)(wr + 1); - /* Checksum offload */ - ctrl1 = 0; - txq->txcsum++; - /* CPL header */ cpl->ctrl0 = txq->cpl_ctrl0; cpl->pack = 0; cpl->len = htobe16(pktlen); - cpl->ctrl1 = htobe64(ctrl1); out = (void *)(cpl + 1); @@ -1419,13 +1414,21 @@ ktls_write_tcp_options(struct sge_txq *txq, void *dst, if (m->m_pkthdr.l3hlen > sizeof(*ip)) copy_to_txd(&txq->eq, (caddr_t)(ip + 1), &out, m->m_pkthdr.l3hlen - sizeof(*ip)); + ctrl1 = V_TXPKT_CSUM_TYPE(TX_CSUM_TCPIP) | + V_T6_TXPKT_ETHHDR_LEN(m->m_pkthdr.l2hlen - ETHER_HDR_LEN) | + V_TXPKT_IPHDR_LEN(m->m_pkthdr.l3hlen); } else { ip6 = (void *)((char *)eh + m->m_pkthdr.l2hlen); newip6 = *ip6; newip6.ip6_plen = htons(pktlen - m->m_pkthdr.l2hlen); copy_to_txd(&txq->eq, (caddr_t)&newip6, &out, sizeof(newip6)); MPASS(m->m_pkthdr.l3hlen == sizeof(*ip6)); + ctrl1 = V_TXPKT_CSUM_TYPE(TX_CSUM_TCPIP6) | + V_T6_TXPKT_ETHHDR_LEN(m->m_pkthdr.l2hlen - ETHER_HDR_LEN) | + V_TXPKT_IPHDR_LEN(m->m_pkthdr.l3hlen); } + cpl->ctrl1 = htobe64(ctrl1); + txq->txcsum++; /* Clear PUSH and FIN in the TCP header if present. */ tcp = (void *)((char *)eh + m->m_pkthdr.l2hlen + m->m_pkthdr.l3hlen); @@ -1493,15 +1496,10 @@ ktls_write_tunnel_packet(struct sge_txq *txq, void *ds cpl = (void *)(wr + 1); - /* Checksum offload */ - ctrl1 = 0; - txq->txcsum++; - /* CPL header */ cpl->ctrl0 = txq->cpl_ctrl0; cpl->pack = 0; cpl->len = htobe16(pktlen); - cpl->ctrl1 = htobe64(ctrl1); out = (void *)(cpl + 1); @@ -1518,13 +1516,21 @@ ktls_write_tunnel_packet(struct sge_txq *txq, void *ds if (m->m_pkthdr.l3hlen > sizeof(*ip)) copy_to_txd(&txq->eq, (caddr_t)(ip + 1), &out, m->m_pkthdr.l3hlen - sizeof(*ip)); + ctrl1 = V_TXPKT_CSUM_TYPE(TX_CSUM_TCPIP) | + V_T6_TXPKT_ETHHDR_LEN(m->m_pkthdr.l2hlen - ETHER_HDR_LEN) | + V_TXPKT_IPHDR_LEN(m->m_pkthdr.l3hlen); } else { ip6 = (void *)((char *)eh + m->m_pkthdr.l2hlen); newip6 = *ip6; newip6.ip6_plen = htons(pktlen - m->m_pkthdr.l2hlen); copy_to_txd(&txq->eq, (caddr_t)&newip6, &out, sizeof(newip6)); MPASS(m->m_pkthdr.l3hlen == sizeof(*ip6)); + ctrl1 = V_TXPKT_CSUM_TYPE(TX_CSUM_TCPIP6) | + V_T6_TXPKT_ETHHDR_LEN(m->m_pkthdr.l2hlen - ETHER_HDR_LEN) | + V_TXPKT_IPHDR_LEN(m->m_pkthdr.l3hlen); } + cpl->ctrl1 = htobe64(ctrl1); + txq->txcsum++; /* Set sequence number in TCP header. */ tcp = (void *)((char *)eh + m->m_pkthdr.l2hlen + m->m_pkthdr.l3hlen); @@ -2134,15 +2140,10 @@ ktls_write_tcp_fin(struct sge_txq *txq, void *dst, str cpl = (void *)(wr + 1); - /* Checksum offload */ - ctrl1 = 0; - txq->txcsum++; - /* CPL header */ cpl->ctrl0 = txq->cpl_ctrl0; cpl->pack = 0; cpl->len = htobe16(pktlen); - cpl->ctrl1 = htobe64(ctrl1); out = (void *)(cpl + 1); @@ -2159,13 +2160,21 @@ ktls_write_tcp_fin(struct sge_txq *txq, void *dst, str if (m->m_pkthdr.l3hlen > sizeof(*ip)) copy_to_txd(&txq->eq, (caddr_t)(ip + 1), &out, m->m_pkthdr.l3hlen - sizeof(*ip)); + ctrl1 = V_TXPKT_CSUM_T
svn commit: r355673 - head/sys/dev/cxgbe
Author: np Date: Thu Dec 12 21:33:00 2019 New Revision: 355673 URL: https://svnweb.freebsd.org/changeset/base/355673 Log: cxgbe(4): Never use hardware checksumming in netmap tx. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_netmap.c Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Thu Dec 12 21:13:20 2019 (r355672) +++ head/sys/dev/cxgbe/t4_netmap.c Thu Dec 12 21:33:00 2019 (r355673) @@ -659,7 +659,7 @@ ring_nm_txq_db(struct adapter *sc, struct sge_nm_txq * */ static void cxgbe_nm_tx(struct adapter *sc, struct sge_nm_txq *nm_txq, -struct netmap_kring *kring, int npkt, int npkt_remaining, int txcsum) +struct netmap_kring *kring, int npkt, int npkt_remaining) { struct netmap_ring *ring = kring->ring; struct netmap_slot *slot; @@ -695,13 +695,9 @@ cxgbe_nm_tx(struct adapter *sc, struct sge_nm_txq *nm_ * netmap(4) says "netmap does not use features such as * checksum offloading, TCP segmentation offloading, * encryption, VLAN encapsulation/decapsulation, etc." -* -* So the ncxl interfaces have tx hardware checksumming -* disabled by default. But you can override netmap by -* enabling IFCAP_TXCSUM on the interface manully. */ - cpl->ctrl1 = txcsum ? 0 : - htobe64(F_TXPKT_IPCSUM_DIS | F_TXPKT_L4CSUM_DIS); + cpl->ctrl1 = htobe64(F_TXPKT_IPCSUM_DIS | + F_TXPKT_L4CSUM_DIS); usgl = (void *)(cpl + 1); usgl->cmd_nsge = htobe32(V_ULPTX_CMD(ULP_TX_SC_DSGL) | @@ -815,7 +811,7 @@ cxgbe_netmap_txsync(struct netmap_kring *kring, int fl struct sge_nm_txq *nm_txq = &sc->sge.nm_txq[vi->first_nm_txq + kring->ring_id]; const u_int head = kring->rhead; u_int reclaimed = 0; - int n, d, npkt_remaining, ndesc_remaining, txcsum; + int n, d, npkt_remaining, ndesc_remaining; /* * Tx was at kring->nr_hwcur last time around and now we need to advance @@ -826,7 +822,6 @@ cxgbe_netmap_txsync(struct netmap_kring *kring, int fl npkt_remaining = head >= kring->nr_hwcur ? head - kring->nr_hwcur : kring->nkr_num_slots - kring->nr_hwcur + head; - txcsum = ifp->if_capenable & (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6); while (npkt_remaining) { reclaimed += reclaim_nm_tx_desc(nm_txq); ndesc_remaining = contiguous_ndesc_available(nm_txq); @@ -850,7 +845,7 @@ cxgbe_netmap_txsync(struct netmap_kring *kring, int fl /* Send n packets and update nm_txq->pidx and kring->nr_hwcur */ npkt_remaining -= n; - cxgbe_nm_tx(sc, nm_txq, kring, n, npkt_remaining, txcsum); + cxgbe_nm_tx(sc, nm_txq, kring, n, npkt_remaining); } MPASS(npkt_remaining == 0); MPASS(kring->nr_hwcur == head); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355597 - head/share/man/man4
Author: np Date: Tue Dec 10 20:51:28 2019 New Revision: 355597 URL: https://svnweb.freebsd.org/changeset/base/355597 Log: cxgbe(4): Man page updates to go with r355107. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/share/man/man4/cxgbe.4 Modified: head/share/man/man4/cxgbe.4 == --- head/share/man/man4/cxgbe.4 Tue Dec 10 20:23:05 2019(r355596) +++ head/share/man/man4/cxgbe.4 Tue Dec 10 20:51:28 2019(r355597) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Oct 25, 2019 +.Dd Dec 10, 2019 .Dt CXGBE 4 .Os .Sh NAME @@ -291,10 +291,14 @@ This tunable establishes the default PAUSE settings fo Settings can be displayed and controlled on a per-port basis via the dev..X.pause_settings sysctl. .It Va hw.cxgbe.fec -FEC (Forward Error Correction) settings. +Forward Error Correction settings. +-1 (default) means driver should automatically pick a value. 0 disables FEC. -Bit 0 enables RS FEC, bit 1 enables BASE-R FEC (aka Firecode FEC). -The default is -1 which lets the driver pick a value. +Finer grained control can be achieved by setting individual bits. +Bit 0 enables RS FEC, bit 1 enables BASE-R FEC (aka Firecode FEC), bit +2 enables NO FEC, and bit 6 enables the FEC that is recommended by the +transceiver/cable that is plugged in. +These bits can be set together in any combination. This tunable establishes the default FEC settings for all ports. Settings can be displayed and controlled on a per-port basis via the dev..X.fec sysctl. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355595 - head/sys/dev/cxgbe
Author: np Date: Tue Dec 10 20:12:21 2019 New Revision: 355595 URL: https://svnweb.freebsd.org/changeset/base/355595 Log: cxgbe(4): Simplify the firmware version checks a bit. No functional change. MFC after:1 week Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cTue Dec 10 20:11:39 2019 (r355594) +++ head/sys/dev/cxgbe/t4_main.cTue Dec 10 20:12:21 2019 (r355595) @@ -4251,9 +4251,8 @@ set_params__pre_init(struct adapter *sc) val = 1; rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, ¶m, &val); /* firmwares < 1.20.1.0 do not have this param. */ - if (rc == FW_EINVAL && sc->params.fw_vers < - (V_FW_HDR_FW_VER_MAJOR(1) | V_FW_HDR_FW_VER_MINOR(20) | - V_FW_HDR_FW_VER_MICRO(1) | V_FW_HDR_FW_VER_BUILD(0))) { + if (rc == FW_EINVAL && + sc->params.fw_vers < FW_VERSION32(1, 20, 1, 0)) { rc = 0; } if (rc != 0) { @@ -4418,9 +4417,7 @@ get_params__post_init(struct adapter *sc) return (rc); } sc->tids.ntids = val[0]; - if (sc->params.fw_vers < - (V_FW_HDR_FW_VER_MAJOR(1) | V_FW_HDR_FW_VER_MINOR(20) | - V_FW_HDR_FW_VER_MICRO(5) | V_FW_HDR_FW_VER_BUILD(0))) { + if (sc->params.fw_vers < FW_VERSION32(1, 20, 5, 0)) { MPASS(sc->tids.ntids >= sc->tids.nhpftids); sc->tids.ntids -= sc->tids.nhpftids; } @@ -4460,9 +4457,7 @@ get_params__post_init(struct adapter *sc) return (rc); } sc->tids.ntids = val[0]; - if (sc->params.fw_vers < - (V_FW_HDR_FW_VER_MAJOR(1) | V_FW_HDR_FW_VER_MINOR(20) | - V_FW_HDR_FW_VER_MICRO(5) | V_FW_HDR_FW_VER_BUILD(0))) { + if (sc->params.fw_vers < FW_VERSION32(1, 20, 5, 0)) { MPASS(sc->tids.ntids >= sc->tids.nhpftids); sc->tids.ntids -= sc->tids.nhpftids; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355580 - head/sys/dev/cxgbe
Author: np Date: Tue Dec 10 08:16:19 2019 New Revision: 355580 URL: https://svnweb.freebsd.org/changeset/base/355580 Log: cxgbe(4): Use TX_PKTS2 work requests in netmap Tx if it's available. TX_PKTS2 is more efficient within the firmware and this improves netmap Tx by a few Mpps in some common scenarios. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hTue Dec 10 07:45:10 2019 (r355579) +++ head/sys/dev/cxgbe/adapter.hTue Dec 10 08:16:19 2019 (r355580) @@ -743,6 +743,7 @@ struct sge_nm_txq { u_int udb_qid; u_int cntxt_id; __be32 cpl_ctrl0; /* for convenience */ + __be32 op_pkd; /* ditto */ u_int nid; /* netmap ring # for this queue */ /* infrequently used items after this */ Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Tue Dec 10 07:45:10 2019 (r355579) +++ head/sys/dev/cxgbe/t4_netmap.c Tue Dec 10 08:16:19 2019 (r355580) @@ -573,7 +573,10 @@ ndesc_to_npkt(const int n) } #define MAX_NPKT_IN_TYPE1_WR (ndesc_to_npkt(SGE_MAX_WR_NDESC)) -/* Space (in descriptors) needed for a type1 WR that carries n packets */ +/* + * Space (in descriptors) needed for a type1 WR (TX_PKTS or TX_PKTS2) that + * carries n packets + */ static inline int npkt_to_ndesc(const int n) { @@ -583,7 +586,10 @@ npkt_to_ndesc(const int n) return ((n + 2) / 2); } -/* Space (in 16B units) needed for a type1 WR that carries n packets */ +/* + * Space (in 16B units) needed for a type1 WR (TX_PKTS or TX_PKTS2) that + * carries n packets + */ static inline int npkt_to_len16(const int n) { @@ -670,7 +676,7 @@ cxgbe_nm_tx(struct adapter *sc, struct sge_nm_txq *nm_ len = 0; wr = (void *)&nm_txq->desc[nm_txq->pidx]; - wr->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS_WR)); + wr->op_pkd = nm_txq->op_pkd; wr->equiq_to_len16 = htobe32(V_FW_WR_LEN16(npkt_to_len16(n))); wr->npkt = n; wr->r3 = 0; @@ -778,7 +784,8 @@ reclaim_nm_tx_desc(struct sge_nm_txq *nm_txq) while (nm_txq->cidx != hw_cidx) { wr = (void *)&nm_txq->desc[nm_txq->cidx]; - MPASS(wr->op_pkd == htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS_WR))); + MPASS(wr->op_pkd == htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS_WR)) || + wr->op_pkd == htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS2_WR))); MPASS(wr->type == 1); MPASS(wr->npkt > 0 && wr->npkt <= MAX_NPKT_IN_TYPE1_WR); Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Tue Dec 10 07:45:10 2019(r355579) +++ head/sys/dev/cxgbe/t4_sge.c Tue Dec 10 08:16:19 2019(r355580) @@ -3754,6 +3754,10 @@ alloc_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm nm_txq->cpl_ctrl0 = htobe32(V_TXPKT_OPCODE(CPL_TX_PKT) | V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(sc->pf) | V_TXPKT_VF(vi->vin) | V_TXPKT_VF_VLD(vi->vfvld)); + if (sc->params.fw_vers >= FW_VERSION32(1, 24, 11, 0)) + nm_txq->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS2_WR)); + else + nm_txq->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS_WR)); nm_txq->cntxt_id = INVALID_NM_TXQ_CNTXT_ID; snprintf(name, sizeof(name), "%d", idx); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355579 - in head/sys: conf dev/cxgbe/firmware modules/cxgbe/t4_firmware modules/cxgbe/t5_firmware modules/cxgbe/t6_firmware
Author: np Date: Tue Dec 10 07:45:10 2019 New Revision: 355579 URL: https://svnweb.freebsd.org/changeset/base/355579 Log: cxgbe(4): Update T4/5/6 firmwares to 1.24.11.0. These were obtained from the Chelsio Unified Wire v3.12.0.1 beta release. Note that the firmwares are not uuencoded any more. MFH: 1 month Sponsored by: Chelsio Communications Added: head/sys/dev/cxgbe/firmware/t4fw-1.24.11.0.bin (contents, props changed) head/sys/dev/cxgbe/firmware/t5fw-1.24.11.0.bin (contents, props changed) head/sys/dev/cxgbe/firmware/t6fw-1.24.11.0.bin (contents, props changed) Deleted: head/sys/dev/cxgbe/firmware/t4fw-1.23.0.0.bin.uu head/sys/dev/cxgbe/firmware/t5fw-1.23.0.0.bin.uu head/sys/dev/cxgbe/firmware/t6fw-1.23.0.0.bin.uu Modified: head/sys/conf/files head/sys/dev/cxgbe/firmware/t4fw_interface.h head/sys/dev/cxgbe/firmware/t6fw_cfg_uwire.txt head/sys/modules/cxgbe/t4_firmware/Makefile head/sys/modules/cxgbe/t5_firmware/Makefile head/sys/modules/cxgbe/t6_firmware/Makefile Modified: head/sys/conf/files == --- head/sys/conf/files Tue Dec 10 07:07:17 2019(r355578) +++ head/sys/conf/files Tue Dec 10 07:45:10 2019(r355579) @@ -1469,8 +1469,8 @@ t4fw.fwo optional cxgbe \ no-implicit-rule\ clean "t4fw.fwo" t4fw.fwoptional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t4fw-1.23.0.0.bin.uu"\ - compile-with"${NORMAL_FW}" \ + dependency "$S/dev/cxgbe/firmware/t4fw-1.24.11.0.bin" \ + compile-with"${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t4fw.fw" t5fw_cfg.c optional cxgbe \ @@ -1503,8 +1503,8 @@ t5fw.fwo optional cxgbe \ no-implicit-rule\ clean "t5fw.fwo" t5fw.fwoptional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t5fw-1.23.0.0.bin.uu"\ - compile-with"${NORMAL_FW}" \ + dependency "$S/dev/cxgbe/firmware/t5fw-1.24.11.0.bin" \ + compile-with"${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t5fw.fw" t6fw_cfg.c optional cxgbe \ @@ -1537,8 +1537,8 @@ t6fw.fwo optional cxgbe \ no-implicit-rule\ clean "t6fw.fwo" t6fw.fwoptional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t6fw-1.23.0.0.bin.uu"\ - compile-with"${NORMAL_FW}" \ + dependency "$S/dev/cxgbe/firmware/t6fw-1.24.11.0.bin" \ + compile-with"${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t6fw.fw" dev/cxgbe/crypto/t4_crypto.c optional ccr \ Added: head/sys/dev/cxgbe/firmware/t4fw-1.24.11.0.bin == Binary file. No diff available. Modified: head/sys/dev/cxgbe/firmware/t4fw_interface.h == --- head/sys/dev/cxgbe/firmware/t4fw_interface.hTue Dec 10 07:07:17 2019(r355578) +++ head/sys/dev/cxgbe/firmware/t4fw_interface.hTue Dec 10 07:45:10 2019(r355579) @@ -9938,20 +9938,20 @@ enum fw_hdr_chip { (((x) >> S_FW_HDR_FW_VER_BUILD) & M_FW_HDR_FW_VER_BUILD) enum { - T4FW_VERSION_MAJOR = 0x01, - T4FW_VERSION_MINOR = 0x17, - T4FW_VERSION_MICRO = 0x00, - T4FW_VERSION_BUILD = 0x00, + T4FW_VERSION_MAJOR = 1, + T4FW_VERSION_MINOR = 24, + T4FW_VERSION_MICRO = 11, + T4FW_VERSION_BUILD = 0, - T5FW_VERSION_MAJOR = 0x01, - T5FW_VERSION_MINOR = 0x17, - T5FW_VERSION_MICRO = 0x00, - T5FW_VERSION_BUILD = 0x00, + T5FW_VERSION_MAJOR = 1, + T5FW_VERSION_MINOR = 24, + T5FW_VERSION_MICRO = 11, + T5FW_VERSION_BUILD = 0, - T6FW_VERSION_MAJOR = 0x01, - T6FW_VERSION_MINOR = 0x17, - T6FW_VERSION_MICRO = 0x00, - T6FW_VERSION_BUILD = 0x00, + T6FW_VERSION_MAJOR = 1, + T6FW_VERSION_M
svn commit: r355566 - head/sys/dev/cxgbe/iw_cxgbe
Author: np Date: Mon Dec 9 19:10:42 2019 New Revision: 355566 URL: https://svnweb.freebsd.org/changeset/base/355566 Log: cxgbe/iw_cxgbe: Support 64b length in the memory registration routines. Submitted by: bharat @ chelsio MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/iw_cxgbe/qp.c Modified: head/sys/dev/cxgbe/iw_cxgbe/qp.c == --- head/sys/dev/cxgbe/iw_cxgbe/qp.cMon Dec 9 19:00:39 2019 (r355565) +++ head/sys/dev/cxgbe/iw_cxgbe/qp.cMon Dec 9 19:10:42 2019 (r355566) @@ -689,8 +689,8 @@ static void build_tpte_memreg(struct fw_ri_fr_nsmr_tpt fr->tpte.nosnoop_pbladdr = cpu_to_be32(V_FW_RI_TPTE_PBLADDR( PBL_OFF(&mhp->rhp->rdev, mhp->attr.pbl_addr)>>3)); fr->tpte.dca_mwbcnt_pstag = cpu_to_be32(0); - fr->tpte.len_hi = cpu_to_be32(0); - fr->tpte.len_lo = cpu_to_be32(mhp->ibmr.length); + fr->tpte.len_hi = cpu_to_be32(mhp->ibmr.length >> 32); + fr->tpte.len_lo = cpu_to_be32(mhp->ibmr.length & 0x); fr->tpte.va_hi = cpu_to_be32(mhp->ibmr.iova >> 32); fr->tpte.va_lo_fbo = cpu_to_be32(mhp->ibmr.iova & 0x); @@ -717,12 +717,11 @@ static int build_memreg(struct t4_sq *sq, union t4_wr wqe->fr.pgsz_shift = ilog2(wr->mr->page_size) - 12; wqe->fr.addr_type = FW_RI_VA_BASED_TO; wqe->fr.mem_perms = c4iw_ib_to_tpt_access(wr->access); - wqe->fr.len_hi = 0; - wqe->fr.len_lo = cpu_to_be32(mhp->ibmr.length); + wqe->fr.len_hi = cpu_to_be32(mhp->ibmr.length >> 32); + wqe->fr.len_lo = cpu_to_be32(mhp->ibmr.length & 0x); wqe->fr.stag = cpu_to_be32(wr->key); wqe->fr.va_hi = cpu_to_be32(mhp->ibmr.iova >> 32); - wqe->fr.va_lo_fbo = cpu_to_be32(mhp->ibmr.iova & - 0x); + wqe->fr.va_lo_fbo = cpu_to_be32(mhp->ibmr.iova & 0x); if (dsgl_supported && use_dsgl && (pbllen > max_fr_immd)) { struct fw_ri_dsgl *sglp; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355107 - in head/sys/dev/cxgbe: . common
Author: np Date: Tue Nov 26 05:54:25 2019 New Revision: 355107 URL: https://svnweb.freebsd.org/changeset/base/355107 Log: cxgbe(4): Allow the driver to specify multiple FECs that the firmware should try in order to link up with the peer. Various FEC variables within the driver can now have multiple bits set instead of being powers of 2. 0 and -1 in the user knobs still mean no FEC and auto (driver decides) respectively for backward compatibility, but no-FEC and auto now have their own bits in the internal representation. There is a new bit that can be set to request the FEC recommended by the cable/transceiver module. Add sysctls to display link related capabilities of the local side as well as the link partner. Note that all this needs a new firmware and the documentation for the driver FEC knobs will be updated after that firmware is added to the driver. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/common/common.h == --- head/sys/dev/cxgbe/common/common.h Tue Nov 26 05:06:25 2019 (r355106) +++ head/sys/dev/cxgbe/common/common.h Tue Nov 26 05:54:25 2019 (r355107) @@ -62,10 +62,21 @@ enum { }; enum { - FEC_NONE = 0, - FEC_RS= 1 << 0, - FEC_BASER_RS = 1 << 1, - FEC_AUTO = 1 << 5, /* M_FW_PORT_CAP32_FEC + 1 */ + /* +* Real FECs. In the same order as the FEC portion of caps32 so that +* the code can do (fec & M_FW_PORT_CAP32_FEC) to get all the real FECs. +*/ + FEC_RS= 1 << 0, /* Reed-Solomon */ + FEC_BASER_RS = 1 << 1, /* BASE-R, aka Firecode */ + FEC_NONE = 1 << 2, /* no FEC */ + + /* +* Pseudo FECs that translate to real FECs. The firmware knows nothing +* about these and they start at M_FW_PORT_CAP32_FEC + 1. AUTO should +* be set all by itself. +*/ + FEC_AUTO = 1 << 5, + FEC_MODULE= 1 << 6, /* FEC suggested by the cable/transceiver. */ }; enum t4_bar2_qtype { T4_BAR2_QTYPE_EGRESS, T4_BAR2_QTYPE_INGRESS }; @@ -409,20 +420,20 @@ struct trace_params { struct link_config { /* OS-specific code owns all the requested_* fields. */ - int8_t requested_aneg; /* link autonegotiation */ - int8_t requested_fc;/* flow control */ - int8_t requested_fec; /* FEC */ - u_int requested_speed; /* speed (Mbps) */ + int8_t requested_aneg; /* link autonegotiation */ + int8_t requested_fc;/* flow control */ + int8_t requested_fec; /* FEC */ + u_int requested_speed; /* speed (Mbps) */ - uint32_t supported; /* link capabilities */ - uint32_t advertising; /* advertised capabilities */ - uint32_t lp_advertising;/* peer advertised capabilities */ - uint32_t fec_hint; /* use this fec */ - u_int speed;/* actual link speed (Mbps) */ - int8_t fc; /* actual link flow control */ - int8_t fec; /* actual FEC */ - bool link_ok; /* link up? */ - uint8_t link_down_rc; /* link down reason */ + uint32_t pcaps; /* link capabilities */ + uint32_t acaps; /* advertised capabilities */ + uint32_t lpacaps; /* peer advertised capabilities */ + u_int speed;/* actual link speed (Mbps) */ + int8_t fc; /* actual link flow control */ + int8_t fec_hint;/* cable/transceiver recommended fec */ + int8_t fec; /* actual FEC */ + bool link_ok; /* link up? */ + uint8_t link_down_rc; /* link down reason */ }; #include "adapter.h" @@ -881,7 +892,7 @@ port_top_speed(const struct port_info *pi) { /* Mbps -> Gbps */ - return (fwcap_to_speed(pi->link_cfg.supported) / 1000); + return (fwcap_to_speed(pi->link_cfg.pcaps) / 1000); } #endif /* __CHELSIO_COMMON_H */ Modified: head/sys/dev/cxgbe/common/t4_hw.c == --- head/sys/dev/cxgbe/common/t4_hw.c Tue Nov 26 05:06:25 2019 (r355106) +++ head/sys/dev/cxgbe/common/t4_hw.c Tue Nov 26 05:54:25 2019 (r355107) @@ -3841,6 +3841,43 @@ is_bt(struct port_info *pi) pi->port_type == FW_PORT_TYPE_BT_XAUI); } +static int8_t fwcap_to_fec(uint32_t caps, bool unset_means_none) +{ + int8_t fec = 0; + + if ((caps & V_FW_PORT_CAP32_FEC(M_FW_PORT_CAP32_FEC)) == 0) + return (unset_means_none ? FEC_NONE : 0); + + if (caps & FW_PORT_CAP32_FEC_RS) + fec |= FEC_RS; + if
svn commit: r355059 - head/sys/dev/cxgbe
Author: np Date: Sun Nov 24 16:40:54 2019 New Revision: 355059 URL: https://svnweb.freebsd.org/changeset/base/355059 Log: cxgbe(4): sysctl to reset the temperature/voltage sensor. # sysctl dev...reset_sensor=1 # sysctl dev.t6nex.0.reset_sensor=1 MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hSun Nov 24 15:37:19 2019 (r355058) +++ head/sys/dev/cxgbe/adapter.hSun Nov 24 16:40:54 2019 (r355059) @@ -917,6 +917,7 @@ struct adapter { int last_op_flags; int swintr; + int sensor_resets; struct callout ktls_tick; }; Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cSun Nov 24 15:37:19 2019 (r355058) +++ head/sys/dev/cxgbe/t4_main.cSun Nov 24 16:40:54 2019 (r355059) @@ -682,6 +682,7 @@ static int sysctl_autoneg(SYSCTL_HANDLER_ARGS); static int sysctl_handle_t4_reg64(SYSCTL_HANDLER_ARGS); static int sysctl_temperature(SYSCTL_HANDLER_ARGS); static int sysctl_vdd(SYSCTL_HANDLER_ARGS); +static int sysctl_reset_sensor(SYSCTL_HANDLER_ARGS); static int sysctl_loadavg(SYSCTL_HANDLER_ARGS); static int sysctl_cctrl(SYSCTL_HANDLER_ARGS); static int sysctl_cim_ibq_obq(SYSCTL_HANDLER_ARGS); @@ -6264,6 +6265,9 @@ t4_sysctls(struct adapter *sc) SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "temperature", CTLTYPE_INT | CTLFLAG_RD, sc, 0, sysctl_temperature, "I", "chip temperature (in Celsius)"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "reset_sensor", CTLTYPE_INT | + CTLFLAG_RW, sc, 0, sysctl_reset_sensor, "I", + "reset the chip's temperature sensor."); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "loadavg", CTLTYPE_STRING | CTLFLAG_RD, sc, 0, sysctl_loadavg, "A", @@ -7452,6 +7456,36 @@ sysctl_vdd(SYSCTL_HANDLER_ARGS) } return (sysctl_handle_int(oidp, &sc->params.core_vdd, 0, req)); +} + +static int +sysctl_reset_sensor(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + int rc, v; + uint32_t param, val; + + v = sc->sensor_resets; + rc = sysctl_handle_int(oidp, &v, 0, req); + if (rc != 0 || req->newptr == NULL || v <= 0) + return (rc); + + if (sc->params.fw_vers < FW_VERSION32(1, 24, 7, 0) || + chip_id(sc) < CHELSIO_T5) + return (ENOTSUP); + + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4srst"); + if (rc) + return (rc); + param = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_DIAG) | + V_FW_PARAMS_PARAM_Y(FW_PARAM_DEV_DIAG_RESET_TMP_SENSOR)); + val = 1; + rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, ¶m, &val); + end_synchronized_op(sc, 0); + if (rc == 0) + sc->sensor_resets++; + return (rc); } static int ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355046 - head/sys/dev/cxgbe/firmware
Author: np Date: Sun Nov 24 05:37:28 2019 New Revision: 355046 URL: https://svnweb.freebsd.org/changeset/base/355046 Log: cxgbe(4): Update the firmware interface header. This allows the driver to be updated for the next firmware without waiting for it to be released. MFC after:2 weeks Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/firmware/t4fw_interface.h Modified: head/sys/dev/cxgbe/firmware/t4fw_interface.h == --- head/sys/dev/cxgbe/firmware/t4fw_interface.hSun Nov 24 04:35:29 2019(r355045) +++ head/sys/dev/cxgbe/firmware/t4fw_interface.hSun Nov 24 05:37:28 2019(r355046) @@ -142,6 +142,7 @@ enum fw_wr_opcodes { FW_ISCSI_TX_DATA_WR = 0x45, FW_PTP_TX_PKT_WR= 0x46, FW_TLSTX_DATA_WR= 0x68, + FW_TLS_TUNNEL_OFLD_WR = 0x69, FW_CRYPTO_LOOKASIDE_WR = 0x6d, FW_COISCSI_TGT_WR = 0x70, FW_COISCSI_TGT_CONN_WR = 0x71, @@ -2200,6 +2201,11 @@ enum fw_chnet_ifconf_wr_subop { FW_CHNET_IFCONF_WR_SUBOP_ICMP_PING4, FW_CHNET_IFCONF_WR_SUBOP_ICMP_PING6, + FW_CHNET_IFCONF_WR_SUBOP_ICMP_PLD_PING4, + FW_CHNET_IFCONF_WR_SUBOP_ICMP_PLD_PING6, + + FW_CHNET_IFCONF_WR_SUBOP_PMTU6_CLEAR, + FW_CHNET_IFCONF_WR_SUBOP_MAX, }; @@ -2228,7 +2234,8 @@ struct fw_chnet_ifconf_wr { } mac; } u; struct fw_chnet_ifconf_params { - __be32 r0; + __be16 ping_pldsize; + __be16 r0; __be16 vlanid; __be16 mtu; union fw_chnet_ifconf_addr_type { @@ -4080,6 +4087,13 @@ struct fw_crypto_lookaside_wr { (((x) >> S_FW_CRYPTO_LOOKASIDE_WR_HASH_SIZE) & \ M_FW_CRYPTO_LOOKASIDE_WR_HASH_SIZE) +struct fw_tls_tunnel_ofld_wr { + __be32 op_compl; + __be32 flowid_len16; + __be32 plen; + __be32 r4; +}; + /** * C O M M A N D s */ @@ -4137,6 +4151,7 @@ enum fw_cmd_opcodes { FW_DEVLOG_CMD = 0x25, FW_WATCHDOG_CMD= 0x27, FW_CLIP_CMD= 0x28, + FW_CLIP2_CMD = 0x29, FW_CHNET_IFACE_CMD = 0x26, FW_FCOE_RES_INFO_CMD = 0x31, FW_FCOE_LINK_CMD = 0x32, @@ -4752,6 +4767,22 @@ enum fw_params_mnem { /* * device parameters */ +#define S_FW_PARAMS_PARAM_FILTER_MODE 16 +#define M_FW_PARAMS_PARAM_FILTER_MODE 0x +#define V_FW_PARAMS_PARAM_FILTER_MODE(x) \ +((x) << S_FW_PARAMS_PARAM_FILTER_MODE) +#define G_FW_PARAMS_PARAM_FILTER_MODE(x) \ +(((x) >> S_FW_PARAMS_PARAM_FILTER_MODE) & \ + M_FW_PARAMS_PARAM_FILTER_MODE) + +#define S_FW_PARAMS_PARAM_FILTER_MASK 0 +#define M_FW_PARAMS_PARAM_FILTER_MASK 0x +#define V_FW_PARAMS_PARAM_FILTER_MASK(x) \ +((x) << S_FW_PARAMS_PARAM_FILTER_MASK) +#define G_FW_PARAMS_PARAM_FILTER_MASK(x) \ +(((x) >> S_FW_PARAMS_PARAM_FILTER_MASK) & \ + M_FW_PARAMS_PARAM_FILTER_MASK) + enum fw_params_param_dev { FW_PARAMS_PARAM_DEV_CCLK= 0x00, /* chip core clock in khz */ FW_PARAMS_PARAM_DEV_PORTVEC = 0x01, /* the port vector */ @@ -4799,6 +4830,14 @@ enum fw_params_param_dev { FW_PARAMS_PARAM_DEV_ADD_SMAC = 0x25, FW_PARAMS_PARAM_DEV_HPFILTER_REGION_SUPPORT = 0x26, FW_PARAMS_PARAM_DEV_OPAQUE_VIID_SMT_EXTN = 0x27, + FW_PARAMS_PARAM_DEV_HASHFILTER_WITH_OFLD = 0x28, + FW_PARAMS_PARAM_DEV_DBQ_TIMER = 0x29, + FW_PARAMS_PARAM_DEV_DBQ_TIMERTICK = 0x2A, + FW_PARAMS_PARAM_DEV_NUM_TM_CLASS= 0x2B, + FW_PARAMS_PARAM_DEV_VF_TRVLAN = 0x2C, + FW_PARAMS_PARAM_DEV_TCB_CACHE_FLUSH = 0x2D, + FW_PARAMS_PARAM_DEV_FILTER = 0x2E, + FW_PARAMS_PARAM_DEV_CLIP2_CMD = 0x2F, }; /* @@ -4827,8 +4866,14 @@ enum fw_params_param_dev_diag { FW_PARAM_DEV_DIAG_TMP = 0x00, FW_PARAM_DEV_DIAG_VDD = 0x01, FW_PARAM_DEV_DIAG_MAXTMPTHRESH = 0x02, + FW_PARAM_DEV_DIAG_RESET_TMP_SENSOR = 0x03, }; +enum fw_params_param_dev_filter{ + FW_PARAM_DEV_FILTER_VNIC_MODE = 0x00, + FW_PARAM_DEV_FILTER_MODE_MASK = 0x01, +}; + enum fw_params_param_dev_fwcache { FW_PARAM_DEV_FWCACHE_FLUSH = 0x00, FW_PARAM_DEV_FWCACHE_FLUSHINV = 0x01, @@ -4892,9 +4937,21 @@ enum fw_params_param_pfvf { FW_PARAMS_PARAM_PFVF_PPOD_EDRAM_START = 0x3B, FW_PARAMS_PARAM_PFVF_PPOD_EDRAM_END = 0x3C, FW_PARAMS_PARAM_PFVF_MAX_PKTS_PER_ETH_TX_PKTS_WR = 0x3D, + FW_PARAMS_PARAM_PFVF_GET_SMT_START = 0x3E, + FW_PARAMS_PARAM_PFVF_GET_SMT_SIZE = 0x3F, + FW_PARAMS_PARAM_PFVF_LINK_STATE = 0x40, }; /* + * virtual link state as seen by the specified VF + */ +enum vf_link_states { + VF_LINK_STA
svn commit: r354742 - head/sys/dev/cxgbe
Author: np Date: Fri Nov 15 18:48:14 2019 New Revision: 354742 URL: https://svnweb.freebsd.org/changeset/base/354742 Log: cxgbev(4): Catch up with the pciids in the PF driver. MFC after:3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_iov.c head/sys/dev/cxgbe/t4_vf.c Modified: head/sys/dev/cxgbe/t4_iov.c == --- head/sys/dev/cxgbe/t4_iov.c Fri Nov 15 18:42:13 2019(r354741) +++ head/sys/dev/cxgbe/t4_iov.c Fri Nov 15 18:48:14 2019(r354742) @@ -81,16 +81,10 @@ struct { {0x5012, "Chelsio T560-CR"}, /* 1 x 40G, 2 x 10G */ {0x5014, "Chelsio T580-LP-SO-CR"}, /* 2 x 40G, nomem */ {0x5015, "Chelsio T502-BT"}, /* 2 x 1G */ -#ifdef notyet - {0x5004, "Chelsio T520-BCH"}, - {0x5005, "Chelsio T540-BCH"}, - {0x5006, "Chelsio T540-CH"}, - {0x5008, "Chelsio T520-CX"}, - {0x500b, "Chelsio B520-SR"}, - {0x500c, "Chelsio B504-BT"}, - {0x500f, "Chelsio Amsterdam"}, - {0x5013, "Chelsio T580-CHR"}, -#endif + {0x5018, "Chelsio T540-BT"}, /* 4 x 10GBaseT */ + {0x5019, "Chelsio T540-LP-BT"},/* 4 x 10GBaseT */ + {0x501a, "Chelsio T540-SO-BT"},/* 4 x 10GBaseT, nomem */ + {0x501b, "Chelsio T540-SO-CR"},/* 4 x 10G, nomem */ }, t6iov_pciids[] = { {0x6000, "Chelsio T6-DBG-25"}, /* 2 x 10/25G, debug */ {0x6001, "Chelsio T6225-CR"}, /* 2 x 10/25G */ @@ -111,6 +105,12 @@ struct { /* Custom */ {0x6080, "Chelsio T6225 80"}, {0x6081, "Chelsio T62100 81"}, + {0x6082, "Chelsio T6225-CR 82"}, + {0x6083, "Chelsio T62100-CR 83"}, + {0x6084, "Chelsio T64100-CR 84"}, + {0x6085, "Chelsio T6240-SO 85"}, + {0x6086, "Chelsio T6225-SO-CR 86"}, + {0x6087, "Chelsio T6225-CR 87"}, }; static int t4iov_attach_child(device_t dev); Modified: head/sys/dev/cxgbe/t4_vf.c == --- head/sys/dev/cxgbe/t4_vf.c Fri Nov 15 18:42:13 2019(r354741) +++ head/sys/dev/cxgbe/t4_vf.c Fri Nov 15 18:48:14 2019(r354742) @@ -97,16 +97,10 @@ struct { {0x5812, "Chelsio T560-CR VF"},/* 1 x 40G, 2 x 10G */ {0x5814, "Chelsio T580-LP-SO-CR VF"}, /* 2 x 40G, nomem */ {0x5815, "Chelsio T502-BT VF"},/* 2 x 1G */ -#ifdef notyet - {0x5804, "Chelsio T520-BCH VF"}, - {0x5805, "Chelsio T540-BCH VF"}, - {0x5806, "Chelsio T540-CH VF"}, - {0x5808, "Chelsio T520-CX VF"}, - {0x580b, "Chelsio B520-SR VF"}, - {0x580c, "Chelsio B504-BT VF"}, - {0x580f, "Chelsio Amsterdam VF"}, - {0x5813, "Chelsio T580-CHR VF"}, -#endif + {0x5818, "Chelsio T540-BT VF"},/* 4 x 10GBaseT */ + {0x5819, "Chelsio T540-LP-BT VF"}, /* 4 x 10GBaseT */ + {0x581a, "Chelsio T540-SO-BT VF"}, /* 4 x 10GBaseT, nomem */ + {0x581b, "Chelsio T540-SO-CR VF"}, /* 4 x 10G, nomem */ }, t6vf_pciids[] = { {0x6800, "Chelsio T6-DBG-25 VF"}, /* 2 x 10/25G, debug */ {0x6801, "Chelsio T6225-CR VF"},/* 2 x 10/25G */ @@ -127,6 +121,12 @@ struct { /* Custom */ {0x6880, "Chelsio T6225 80 VF"}, {0x6881, "Chelsio T62100 81 VF"}, + {0x6882, "Chelsio T6225-CR 82 VF"}, + {0x6883, "Chelsio T62100-CR 83 VF"}, + {0x6884, "Chelsio T64100-CR 84 VF"}, + {0x6885, "Chelsio T6240-SO 85 VF"}, + {0x6886, "Chelsio T6225-SO-CR 86 VF"}, + {0x6887, "Chelsio T6225-CR 87 VF"}, }; static d_ioctl_t t4vf_ioctl; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r354522 - head/sys/dev/cxgbe
Author: np Date: Fri Nov 8 01:13:12 2019 New Revision: 354522 URL: https://svnweb.freebsd.org/changeset/base/354522 Log: cxgbe(4): Query Vdd from the firmware if its last known value is 0. TVSENSE may not be ready by the time t4_fw_initialize returns and the firmware returns 0 if the driver asks for the Vdd before the sensor is ready. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cFri Nov 8 00:01:37 2019 (r354521) +++ head/sys/dev/cxgbe/t4_main.cFri Nov 8 01:13:12 2019 (r354522) @@ -656,6 +656,7 @@ static int sysctl_fec(SYSCTL_HANDLER_ARGS); static int sysctl_autoneg(SYSCTL_HANDLER_ARGS); static int sysctl_handle_t4_reg64(SYSCTL_HANDLER_ARGS); static int sysctl_temperature(SYSCTL_HANDLER_ARGS); +static int sysctl_vdd(SYSCTL_HANDLER_ARGS); static int sysctl_loadavg(SYSCTL_HANDLER_ARGS); static int sysctl_cctrl(SYSCTL_HANDLER_ARGS); static int sysctl_cim_ibq_obq(SYSCTL_HANDLER_ARGS); @@ -6153,8 +6154,8 @@ t4_sysctls(struct adapter *sc) CTLFLAG_RD, sc, 0, sysctl_loadavg, "A", "microprocessor load averages (debug firmwares only)"); - SYSCTL_ADD_INT(ctx, children, OID_AUTO, "core_vdd", CTLFLAG_RD, - &sc->params.core_vdd, 0, "core Vdd (in mV)"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "core_vdd", CTLTYPE_INT | + CTLFLAG_RD, sc, 0, sysctl_vdd, "I", "core Vdd (in mV)"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "local_cpus", CTLTYPE_STRING | CTLFLAG_RD, sc, LOCAL_CPUS, @@ -7292,6 +7293,31 @@ sysctl_temperature(SYSCTL_HANDLER_ARGS) rc = sysctl_handle_int(oidp, &t, 0, req); return (rc); +} + +static int +sysctl_vdd(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + int rc; + uint32_t param, val; + + if (sc->params.core_vdd == 0) { + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, + "t4vdd"); + if (rc) + return (rc); + param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_DIAG) | + V_FW_PARAMS_PARAM_Y(FW_PARAM_DEV_DIAG_VDD); + rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, ¶m, &val); + end_synchronized_op(sc, 0); + if (rc) + return (rc); + sc->params.core_vdd = val; + } + + return (sysctl_handle_int(oidp, &sc->params.core_vdd, 0, req)); } static int ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r354210 - head/sys/dev/cxgbe/common
Author: np Date: Thu Oct 31 00:35:26 2019 New Revision: 354210 URL: https://svnweb.freebsd.org/changeset/base/354210 Log: cxgbe(4): Use correct size while converting lpacaps32 to native endianness. Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c == --- head/sys/dev/cxgbe/common/t4_hw.c Wed Oct 30 21:49:34 2019 (r354209) +++ head/sys/dev/cxgbe/common/t4_hw.c Thu Oct 31 00:35:26 2019 (r354210) @@ -8548,7 +8548,7 @@ static void handle_port_info(struct port_info *pi, con lc->supported = be32_to_cpu(p->u.info32.pcaps32); lc->advertising = be32_to_cpu(p->u.info32.acaps32); - lc->lp_advertising = be16_to_cpu(p->u.info32.lpacaps32); + lc->lp_advertising = be32_to_cpu(p->u.info32.lpacaps32); lc->link_ok = (stat & F_FW_PORT_CMD_LSTATUS32) != 0; lc->link_down_rc = G_FW_PORT_CMD_LINKDNRC32(stat); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r354110 - head/share/man/man4
Author: np Date: Fri Oct 25 22:39:26 2019 New Revision: 354110 URL: https://svnweb.freebsd.org/changeset/base/354110 Log: Fix typo in cxgbe.4. MFC after:1 week Modified: head/share/man/man4/cxgbe.4 Modified: head/share/man/man4/cxgbe.4 == --- head/share/man/man4/cxgbe.4 Fri Oct 25 22:17:24 2019(r354109) +++ head/share/man/man4/cxgbe.4 Fri Oct 25 22:39:26 2019(r354110) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Sep 24, 2018 +.Dd Oct 25, 2019 .Dt CXGBE 4 .Os .Sh NAME @@ -292,7 +292,7 @@ Settings can be displayed and controlled on a per-port dev..X.pause_settings sysctl. .It Va hw.cxgbe.fec FEC (Forward Error Correction) settings. -0 diables FEC. +0 disables FEC. Bit 0 enables RS FEC, bit 1 enables BASE-R FEC (aka Firecode FEC). The default is -1 which lets the driver pick a value. This tunable establishes the default FEC settings for all ports. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r354106 - in head/sys/dev/cxgbe: . common iw_cxgbe
Author: np Date: Fri Oct 25 21:53:05 2019 New Revision: 354106 URL: https://svnweb.freebsd.org/changeset/base/354106 Log: cxgbe(4): Use correct FetchBurstMin values for T6. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_regs_values.h head/sys/dev/cxgbe/iw_cxgbe/qp.c head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/common/t4_regs_values.h == --- head/sys/dev/cxgbe/common/t4_regs_values.h Fri Oct 25 21:52:02 2019 (r354105) +++ head/sys/dev/cxgbe/common/t4_regs_values.h Fri Oct 25 21:53:05 2019 (r354106) @@ -147,6 +147,11 @@ #define X_FETCHBURSTMIN_64B2 #define X_FETCHBURSTMIN_128B 3 +/* T6 and later use a single-bit encoding for FetchBurstMin */ +#define X_FETCHBURSTMIN_SHIFT_T6 6 +#define X_FETCHBURSTMIN_64B_T6 0 +#define X_FETCHBURSTMIN_128B_T61 + #define X_FETCHBURSTMAX_SHIFT 6 #define X_FETCHBURSTMAX_64B0 #define X_FETCHBURSTMAX_128B 1 Modified: head/sys/dev/cxgbe/iw_cxgbe/qp.c == --- head/sys/dev/cxgbe/iw_cxgbe/qp.cFri Oct 25 21:52:02 2019 (r354105) +++ head/sys/dev/cxgbe/iw_cxgbe/qp.cFri Oct 25 21:53:05 2019 (r354106) @@ -266,7 +266,8 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4 res->u.sqrq.dcaen_to_eqsize = cpu_to_be32( V_FW_RI_RES_WR_DCAEN(0) | V_FW_RI_RES_WR_DCACPU(0) | - V_FW_RI_RES_WR_FBMIN(2) | + V_FW_RI_RES_WR_FBMIN(chip_id(sc) <= CHELSIO_T5 ? + X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) | V_FW_RI_RES_WR_FBMAX(3) | V_FW_RI_RES_WR_CIDXFTHRESHO(0) | V_FW_RI_RES_WR_CIDXFTHRESH(0) | @@ -288,7 +289,8 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4 res->u.sqrq.dcaen_to_eqsize = cpu_to_be32( V_FW_RI_RES_WR_DCAEN(0) | V_FW_RI_RES_WR_DCACPU(0) | - V_FW_RI_RES_WR_FBMIN(2) | + V_FW_RI_RES_WR_FBMIN(chip_id(sc) <= CHELSIO_T5 ? + X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) | V_FW_RI_RES_WR_FBMAX(3) | V_FW_RI_RES_WR_CIDXFTHRESHO(0) | V_FW_RI_RES_WR_CIDXFTHRESH(0) | Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Fri Oct 25 21:52:02 2019 (r354105) +++ head/sys/dev/cxgbe/t4_netmap.c Fri Oct 25 21:53:05 2019 (r354106) @@ -159,7 +159,7 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq (black_hole == 2 ? F_FW_IQ_CMD_FL0PACKEN : 0)); c.fl0dcaen_to_fl0cidxfthresh = htobe16(V_FW_IQ_CMD_FL0FBMIN(chip_id(sc) <= CHELSIO_T5 ? - X_FETCHBURSTMIN_128B : X_FETCHBURSTMIN_64B) | + X_FETCHBURSTMIN_128B : X_FETCHBURSTMIN_64B_T6) | V_FW_IQ_CMD_FL0FBMAX(chip_id(sc) <= CHELSIO_T5 ? X_FETCHBURSTMAX_512B : X_FETCHBURSTMAX_256B)); c.fl0size = htobe16(na->num_rx_desc / 8 + sp->spg_len / EQ_ESIZE); @@ -274,9 +274,11 @@ alloc_nm_txq_hwq(struct vi_info *vi, struct sge_nm_txq htobe32(V_FW_EQ_ETH_CMD_HOSTFCMODE(X_HOSTFCMODE_NONE) | V_FW_EQ_ETH_CMD_PCIECHN(vi->pi->tx_chan) | F_FW_EQ_ETH_CMD_FETCHRO | V_FW_EQ_ETH_CMD_IQID(sc->sge.nm_rxq[nm_txq->iqidx].iq_cntxt_id)); - c.dcaen_to_eqsize = htobe32(V_FW_EQ_ETH_CMD_FBMIN(X_FETCHBURSTMIN_64B) | - V_FW_EQ_ETH_CMD_FBMAX(X_FETCHBURSTMAX_512B) | - V_FW_EQ_ETH_CMD_EQSIZE(len / EQ_ESIZE)); + c.dcaen_to_eqsize = + htobe32(V_FW_EQ_ETH_CMD_FBMIN(chip_id(sc) <= CHELSIO_T5 ? + X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) | + V_FW_EQ_ETH_CMD_FBMAX(X_FETCHBURSTMAX_512B) | + V_FW_EQ_ETH_CMD_EQSIZE(len / EQ_ESIZE)); c.eqaddr = htobe64(nm_txq->ba); rc = -t4_wr_mbox(sc, sc->mbox, &c, sizeof(c), &c); Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Fri Oct 25 21:52:02 2019(r354105) +++ head/sys/dev/cxgbe/t4_sge.c Fri Oct 25 21:53:05 2019(r354106) @@ -3212,7 +3212,7 @@ alloc_iq_fl(struct vi_info *vi, struct sge_iq *iq, str } c.fl0dcaen_to_fl0cidxfthresh = htobe16(V_FW_IQ_CMD_FL0FBMIN(chip_id(sc) <= CHELSIO_T5 ? - X_FETCHBURSTMIN_128B : X_FETCHBURSTMIN_64B) | + X_FETCHBURSTMIN_128B : X_FETCHBURSTMIN_64B_T6) | V_FW_IQ_CMD_FL0FBMAX(chip_id(sc) <= CHELSIO_T5 ? X_FETCHBURSTMAX_512B
svn commit: r353578 - head/sys/dev/cxgbe
Author: np Date: Tue Oct 15 17:35:39 2019 New Revision: 353578 URL: https://svnweb.freebsd.org/changeset/base/353578 Log: cxgbe(4): An EQ update can be requested in a TX_PKTS2 work request. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Tue Oct 15 17:30:12 2019(r353577) +++ head/sys/dev/cxgbe/t4_sge.c Tue Oct 15 17:35:39 2019(r353578) @@ -2849,6 +2849,7 @@ wr_can_update_eq(struct fw_eth_tx_pkts_wr *wr) case FW_ULPTX_WR: case FW_ETH_TX_PKT_WR: case FW_ETH_TX_PKTS_WR: + case FW_ETH_TX_PKTS2_WR: case FW_ETH_TX_PKT_VM_WR: return (1); default: ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346570 - in head/sys/dev/cxgbe: common tom
Author: np Date: Mon Apr 22 17:48:10 2019 New Revision: 346570 URL: https://svnweb.freebsd.org/changeset/base/346570 Log: cxgbe/t4_tom: Add a "TCB history" feature that samples hardware state for a tid and maintains a running history of some interesting events. Service TCP_INFO queries from the history when the tid is being tracked there. Modified: head/sys/dev/cxgbe/common/t4_msg.h head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/common/t4_msg.h == --- head/sys/dev/cxgbe/common/t4_msg.h Mon Apr 22 17:29:26 2019 (r346569) +++ head/sys/dev/cxgbe/common/t4_msg.h Mon Apr 22 17:48:10 2019 (r346570) @@ -923,7 +923,8 @@ struct cpl_get_tcb { WR_HDR; union opcode_tid ot; __be16 reply_ctrl; - __be16 cookie; + __u8 rsvd; + __u8 cookie; }; /* cpl_get_tcb.reply_ctrl fields */ Modified: head/sys/dev/cxgbe/tom/t4_tom.c == --- head/sys/dev/cxgbe/tom/t4_tom.c Mon Apr 22 17:29:26 2019 (r346569) +++ head/sys/dev/cxgbe/tom/t4_tom.c Mon Apr 22 17:48:10 2019 (r346570) @@ -386,55 +386,352 @@ t4_ctloutput(struct toedev *tod, struct tcpcb *tp, int } } -static inline int -get_tcb_bit(u_char *tcb, int bit) +static inline uint64_t +get_tcb_tflags(const uint64_t *tcb) { - int ix, shift; - ix = 127 - (bit >> 3); - shift = bit & 0x7; - - return ((tcb[ix] >> shift) & 1); + return ((be64toh(tcb[14]) << 32) | (be64toh(tcb[15]) >> 32)); } -static inline uint64_t -get_tcb_bits(u_char *tcb, int hi, int lo) +static inline uint32_t +get_tcb_field(const uint64_t *tcb, u_int word, uint32_t mask, u_int shift) { - uint64_t rc = 0; +#define LAST_WORD ((TCB_SIZE / 4) - 1) + uint64_t t1, t2; + int flit_idx; - while (hi >= lo) { - rc = (rc << 1) | get_tcb_bit(tcb, hi); - --hi; + MPASS(mask != 0); + MPASS(word <= LAST_WORD); + MPASS(shift < 32); + + flit_idx = (LAST_WORD - word) / 2; + if (word & 0x1) + shift += 32; + t1 = be64toh(tcb[flit_idx]) >> shift; + t2 = 0; + if (fls(mask) > 64 - shift) { + /* +* Will spill over into the next logical flit, which is the flit +* before this one. The flit_idx before this one must be valid. +*/ + MPASS(flit_idx > 0); + t2 = be64toh(tcb[flit_idx - 1]) << (64 - shift); } + return ((t2 | t1) & mask); +#undef LAST_WORD +} +#define GET_TCB_FIELD(tcb, F) \ +get_tcb_field(tcb, W_TCB_##F, M_TCB_##F, S_TCB_##F) +/* + * Issues a CPL_GET_TCB to read the entire TCB for the tid. + */ +static int +send_get_tcb(struct adapter *sc, u_int tid) +{ + struct cpl_get_tcb *cpl; + struct wrq_cookie cookie; + + MPASS(tid < sc->tids.ntids); + + cpl = start_wrq_wr(&sc->sge.ctrlq[0], howmany(sizeof(*cpl), 16), + &cookie); + if (__predict_false(cpl == NULL)) + return (ENOMEM); + bzero(cpl, sizeof(*cpl)); + INIT_TP_WR(cpl, tid); + OPCODE_TID(cpl) = htobe32(MK_OPCODE_TID(CPL_GET_TCB, tid)); + cpl->reply_ctrl = htobe16(V_REPLY_CHAN(0) | + V_QUEUENO(sc->sge.ofld_rxq[0].iq.cntxt_id)); + cpl->cookie = 0xff; + commit_wrq_wr(&sc->sge.ctrlq[0], cpl, &cookie); + + return (0); +} + +static struct tcb_histent * +alloc_tcb_histent(struct adapter *sc, u_int tid, int flags) +{ + struct tcb_histent *te; + + MPASS(flags == M_NOWAIT || flags == M_WAITOK); + + te = malloc(sizeof(*te), M_CXGBE, M_ZERO | flags); + if (te == NULL) + return (NULL); + mtx_init(&te->te_lock, "TCB entry", NULL, MTX_DEF); + callout_init_mtx(&te->te_callout, &te->te_lock, 0); + te->te_adapter = sc; + te->te_tid = tid; + + return (te); +} + +static void +free_tcb_histent(struct tcb_histent *te) +{ + + mtx_destroy(&te->te_lock); + free(te, M_CXGBE); +} + +/* + * Start tracking the tid in the TCB history. + */ +int +add_tid_to_history(struct adapter *sc, u_int tid) +{ + struct tcb_histent *te = NULL; + struct tom_data *td = sc->tom_softc; + int rc; + + MPASS(tid < sc->tids.ntids); + + if (td->tcb_history == NULL) + return (ENXIO); + + rw_wlock(&td->tcb_history_lock); + if (td->tcb_history[tid] != NULL) { + rc = EEXIST; + goto done; + } + te = alloc_tcb_histent(sc, tid, M_NOWAIT); + if (te == NULL) { + rc = ENOMEM; + goto done; + } + mtx_lock(&te->te_lock); + rc = send_get_tcb(sc, tid); + if (rc == 0) { + te->te_flags |= TE_RPL_PENDING; + td->tcb_history[tid] =
svn commit: r346567 - head/sys/dev/cxgbe
Author: np Date: Mon Apr 22 17:00:30 2019 New Revision: 346567 URL: https://svnweb.freebsd.org/changeset/base/346567 Log: cxgbe(4): Make sure bundled_fw is always initialized before use. This fixes a bug that prevented the driver from auto-flashing the firmware when it didn't see one on the card. This feature was introduced in r321390 and this bug was introduced in r343269. Reported by: gallatin@ MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cMon Apr 22 16:29:34 2019 (r346566) +++ head/sys/dev/cxgbe/t4_main.cMon Apr 22 17:00:30 2019 (r346567) @@ -3529,19 +3529,6 @@ install_kld_firmware(struct adapter *sc, struct fw_h * load_attempted = false; fw_install = t4_fw_install < 0 ? -t4_fw_install : t4_fw_install; - if (reason != NULL) - goto install; - - if ((sc->flags & FW_OK) == 0) { - - if (c == 0x) { - reason = "missing"; - goto install; - } - - return (0); - } - memcpy(&bundled_fw, drv_fw, sizeof(bundled_fw)); if (t4_fw_install < 0) { rc = load_fw_module(sc, &cfg, &fw); @@ -3557,6 +3544,20 @@ install_kld_firmware(struct adapter *sc, struct fw_h * load_attempted = true; } d = be32toh(bundled_fw.fw_ver); + + if (reason != NULL) + goto install; + + if ((sc->flags & FW_OK) == 0) { + + if (c == 0x) { + reason = "missing"; + goto install; + } + + rc = 0; + goto done; + } if (!fw_compatible(card_fw, &bundled_fw)) { reason = "incompatible or unusable"; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"