Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/cxgbe/cxgbei/cxgbei.c
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
#include "cxgbei.h" | #include "cxgbei.h" | ||||
static int worker_thread_count; | static int worker_thread_count; | ||||
static struct cxgbei_worker_thread_softc *cwt_softc; | static struct cxgbei_worker_thread_softc *cwt_softc; | ||||
static struct proc *cxgbei_proc; | static struct proc *cxgbei_proc; | ||||
static void | static void | ||||
read_pdu_limits(struct adapter *sc, uint32_t *max_tx_data_len, | read_pdu_limits(struct adapter *sc, uint32_t *max_tx_data_len, | ||||
uint32_t *max_rx_data_len) | uint32_t *max_rx_data_len, struct ppod_region *pr) | ||||
{ | { | ||||
uint32_t tx_len, rx_len, r, v; | uint32_t tx_len, rx_len, r, v; | ||||
rx_len = t4_read_reg(sc, A_TP_PMM_RX_PAGE_SIZE); | rx_len = t4_read_reg(sc, A_TP_PMM_RX_PAGE_SIZE); | ||||
tx_len = t4_read_reg(sc, A_TP_PMM_TX_PAGE_SIZE); | tx_len = t4_read_reg(sc, A_TP_PMM_TX_PAGE_SIZE); | ||||
r = t4_read_reg(sc, A_TP_PARA_REG2); | r = t4_read_reg(sc, A_TP_PARA_REG2); | ||||
rx_len = min(rx_len, G_MAXRXDATA(r)); | rx_len = min(rx_len, G_MAXRXDATA(r)); | ||||
tx_len = min(tx_len, G_MAXRXDATA(r)); | tx_len = min(tx_len, G_MAXRXDATA(r)); | ||||
r = t4_read_reg(sc, A_TP_PARA_REG7); | r = t4_read_reg(sc, A_TP_PARA_REG7); | ||||
v = min(G_PMMAXXFERLEN0(r), G_PMMAXXFERLEN1(r)); | v = min(G_PMMAXXFERLEN0(r), G_PMMAXXFERLEN1(r)); | ||||
rx_len = min(rx_len, v); | rx_len = min(rx_len, v); | ||||
tx_len = min(tx_len, v); | tx_len = min(tx_len, v); | ||||
/* | /* | ||||
* AHS is not supported by the kernel so we'll not account for | * AHS is not supported by the kernel so we'll not account for | ||||
* it either in our PDU len -> data segment len conversions. | * it either in our PDU len -> data segment len conversions. | ||||
*/ | */ | ||||
rx_len -= ISCSI_BHS_SIZE + ISCSI_HEADER_DIGEST_SIZE + | rx_len -= ISCSI_BHS_SIZE + ISCSI_HEADER_DIGEST_SIZE + | ||||
ISCSI_DATA_DIGEST_SIZE; | ISCSI_DATA_DIGEST_SIZE; | ||||
tx_len -= ISCSI_BHS_SIZE + ISCSI_HEADER_DIGEST_SIZE + | tx_len -= ISCSI_BHS_SIZE + ISCSI_HEADER_DIGEST_SIZE + | ||||
ISCSI_DATA_DIGEST_SIZE; | ISCSI_DATA_DIGEST_SIZE; | ||||
/* | |||||
* DDP can place only 4 pages for a single PDU. A single | |||||
* request might use larger pages than the smallest page size, | |||||
* but that cannot be guaranteed. Assume the smallest DDP | |||||
* page size for this limit. | |||||
*/ | |||||
rx_len = min(rx_len, 4 * (1U << pr->pr_page_shift[0])); | |||||
if (chip_id(sc) == CHELSIO_T5) { | if (chip_id(sc) == CHELSIO_T5) { | ||||
rx_len = rounddown2(rx_len, 512); | rx_len = rounddown2(rx_len, 512); | ||||
tx_len = rounddown2(tx_len, 512); | tx_len = rounddown2(tx_len, 512); | ||||
} | } | ||||
*max_tx_data_len = tx_len; | *max_tx_data_len = tx_len; | ||||
*max_rx_data_len = rx_len; | *max_rx_data_len = rx_len; | ||||
} | } | ||||
Show All 10 Lines | cxgbei_init(struct adapter *sc, struct cxgbei_data *ci) | ||||
struct sysctl_oid_list *children; | struct sysctl_oid_list *children; | ||||
struct ppod_region *pr; | struct ppod_region *pr; | ||||
uint32_t r; | uint32_t r; | ||||
int rc; | int rc; | ||||
MPASS(sc->vres.iscsi.size > 0); | MPASS(sc->vres.iscsi.size > 0); | ||||
MPASS(ci != NULL); | MPASS(ci != NULL); | ||||
read_pdu_limits(sc, &ci->max_tx_data_len, &ci->max_rx_data_len); | |||||
pr = &ci->pr; | pr = &ci->pr; | ||||
r = t4_read_reg(sc, A_ULP_RX_ISCSI_PSZ); | r = t4_read_reg(sc, A_ULP_RX_ISCSI_PSZ); | ||||
rc = t4_init_ppod_region(pr, &sc->vres.iscsi, r, "iSCSI page pods"); | rc = t4_init_ppod_region(pr, &sc->vres.iscsi, r, "iSCSI page pods"); | ||||
if (rc != 0) { | if (rc != 0) { | ||||
device_printf(sc->dev, | device_printf(sc->dev, | ||||
"%s: failed to initialize the iSCSI page pod region: %u.\n", | "%s: failed to initialize the iSCSI page pod region: %u.\n", | ||||
__func__, rc); | __func__, rc); | ||||
return (rc); | return (rc); | ||||
} | } | ||||
r = t4_read_reg(sc, A_ULP_RX_ISCSI_TAGMASK); | r = t4_read_reg(sc, A_ULP_RX_ISCSI_TAGMASK); | ||||
r &= V_ISCSITAGMASK(M_ISCSITAGMASK); | r &= V_ISCSITAGMASK(M_ISCSITAGMASK); | ||||
if (r != pr->pr_tag_mask) { | if (r != pr->pr_tag_mask) { | ||||
/* | /* | ||||
* Recent firmwares are supposed to set up the iSCSI tagmask | * Recent firmwares are supposed to set up the iSCSI tagmask | ||||
* but we'll do it ourselves it the computed value doesn't match | * but we'll do it ourselves it the computed value doesn't match | ||||
* what's in the register. | * what's in the register. | ||||
*/ | */ | ||||
device_printf(sc->dev, | device_printf(sc->dev, | ||||
"tagmask 0x%08x does not match computed mask 0x%08x.\n", r, | "tagmask 0x%08x does not match computed mask 0x%08x.\n", r, | ||||
pr->pr_tag_mask); | pr->pr_tag_mask); | ||||
t4_set_reg_field(sc, A_ULP_RX_ISCSI_TAGMASK, | t4_set_reg_field(sc, A_ULP_RX_ISCSI_TAGMASK, | ||||
V_ISCSITAGMASK(M_ISCSITAGMASK), pr->pr_tag_mask); | V_ISCSITAGMASK(M_ISCSITAGMASK), pr->pr_tag_mask); | ||||
} | } | ||||
read_pdu_limits(sc, &ci->max_tx_data_len, &ci->max_rx_data_len, pr); | |||||
sysctl_ctx_init(&ci->ctx); | sysctl_ctx_init(&ci->ctx); | ||||
oid = device_get_sysctl_tree(sc->dev); /* dev.t5nex.X */ | oid = device_get_sysctl_tree(sc->dev); /* dev.t5nex.X */ | ||||
children = SYSCTL_CHILDREN(oid); | children = SYSCTL_CHILDREN(oid); | ||||
oid = SYSCTL_ADD_NODE(&ci->ctx, children, OID_AUTO, "iscsi", | oid = SYSCTL_ADD_NODE(&ci->ctx, children, OID_AUTO, "iscsi", | ||||
CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "iSCSI ULP settings"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "iSCSI ULP settings"); | ||||
children = SYSCTL_CHILDREN(oid); | children = SYSCTL_CHILDREN(oid); | ||||
▲ Show 20 Lines • Show All 822 Lines • Show Last 20 Lines |