View | Details | Raw Unified | Return to bug 248652 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/dev/ixl/ixl_txrx.c (-2 / +4 lines)
Lines 333-339 ixl_tso_setup(struct tx_ring *txr, if_pkt_info_t pi) Link Here
333
 *  	- return 0 on success, positive on failure
333
 *  	- return 0 on success, positive on failure
334
  *
334
  *
335
  **********************************************************************/
335
  **********************************************************************/
336
#define IXL_TXD_CMD (I40E_TX_DESC_CMD_EOP | I40E_TX_DESC_CMD_RS)
337
336
338
static int
337
static int
339
ixl_isc_txd_encap(void *arg, if_pkt_info_t pi)
338
ixl_isc_txd_encap(void *arg, if_pkt_info_t pi)
Lines 398-404 ixl_isc_txd_encap(void *arg, if_pkt_info_t pi) Link Here
398
	}
397
	}
399
	/* Set the last descriptor for report */
398
	/* Set the last descriptor for report */
400
	txd->cmd_type_offset_bsz |=
399
	txd->cmd_type_offset_bsz |=
401
	    htole64(((u64)IXL_TXD_CMD << I40E_TXD_QW1_CMD_SHIFT));
400
	    htole64(((u64)I40E_TX_DESC_CMD_EOP << I40E_TXD_QW1_CMD_SHIFT));
401
	if (tx_intr)
402
		txd->cmd_type_offset_bsz |=
403
		    htole64(((u64)I40E_TX_DESC_CMD_RS << I40E_TXD_QW1_CMD_SHIFT));
402
	/* Add to report status array (if using TX interrupts) */
404
	/* Add to report status array (if using TX interrupts) */
