Provide compile to choose receive processing in either Ithread or Taskqueue Thread.

This commit is contained in:
David C Somayajulu 2017-08-09 22:18:49 +00:00
parent 6b39e3acdc
commit b284b46dc4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=322331
3 changed files with 122 additions and 43 deletions

View File

@ -397,9 +397,13 @@ qlnx_fp_taskqueue(void *context, int pending)
struct ifnet *ifp; struct ifnet *ifp;
struct mbuf *mp; struct mbuf *mp;
int ret = -1; int ret = -1;
struct thread *cthread;
#ifdef QLNX_RCV_IN_TASKQ
int lro_enable; int lro_enable;
int rx_int = 0, total_rx_count = 0; int rx_int = 0, total_rx_count = 0;
struct thread *cthread;
#endif /* #ifdef QLNX_RCV_IN_TASKQ */
fp = context; fp = context;
@ -419,54 +423,59 @@ qlnx_fp_taskqueue(void *context, int pending)
ifp = ha->ifp; ifp = ha->ifp;
lro_enable = ha->ifp->if_capenable & IFCAP_LRO; #ifdef QLNX_RCV_IN_TASKQ
{
lro_enable = ifp->if_capenable & IFCAP_LRO;
rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable); rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable);
if (rx_int) { if (rx_int) {
fp->rx_pkts += rx_int; fp->rx_pkts += rx_int;
total_rx_count += rx_int; total_rx_count += rx_int;
} }
#ifdef QLNX_SOFT_LRO #ifdef QLNX_SOFT_LRO
{ {
struct lro_ctrl *lro; struct lro_ctrl *lro;
lro = &fp->rxq->lro;
lro = &fp->rxq->lro; if (lro_enable && total_rx_count) {
if (lro_enable && total_rx_count) {
#if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO)
if (ha->dbg_trace_lro_cnt) { if (ha->dbg_trace_lro_cnt) {
if (lro->lro_mbuf_count & ~1023) if (lro->lro_mbuf_count & ~1023)
fp->lro_cnt_1024++; fp->lro_cnt_1024++;
else if (lro->lro_mbuf_count & ~511) else if (lro->lro_mbuf_count & ~511)
fp->lro_cnt_512++; fp->lro_cnt_512++;
else if (lro->lro_mbuf_count & ~255) else if (lro->lro_mbuf_count & ~255)
fp->lro_cnt_256++; fp->lro_cnt_256++;
else if (lro->lro_mbuf_count & ~127) else if (lro->lro_mbuf_count & ~127)
fp->lro_cnt_128++; fp->lro_cnt_128++;
else if (lro->lro_mbuf_count & ~63) else if (lro->lro_mbuf_count & ~63)
fp->lro_cnt_64++; fp->lro_cnt_64++;
} }
tcp_lro_flush_all(lro); tcp_lro_flush_all(lro);
#else #else
struct lro_entry *queued; struct lro_entry *queued;
while ((!SLIST_EMPTY(&lro->lro_active))) { while ((!SLIST_EMPTY(&lro->lro_active))) {
queued = SLIST_FIRST(&lro->lro_active); queued = SLIST_FIRST(&lro->lro_active);
SLIST_REMOVE_HEAD(&lro->lro_active, next); SLIST_REMOVE_HEAD(&lro->lro_active, next);
tcp_lro_flush(lro, queued); tcp_lro_flush(lro, queued);
} }
#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ #endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */
}
} }
}
#endif /* #ifdef QLNX_SOFT_LRO */ #endif /* #ifdef QLNX_SOFT_LRO */
ecore_sb_update_sb_idx(fp->sb_info); ecore_sb_update_sb_idx(fp->sb_info);
rmb(); rmb();
}
#endif /* #ifdef QLNX_RCV_IN_TASKQ */
mtx_lock(&fp->tx_mtx); mtx_lock(&fp->tx_mtx);
@ -477,10 +486,6 @@ qlnx_fp_taskqueue(void *context, int pending)
goto qlnx_fp_taskqueue_exit; goto qlnx_fp_taskqueue_exit;
} }
// for (tc = 0; tc < ha->num_tc; tc++) {
// (void)qlnx_tx_int(ha, fp, fp->txq[tc]);
// }
mp = drbr_peek(ifp, fp->tx_br); mp = drbr_peek(ifp, fp->tx_br);
while (mp != NULL) { while (mp != NULL) {
@ -516,13 +521,11 @@ qlnx_fp_taskqueue(void *context, int pending)
mp = drbr_peek(ifp, fp->tx_br); mp = drbr_peek(ifp, fp->tx_br);
} }
// for (tc = 0; tc < ha->num_tc; tc++) {
// (void)qlnx_tx_int(ha, fp, fp->txq[tc]);
// }
mtx_unlock(&fp->tx_mtx); mtx_unlock(&fp->tx_mtx);
qlnx_fp_taskqueue_exit: qlnx_fp_taskqueue_exit:
#ifdef QLNX_RCV_IN_TASKQ
if (rx_int) { if (rx_int) {
if (fp->fp_taskqueue != NULL) if (fp->fp_taskqueue != NULL)
taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task);
@ -532,6 +535,7 @@ qlnx_fp_taskqueue(void *context, int pending)
} }
ecore_sb_ack(fp->sb_info, IGU_INT_ENABLE, 1); ecore_sb_ack(fp->sb_info, IGU_INT_ENABLE, 1);
} }
#endif /* #ifdef QLNX_RCV_IN_TASKQ */
QL_DPRINT2(ha, "exit ret = %d\n", ret); QL_DPRINT2(ha, "exit ret = %d\n", ret);
return; return;
@ -4262,6 +4266,7 @@ qlnx_rx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, int budget,
return rx_pkt; return rx_pkt;
} }
/* /*
* fast path interrupt * fast path interrupt
*/ */
@ -4292,9 +4297,82 @@ qlnx_fp_isr(void *arg)
if (fp == NULL) { if (fp == NULL) {
ha->err_fp_null++; ha->err_fp_null++;
} else { } else {
#ifdef QLNX_RCV_IN_TASKQ
ecore_sb_ack(fp->sb_info, IGU_INT_DISABLE, 0); ecore_sb_ack(fp->sb_info, IGU_INT_DISABLE, 0);
if (fp->fp_taskqueue != NULL) if (fp->fp_taskqueue != NULL)
taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task);
#else
int rx_int = 0, total_rx_count = 0;
int lro_enable, tc;
lro_enable = ha->ifp->if_capenable & IFCAP_LRO;
ecore_sb_ack(fp->sb_info, IGU_INT_DISABLE, 0);
do {
for (tc = 0; tc < ha->num_tc; tc++) {
if (mtx_trylock(&fp->tx_mtx)) {
qlnx_tx_int(ha, fp, fp->txq[tc]);
mtx_unlock(&fp->tx_mtx);
}
}
rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold,
lro_enable);
if (rx_int) {
fp->rx_pkts += rx_int;
total_rx_count += rx_int;
}
} while (rx_int);
#ifdef QLNX_SOFT_LRO
{
struct lro_ctrl *lro;
lro = &fp->rxq->lro;
if (lro_enable && total_rx_count) {
#if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO)
#ifdef QLNX_TRACE_LRO_CNT
if (lro->lro_mbuf_count & ~1023)
fp->lro_cnt_1024++;
else if (lro->lro_mbuf_count & ~511)
fp->lro_cnt_512++;
else if (lro->lro_mbuf_count & ~255)
fp->lro_cnt_256++;
else if (lro->lro_mbuf_count & ~127)
fp->lro_cnt_128++;
else if (lro->lro_mbuf_count & ~63)
fp->lro_cnt_64++;
#endif /* #ifdef QLNX_TRACE_LRO_CNT */
tcp_lro_flush_all(lro);
#else
struct lro_entry *queued;
while ((!SLIST_EMPTY(&lro->lro_active))) {
queued = SLIST_FIRST(&lro->lro_active);
SLIST_REMOVE_HEAD(&lro->lro_active, \
next);
tcp_lro_flush(lro, queued);
}
#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */
}
}
#endif /* #ifdef QLNX_SOFT_LRO */
ecore_sb_update_sb_idx(fp->sb_info);
rmb();
ecore_sb_ack(fp->sb_info, IGU_INT_ENABLE, 1);
#endif /* #ifdef QLNX_RCV_IN_TASKQ */
} }
return; return;

View File

@ -39,5 +39,5 @@
#define QLNX_VERSION_MAJOR 1 #define QLNX_VERSION_MAJOR 1
#define QLNX_VERSION_MINOR 4 #define QLNX_VERSION_MINOR 4
#define QLNX_VERSION_BUILD 5 #define QLNX_VERSION_BUILD 6

View File

@ -65,5 +65,6 @@ CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
#CFLAGS += -DQLNX_SOFT_LRO #CFLAGS += -DQLNX_SOFT_LRO
#CFLAGS += -DQLNX_QSORT_LRO #CFLAGS += -DQLNX_QSORT_LRO
#CFLAGS += -DQLNX_MAX_COALESCE #CFLAGS += -DQLNX_MAX_COALESCE
#CFLAGS += -DQLNX_RCV_IN_TASKQ
CWARNFLAGS+= -Wno-cast-qual CWARNFLAGS+= -Wno-cast-qual