Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/bnxt/bnxt_sysctl.c
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | bnxt_init_sysctl_ctx(struct bnxt_softc *softc) | ||||
softc->nvm_info->nvm_oid = SYSCTL_ADD_NODE(ctx, | softc->nvm_info->nvm_oid = SYSCTL_ADD_NODE(ctx, | ||||
SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, | SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, | ||||
"nvram", CTLFLAG_RD, 0, "nvram information"); | "nvram", CTLFLAG_RD, 0, "nvram information"); | ||||
if (!softc->nvm_info->nvm_oid) { | if (!softc->nvm_info->nvm_oid) { | ||||
sysctl_ctx_free(&softc->nvm_info->nvm_ctx); | sysctl_ctx_free(&softc->nvm_info->nvm_ctx); | ||||
return ENOMEM; | return ENOMEM; | ||||
} | } | ||||
sysctl_ctx_init(&softc->hw_lro_ctx); | |||||
ctx = device_get_sysctl_ctx(softc->dev); | |||||
softc->hw_lro_oid = SYSCTL_ADD_NODE(ctx, | |||||
SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, | |||||
"hw_lro", CTLFLAG_RD, 0, "hardware lro"); | |||||
if (!softc->hw_lro_oid) { | |||||
sysctl_ctx_free(&softc->hw_lro_ctx); | |||||
return ENOMEM; | |||||
} | |||||
return 0; | return 0; | ||||
} | } | ||||
int | int | ||||
bnxt_free_sysctl_ctx(struct bnxt_softc *softc) | bnxt_free_sysctl_ctx(struct bnxt_softc *softc) | ||||
{ | { | ||||
int orc; | int orc; | ||||
int rc = 0; | int rc = 0; | ||||
Show All 14 Lines | bnxt_free_sysctl_ctx(struct bnxt_softc *softc) | ||||
} | } | ||||
if (softc->nvm_info->nvm_oid != NULL) { | if (softc->nvm_info->nvm_oid != NULL) { | ||||
orc = sysctl_ctx_free(&softc->nvm_info->nvm_ctx); | orc = sysctl_ctx_free(&softc->nvm_info->nvm_ctx); | ||||
if (orc) | if (orc) | ||||
rc = orc; | rc = orc; | ||||
else | else | ||||
softc->nvm_info->nvm_oid = NULL; | softc->nvm_info->nvm_oid = NULL; | ||||
} | } | ||||
if (softc->hw_lro_oid != NULL) { | |||||
orc = sysctl_ctx_free(&softc->hw_lro_ctx); | |||||
if (orc) | |||||
rc = orc; | |||||
else | |||||
softc->hw_lro_oid = NULL; | |||||
} | |||||
return rc; | return rc; | ||||
} | } | ||||
int | int | ||||
bnxt_create_tx_sysctls(struct bnxt_softc *softc, int txr) | bnxt_create_tx_sysctls(struct bnxt_softc *softc, int txr) | ||||
{ | { | ||||
struct sysctl_oid *oid; | struct sysctl_oid *oid; | ||||
▲ Show 20 Lines • Show All 1,080 Lines • ▼ Show 20 Lines | iflib_get_ifp(softc->ctx)->if_xname, 0, "interface name"); | ||||
"I", "interrupt coalescing Tx Usecs IRQ"); | "I", "interrupt coalescing Tx Usecs IRQ"); | ||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_frames_irq", | SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_frames_irq", | ||||
CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_tx_frames_irq, | CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_tx_frames_irq, | ||||
"I", "interrupt coalescing Tx Frames IRQ"); | "I", "interrupt coalescing Tx Frames IRQ"); | ||||
return 0; | return 0; | ||||
} | } | ||||
#define BNXT_HW_LRO_FN(fn_name, arg) \ | |||||
static int \ | |||||
fn_name(SYSCTL_HANDLER_ARGS) { \ | |||||
struct bnxt_softc *softc = arg1; \ | |||||
int rc; \ | |||||
int val; \ | |||||
\ | |||||
if (softc == NULL) \ | |||||
return EBUSY; \ | |||||
\ | |||||
val = softc->hw_lro.arg; \ | |||||
rc = sysctl_handle_int(oidp, &val, 0, req); \ | |||||
if (rc || !req->newptr) \ | |||||
return rc; \ | |||||
\ | |||||
if ((if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING)) \ | |||||
return EBUSY; \ | |||||
\ | |||||
softc->hw_lro.arg = val; \ | |||||
bnxt_validate_hw_lro_settings(softc); \ | |||||
rc = bnxt_hwrm_vnic_tpa_cfg(softc); \ | |||||
\ | |||||
return rc; \ | |||||
} | |||||
BNXT_HW_LRO_FN(bnxt_hw_lro_enable_disable, enable) | |||||
BNXT_HW_LRO_FN(bnxt_hw_lro_set_mode, is_mode_gro) | |||||
BNXT_HW_LRO_FN(bnxt_hw_lro_set_max_agg_segs, max_agg_segs) | |||||
BNXT_HW_LRO_FN(bnxt_hw_lro_set_max_aggs, max_aggs) | |||||
BNXT_HW_LRO_FN(bnxt_hw_lro_set_min_agg_len, min_agg_len) | |||||
int | |||||
bnxt_create_hw_lro_sysctls(struct bnxt_softc *softc) | |||||
{ | |||||
struct sysctl_oid *oid = softc->hw_lro_oid; | |||||
if (!oid) | |||||
return ENOMEM; | |||||
SYSCTL_ADD_PROC(&softc->hw_lro_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, | |||||
"enable", CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, | |||||
bnxt_hw_lro_enable_disable, "A", | |||||
"Enable or Disable HW LRO: 0 / 1"); | |||||
SYSCTL_ADD_PROC(&softc->hw_lro_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, | |||||
"gro_mode", CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, | |||||
bnxt_hw_lro_set_mode, "A", | |||||
"Set mode: 1 = GRO mode, 0 = RSC mode"); | |||||
SYSCTL_ADD_PROC(&softc->hw_lro_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, | |||||
"max_agg_segs", CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, | |||||
bnxt_hw_lro_set_max_agg_segs, "A", | |||||
"Set Max Agg Seg Value (unit is Log2): " | |||||
"0 (= 1 seg) / 1 (= 2 segs) / ... / 31 (= 2^31 segs)"); | |||||
SYSCTL_ADD_PROC(&softc->hw_lro_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, | |||||
"max_aggs", CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, | |||||
bnxt_hw_lro_set_max_aggs, "A", | |||||
"Set Max Aggs Value (unit is Log2): " | |||||
"0 (= 1 agg) / 1 (= 2 aggs) / ... / 7 (= 2^7 segs)"); | |||||
SYSCTL_ADD_PROC(&softc->hw_lro_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, | |||||
"min_agg_len", CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, | |||||
bnxt_hw_lro_set_min_agg_len, "A", | |||||
"Min Agg Len: 1 to 9000"); | |||||
return 0; | |||||
} | |||||
static int | static int | ||||
bnxt_vlan_only_sysctl(SYSCTL_HANDLER_ARGS) { | bnxt_vlan_only_sysctl(SYSCTL_HANDLER_ARGS) { | ||||
struct bnxt_softc *softc = arg1; | struct bnxt_softc *softc = arg1; | ||||
int rc; | int rc; | ||||
int val; | int val; | ||||
if (softc == NULL) | if (softc == NULL) | ||||
return EBUSY; | return EBUSY; | ||||
Show All 33 Lines |