403
	if (!vsi->enable_head_writeback && tx_intr) {
405
	if (!vsi->enable_head_writeback && tx_intr) {
404
		txr->tx_rsq[txr->tx_rs_pidx] = pidx_last;
406
		txr->tx_rsq[txr->tx_rs_pidx] = pidx_last;
(-)b/sys/net/iflib.c (-40 / +38 lines)
Lines 190-195 struct iflib_ctx { Link Here
190
	uint16_t ifc_sysctl_nrxqs;
190
	uint16_t ifc_sysctl_nrxqs;
191
	uint16_t ifc_sysctl_qs_eq_override;
191
	uint16_t ifc_sysctl_qs_eq_override;
192
	uint16_t ifc_sysctl_rx_budget;
192
	uint16_t ifc_sysctl_rx_budget;
193
	uint16_t ifc_sysctl_nm_tx_tmr_us;
193
	uint16_t ifc_sysctl_tx_abdicate;
194
	uint16_t ifc_sysctl_tx_abdicate;
194
	uint16_t ifc_sysctl_core_offset;
195
	uint16_t ifc_sysctl_core_offset;
195
#define	CORE_OFFSET_UNSPECIFIED	0xffff
196
#define	CORE_OFFSET_UNSPECIFIED	0xffff
Lines 346-351 struct iflib_txq { Link Here
346
	qidx_t		ift_size;
347
	qidx_t		ift_size;
347
	uint16_t	ift_id;
348
	uint16_t	ift_id;
348
	struct callout	ift_timer;
349
	struct callout	ift_timer;
350
#ifdef DEV_NETMAP
351
	struct callout	ift_netmap_timer;
352
#endif /* DEV_NETMAP */
349
353
350
	if_txsd_vec_t	ift_sds;
354
	if_txsd_vec_t	ift_sds;
351
	uint8_t		ift_qstatus;
355
	uint8_t		ift_qstatus;
Lines 753-758 iflib_num_tx_descs(if_ctx_t ctx) Link Here
753
MODULE_DEPEND(iflib, netmap, 1, 1, 1);
757
MODULE_DEPEND(iflib, netmap, 1, 1, 1);
754
758
755
static int netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init);
759
static int netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init);
760
static void iflib_netmap_timer(void *arg);
756
761
757
/*
762
/*
758
 * device-specific sysctl variables:
763
 * device-specific sysctl variables:
Lines 1058-1068 iflib_netmap_txsync(struct netmap_kring *kring, int flags) Link Here
1058
			kring->nr_hwtail = nm_prev(netmap_idx_n2k(kring, nic_i), lim);
1063
			kring->nr_hwtail = nm_prev(netmap_idx_n2k(kring, nic_i), lim);
1059
		}
1064
		}
1060
	}
1065
	}
1066
1061
	if (!(ctx->ifc_flags & IFC_NETMAP_TX_IRQ))
1067
	if (!(ctx->ifc_flags & IFC_NETMAP_TX_IRQ))
1062
		if (kring->nr_hwtail != nm_prev(kring->nr_hwcur, lim)) {
1068
		if (kring->nr_hwtail != nm_prev(kring->nr_hwcur, lim)) {
1063
			callout_reset_on(&txq->ift_timer, hz < 2000 ? 1 : hz / 1000,
1069
			uint16_t timer_us = ctx->ifc_sysctl_nm_tx_tmr_us;
1064
			    iflib_timer, txq, txq->ift_timer.c_cpu);
1070
1065
	}
1071
			if (timer_us == 0)
1072
				timer_us = 500;
1073
			callout_reset_sbt(&txq->ift_netmap_timer,
1074
			    timer_us * SBT_1US, SBT_1US, iflib_netmap_timer,
1075
			    txq, 0);
1076
		}
1066
	return (0);
1077
	return (0);
1067
}
1078
}
1068
1079
Lines 1263-1290 iflib_netmap_rxq_init(if_ctx_t ctx, iflib_rxq_t rxq) Link Here
1263
}
1274
}
1264
1275
1265
static void
1276
static void
1266
iflib_netmap_timer_adjust(if_ctx_t ctx, iflib_txq_t txq, uint32_t *reset_on)
1277
iflib_netmap_timer(void *arg)
1267
{
1278
{
1268
	struct netmap_kring *kring;
1279
	iflib_txq_t txq = arg;
1269
	uint16_t txqid;
1280
	if_ctx_t ctx = txq->ift_ctx;
1270
1271
	txqid = txq->ift_id;
1272
	kring = netmap_kring_on(NA(ctx->ifc_ifp), txqid, NR_TX);
1273
	if (kring == NULL)
1274
		return;
1275
1281
1276
	if (kring->nr_hwcur != nm_next(kring->nr_hwtail, kring->nkr_num_slots - 1)) {
1282
	netmap_tx_irq(ctx->ifc_ifp, txq->ift_id);
1277
		bus_dmamap_sync(txq->ift_ifdi->idi_tag, txq->ift_ifdi->idi_map,
1278
		    BUS_DMASYNC_POSTREAD);
1279
		if (ctx->isc_txd_credits_update(ctx->ifc_softc, txqid, false))
1280
			netmap_tx_irq(ctx->ifc_ifp, txqid);
1281
		if (!(ctx->ifc_flags & IFC_NETMAP_TX_IRQ)) {
1282
			if (hz < 2000)
1283
				*reset_on = 1;
1284
			else
1285
				*reset_on = hz / 1000;
1286
		}
1287
	}
1288
}
1283
}
1289
1284
1290
#define iflib_netmap_detach(ifp) netmap_detach(ifp)
1285
#define iflib_netmap_detach(ifp) netmap_detach(ifp)
Lines 1296-1303 iflib_netmap_timer_adjust(if_ctx_t ctx, iflib_txq_t txq, uint32_t *reset_on) Link Here
1296
1291
1297
#define iflib_netmap_attach(ctx) (0)
1292
#define iflib_netmap_attach(ctx) (0)
1298
#define netmap_rx_irq(ifp, qid, budget) (0)
1293
#define netmap_rx_irq(ifp, qid, budget) (0)
1299
#define netmap_tx_irq(ifp, qid) do {} while (0)
1300
#define iflib_netmap_timer_adjust(ctx, txq, reset_on)
1301
#endif
1294
#endif
1302
1295
1303
#if defined(__i386__) || defined(__amd64__)
1296
#if defined(__i386__) || defined(__amd64__)
Lines 2287-2293 iflib_timer(void *arg) Link Here
2287
	if_ctx_t ctx = txq->ift_ctx;
2280
	if_ctx_t ctx = txq->ift_ctx;
2288
	if_softc_ctx_t sctx = &ctx->ifc_softc_ctx;
2281
	if_softc_ctx_t sctx = &ctx->ifc_softc_ctx;
2289
	uint64_t this_tick = ticks;
2282
	uint64_t this_tick = ticks;
2290
	uint32_t reset_on = hz / 2;
2291
2283
2292
	if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING))
2284
	if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING))
2293
		return;
2285
		return;
Lines 2312-2328 iflib_timer(void *arg) Link Here
2312
		}
2304
		}
2313
		txq->ift_cleaned_prev = txq->ift_cleaned;
2305
		txq->ift_cleaned_prev = txq->ift_cleaned;
2314
	}
2306
	}
2315
#ifdef DEV_NETMAP
2316
	if (if_getcapenable(ctx->ifc_ifp) & IFCAP_NETMAP)
2317
		iflib_netmap_timer_adjust(ctx, txq, &reset_on);
2318
#endif
2319
	/* handle any laggards */
2307
	/* handle any laggards */
2320
	if (txq->ift_db_pending)
2308
	if (txq->ift_db_pending)
2321
		GROUPTASK_ENQUEUE(&txq->ift_task);
2309
		GROUPTASK_ENQUEUE(&txq->ift_task);
2322
2310
2323
	sctx->isc_pause_frames = 0;
2311
	sctx->isc_pause_frames = 0;
2324
	if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING) 
2312
	if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING) 
