Make full use of the pool of worker threads instead of using the first one all
the time.
This commit is contained in:
parent
bf92350c27
commit
eb1856df53
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/cxl_iscsi/; revision=291664
@ -90,6 +90,10 @@ __FBSDID("$FreeBSD$");
|
||||
#include "cxgbei.h"
|
||||
#include "cxgbei_ulp2_ddp.h"
|
||||
|
||||
static int worker_thread_count;
|
||||
static struct cxgbei_worker_thread_softc *cwt_softc;
|
||||
static struct proc *cxgbei_proc;
|
||||
|
||||
/* XXXNP some header instead. */
|
||||
struct icl_pdu *icl_cxgbei_new_pdu(int);
|
||||
void icl_cxgbei_new_pdu_set_conn(struct icl_pdu *, struct icl_conn *);
|
||||
@ -718,7 +722,7 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
|
||||
|
||||
STAILQ_INSERT_TAIL(&icc->rcvd_pdus, ip, ip_next);
|
||||
if ((icc->rx_flags & RXF_ACTIVE) == 0) {
|
||||
struct cxgbei_worker_thread_softc *cwt = icc->cwt;
|
||||
struct cxgbei_worker_thread_softc *cwt = &cwt_softc[icc->cwt];
|
||||
|
||||
mtx_lock(&cwt->cwt_lock);
|
||||
icc->rx_flags |= RXF_ACTIVE;
|
||||
@ -884,10 +888,6 @@ static struct uld_info cxgbei_uld_info = {
|
||||
.deactivate = cxgbei_deactivate,
|
||||
};
|
||||
|
||||
static int worker_thread_count;
|
||||
static struct cxgbei_worker_thread_softc *cwt_softc;
|
||||
static struct proc *cxgbei_proc;
|
||||
|
||||
static void
|
||||
cwt_main(void *arg)
|
||||
{
|
||||
@ -1036,6 +1036,25 @@ stop_worker_threads(void)
|
||||
free(cwt_softc, M_CXGBE);
|
||||
}
|
||||
|
||||
/* Select a worker thread for a connection. */
|
||||
u_int
|
||||
cxgbei_select_worker_thread(struct icl_cxgbei_conn *icc)
|
||||
{
|
||||
struct adapter *sc = icc->sc;
|
||||
struct toepcb *toep = icc->toep;
|
||||
u_int i, n;
|
||||
|
||||
n = worker_thread_count / sc->sge.nofldrxq;
|
||||
if (n > 0)
|
||||
i = toep->port->port_id * n + arc4random() % n;
|
||||
else
|
||||
i = arc4random() % worker_thread_count;
|
||||
|
||||
CTR3(KTR_CXGBE, "%s: tid %u, cwt %u", __func__, toep->tid, i);
|
||||
|
||||
return (i);
|
||||
}
|
||||
|
||||
static int
|
||||
cxgbei_mod_load(void)
|
||||
{
|
||||
|
@ -61,9 +61,9 @@ struct icl_cxgbei_conn {
|
||||
|
||||
/* Receive related. */
|
||||
u_int rx_flags; /* protected by so_rcv lock */
|
||||
u_int cwt;
|
||||
STAILQ_HEAD(, icl_pdu) rcvd_pdus; /* protected by so_rcv lock */
|
||||
TAILQ_ENTRY(icl_cxgbei_conn) rx_link; /* protected by cwt lock */
|
||||
struct cxgbei_worker_thread_softc *cwt;
|
||||
};
|
||||
|
||||
static inline struct icl_cxgbei_conn *
|
||||
@ -153,6 +153,7 @@ struct cxgbei_data {
|
||||
void cxgbei_conn_task_reserve_itt(void *, void **, void *, unsigned int *);
|
||||
void cxgbei_conn_transfer_reserve_ttt(void *, void **, void *, unsigned int *);
|
||||
void cxgbei_cleanup_task(void *, void *);
|
||||
u_int cxgbei_select_worker_thread(struct icl_cxgbei_conn *);
|
||||
|
||||
struct cxgbei_ulp2_pagepod_hdr;
|
||||
int t4_ddp_set_map(struct cxgbei_data *, void *,
|
||||
|
@ -597,9 +597,6 @@ set_ulp_mode_iscsi(struct adapter *sc, struct toepcb *toep, int hcrc, int dcrc)
|
||||
t4_set_tcb_field(sc, toep, 1, 0, 0xfff, val);
|
||||
}
|
||||
|
||||
/* XXXNP */
|
||||
extern struct cxgbei_worker_thread_softc *cwt_softc;
|
||||
|
||||
/*
|
||||
* XXXNP: Who is responsible for cleaning up the socket if this returns with an
|
||||
* error? Review all error paths.
|
||||
@ -681,7 +678,7 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd)
|
||||
toep = tp->t_toe;
|
||||
MPASS(toep->port->adapter == icc->sc);
|
||||
icc->toep = toep;
|
||||
icc->cwt = &cwt_softc[0]; /* XXXNP */
|
||||
icc->cwt = cxgbei_select_worker_thread(icc);
|
||||
icc->ulp_submode = 0;
|
||||
if (ic->ic_header_crc32c)
|
||||
icc->ulp_submode |= ULP_CRC_HEADER;
|
||||
|
Loading…
Reference in New Issue
Block a user