2325
		callout_reset_on(&txq->ift_timer, reset_on, iflib_timer, txq, txq->ift_timer.c_cpu);
2313
		callout_reset_on(&txq->ift_timer, hz / 2, iflib_timer, txq, txq->ift_timer.c_cpu);
2326
	return;
2314
	return;
2327
2315
2328
 hung:
2316
 hung:
Lines 2396-2401 iflib_init_locked(if_ctx_t ctx) Link Here
2396
	for (i = 0, txq = ctx->ifc_txqs; i < sctx->isc_ntxqsets; i++, txq++) {
2384
	for (i = 0, txq = ctx->ifc_txqs; i < sctx->isc_ntxqsets; i++, txq++) {
2397
		CALLOUT_LOCK(txq);
2385
		CALLOUT_LOCK(txq);
2398
		callout_stop(&txq->ift_timer);
2386
		callout_stop(&txq->ift_timer);
2387
#ifdef DEV_NETMAP
2388
		callout_stop(&txq->ift_netmap_timer);
2389
#endif /* DEV_NETMAP */
2399
		CALLOUT_UNLOCK(txq);
2390
		CALLOUT_UNLOCK(txq);
2400
		iflib_netmap_txq_init(ctx, txq);
2391
		iflib_netmap_txq_init(ctx, txq);
2401
	}
2392
	}
Lines 2485-2490 iflib_stop(if_ctx_t ctx) Link Here
2485
2476
2486
		CALLOUT_LOCK(txq);
2477
		CALLOUT_LOCK(txq);
2487
		callout_stop(&txq->ift_timer);
2478
		callout_stop(&txq->ift_timer);
2479
#ifdef DEV_NETMAP
2480
		callout_stop(&txq->ift_netmap_timer);
2481
#endif /* DEV_NETMAP */
2488
		CALLOUT_UNLOCK(txq);
2482
		CALLOUT_UNLOCK(txq);
2489
2483
2490
		/* clean any enqueued buffers */
2484
		/* clean any enqueued buffers */
Lines 3882-3888 _task_fn_admin(void *context) Link Here
3882
	iflib_txq_t txq;
3876
	iflib_txq_t txq;
3883
	int i;
3877
	int i;
3884
	bool oactive, running, do_reset, do_watchdog, in_detach;
3878
	bool oactive, running, do_reset, do_watchdog, in_detach;
3885
	uint32_t reset_on = hz / 2;
3886
3879
3887
	STATE_LOCK(ctx);
3880
	STATE_LOCK(ctx);
3888
	running = (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING);
3881
	running = (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING);
Lines 3910-3921 _task_fn_admin(void *context) Link Here
3910
	}
3903
	}
3911
	IFDI_UPDATE_ADMIN_STATUS(ctx);
3904
	IFDI_UPDATE_ADMIN_STATUS(ctx);
3912
	for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, txq++) {
3905
	for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, txq++) {
3913
#ifdef DEV_NETMAP
3906
		callout_reset_on(&txq->ift_timer, hz / 2, iflib_timer, txq, txq->ift_timer.c_cpu);
3914
		reset_on = hz / 2;
3915
		if (if_getcapenable(ctx->ifc_ifp) & IFCAP_NETMAP)
3916
			iflib_netmap_timer_adjust(ctx, txq, &reset_on);
3917
#endif
3918
		callout_reset_on(&txq->ift_timer, reset_on, iflib_timer, txq, txq->ift_timer.c_cpu);
3919
	}
3907
	}
3920
	IFDI_LINK_INTR_ENABLE(ctx);
3908
	IFDI_LINK_INTR_ENABLE(ctx);
3921
	if (do_reset)
3909
	if (do_reset)
Lines 5088-5093 iflib_pseudo_deregister(if_ctx_t ctx) Link Here
5088
	tqg = qgroup_if_io_tqg;
5076
	tqg = qgroup_if_io_tqg;
5089
	for (txq = ctx->ifc_txqs, i = 0; i < NTXQSETS(ctx); i++, txq++) {
5077
	for (txq = ctx->ifc_txqs, i = 0; i < NTXQSETS(ctx); i++, txq++) {
5090
		callout_drain(&txq->ift_timer);
5078
		callout_drain(&txq->ift_timer);
5079
#ifdef DEV_NETMAP
5080
		callout_drain(&txq->ift_netmap_timer);
5081
#endif /* DEV_NETMAP */
5091
		if (txq->ift_task.gt_uniq != NULL)
5082
		if (txq->ift_task.gt_uniq != NULL)
5092
			taskqgroup_detach(tqg, &txq->ift_task);
5083
			taskqgroup_detach(tqg, &txq->ift_task);
5093
	}
5084
	}
Lines 5174-5179 iflib_device_deregister(if_ctx_t ctx) Link Here
5174
	tqg = qgroup_if_io_tqg;
5165
	tqg = qgroup_if_io_tqg;
5175
	for (txq = ctx->ifc_txqs, i = 0; i < NTXQSETS(ctx); i++, txq++) {
5166
	for (txq = ctx->ifc_txqs, i = 0; i < NTXQSETS(ctx); i++, txq++) {
5176
		callout_drain(&txq->ift_timer);
5167
		callout_drain(&txq->ift_timer);
5168
#ifdef DEV_NETMAP
5169
		callout_drain(&txq->ift_netmap_timer);
5170
#endif /* DEV_NETMAP */
5177
		if (txq->ift_task.gt_uniq != NULL)
5171
		if (txq->ift_task.gt_uniq != NULL)
5178
			taskqgroup_detach(tqg, &txq->ift_task);
5172
			taskqgroup_detach(tqg, &txq->ift_task);
5179
	}
5173
	}
Lines 5583-5590 iflib_queues_alloc(if_ctx_t ctx) Link Here
5583
		} else {
5577
		} else {
5584
			txq->ift_br_offset = 0;
5578
			txq->ift_br_offset = 0;
5585
		}
5579
		}
5586
		/* XXX fix this */
5587
		txq->ift_timer.c_cpu = cpu;
5588
5580
5589
		if (iflib_txsd_alloc(txq)) {
5581
		if (iflib_txsd_alloc(txq)) {
5590
			device_printf(dev, "Critical Failure setting up TX buffers\n");
5582
			device_printf(dev, "Critical Failure setting up TX buffers\n");
Lines 5597-5602 iflib_queues_alloc(if_ctx_t ctx) Link Here
5597
		    device_get_nameunit(dev), txq->ift_id);
5589
		    device_get_nameunit(dev), txq->ift_id);
5598
		mtx_init(&txq->ift_mtx, txq->ift_mtx_name, NULL, MTX_DEF);
5590
		mtx_init(&txq->ift_mtx, txq->ift_mtx_name, NULL, MTX_DEF);
5599
		callout_init_mtx(&txq->ift_timer, &txq->ift_mtx, 0);
5591
		callout_init_mtx(&txq->ift_timer, &txq->ift_mtx, 0);
5592
#ifdef DEV_NETMAP
5593
		callout_init_mtx(&txq->ift_netmap_timer, &txq->ift_mtx, 0);
5594
#endif /* DEV_NETMAP */
5600
5595
5601
		err = ifmp_ring_alloc(&txq->ift_br, 2048, txq, iflib_txq_drain,
5596
		err = ifmp_ring_alloc(&txq->ift_br, 2048, txq, iflib_txq_drain,
5602
				      iflib_txq_can_drain, M_IFLIB, M_WAITOK);
5597
				      iflib_txq_can_drain, M_IFLIB, M_WAITOK);
Lines 6610-6615 iflib_add_device_sysctl_pre(if_ctx_t ctx) Link Here
6610
	SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "rx_budget",
6605
	SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "rx_budget",
6611
		       CTLFLAG_RWTUN, &ctx->ifc_sysctl_rx_budget, 0,
6606
		       CTLFLAG_RWTUN, &ctx->ifc_sysctl_rx_budget, 0,
6612
		       "set the RX budget");
6607
		       "set the RX budget");
6608
	SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "nm_tx_tmr_us",
6609
		       CTLFLAG_RWTUN, &ctx->ifc_sysctl_nm_tx_tmr_us, 0,
6610
		       "set the TX netmap timer period");
6613
	SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "tx_abdicate",
6611
	SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "tx_abdicate",
6614
		       CTLFLAG_RWTUN, &ctx->ifc_sysctl_tx_abdicate, 0,
6612
		       CTLFLAG_RWTUN, &ctx->ifc_sysctl_tx_abdicate, 0,
6615
		       "cause TX to abdicate instead of running to completion");
6613
		       "cause TX to abdicate instead of running to completion");

Return to bug 248652