Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F175273857
D60179.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D60179.diff
View Options
diff --git a/sys/dev/bnxt/bnxt_en/bnxt_dcb.c b/sys/dev/bnxt/bnxt_en/bnxt_dcb.c
--- a/sys/dev/bnxt/bnxt_en/bnxt_dcb.c
+++ b/sys/dev/bnxt/bnxt_en/bnxt_dcb.c
@@ -78,7 +78,7 @@
qidx = softc->tc_to_qidx[ets->prio_tc[i]];
pri2cos[i] = q_info[qidx].queue_id;
}
- return _hwrm_send_message(softc, &req, sizeof(req));
+ return hwrm_send_message(softc, &req, sizeof(req));
}
static int
@@ -92,6 +92,7 @@
bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_QUEUE_PRI2COS_QCFG);
req.flags = htole32(HWRM_QUEUE_PRI2COS_QCFG_INPUT_FLAGS_IVLAN);
+ BNXT_HWRM_LOCK(softc);
rc = _hwrm_send_message(softc, &req, sizeof(req));
if (!rc) {
uint8_t *pri2cos = &resp->pri0_cos_queue_id;
@@ -106,6 +107,7 @@
ets->prio_tc[i] = tc;
}
}
+ BNXT_HWRM_UNLOCK(softc);
return rc;
}
@@ -152,7 +154,7 @@
req.unused_0 = 0;
}
}
- return _hwrm_send_message(softc, &req, sizeof(req));
+ return hwrm_send_message(softc, &req, sizeof(req));
}
static int
@@ -167,8 +169,10 @@
bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_QUEUE_COS2BW_QCFG);
+ BNXT_HWRM_LOCK(softc);
rc = _hwrm_send_message(softc, &req, sizeof(req));
if (rc) {
+ BNXT_HWRM_UNLOCK(softc);
return rc;
}
@@ -191,6 +195,7 @@
ets->tc_tx_bw[tc] = cos2bw.bw_weight;
}
}
+ BNXT_HWRM_UNLOCK(softc);
return 0;
}
@@ -288,7 +293,7 @@
bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_QUEUE_PFCENABLE_CFG);
req.flags = htole32(pri_mask);
- return _hwrm_send_message(softc, &req, sizeof(req));
+ return hwrm_send_message(softc, &req, sizeof(req));
}
static int
@@ -302,13 +307,16 @@
bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_QUEUE_PFCENABLE_QCFG);
+ BNXT_HWRM_LOCK(softc);
rc = _hwrm_send_message(softc, &req, sizeof(req));
if (rc) {
+ BNXT_HWRM_UNLOCK(softc);
return rc;
}
pri_mask = le32toh(resp->flags);
pfc->pfc_en = pri_mask;
+ BNXT_HWRM_UNLOCK(softc);
return 0;
}
@@ -341,7 +349,7 @@
get.structure_id = htole16(HWRM_STRUCT_HDR_STRUCT_ID_DCBX_APP);
get.subtype = htole16(HWRM_STRUCT_DATA_SUBTYPE_HOST_OPERATIONAL);
get.count = 0;
- rc = _hwrm_send_message(softc, &get, sizeof(get));
+ rc = hwrm_send_message(softc, &get, sizeof(get));
if (rc)
goto set_app_exit;
@@ -362,6 +370,11 @@
}
set_app_exit:
+ if (rc == ETIMEDOUT) {
+ device_printf(softc->dev,
+ "dcbx app get timed out, leaking DMA buffer\n");
+ return rc;
+ }
iflib_dma_free(&dma_data);
return rc;
}
@@ -377,6 +390,7 @@
struct iflib_dma_info dma_data;
size_t data_len;
int rc, n, i;
+ bool did_set = false;
if (softc->hwrm_spec_code < 0x10601)
return 0;
@@ -393,7 +407,7 @@
get.structure_id = htole16(HWRM_STRUCT_HDR_STRUCT_ID_DCBX_APP);
get.subtype = htole16(HWRM_STRUCT_DATA_SUBTYPE_HOST_OPERATIONAL);
get.count = 0;
- rc = _hwrm_send_message(softc, &get, sizeof(get));
+ rc = hwrm_send_message(softc, &get, sizeof(get));
if (rc)
goto set_app_exit;
@@ -445,9 +459,16 @@
set.src_data_addr = htole64(dma_data.idi_paddr);
set.data_len = htole16(sizeof(*data) + sizeof(*fw_app) * n);
set.hdr_cnt = 1;
- rc = _hwrm_send_message(softc, &set, sizeof(set));
+ did_set = true;
+ rc = hwrm_send_message(softc, &set, sizeof(set));
set_app_exit:
+ if (rc == ETIMEDOUT) {
+ device_printf(softc->dev,
+ "dcbx app %s timed out, leaking DMA buffer\n",
+ did_set ? "set" : "get");
+ return rc;
+ }
iflib_dma_free(&dma_data);
return rc;
}
@@ -466,12 +487,14 @@
bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_QUEUE_DSCP_QCAPS);
+ BNXT_HWRM_LOCK(softc);
rc = _hwrm_send_message(softc, &req, sizeof(req));
if (!rc) {
softc->max_dscp_value = (1 << resp->num_dscp_bits) - 1;
if (softc->max_dscp_value < 0x3f)
softc->max_dscp_value = 0;
}
+ BNXT_HWRM_UNLOCK(softc);
return rc;
}
@@ -502,12 +525,15 @@
req.dest_data_addr = htole64(dma_data.idi_paddr);
req.dest_data_buffer_size = htole16(sizeof(*dscp2pri) * 64);
req.port_id = htole16(softc->pf.port_id);
+ BNXT_HWRM_LOCK(softc);
rc = _hwrm_send_message(softc, &req, sizeof(req));
+ if (!rc)
+ entry_cnt = le16toh(resp->entry_cnt);
+ BNXT_HWRM_UNLOCK(softc);
if (rc)
goto end;
- entry_cnt = le16toh(resp->entry_cnt);
for (i = 0; i < entry_cnt && *num_inputs < nitems; i++) {
app[*num_inputs].priority = dscp2pri[i].pri;
app[*num_inputs].protocol = dscp2pri[i].dscp;
@@ -516,6 +542,11 @@
}
end:
+ if (rc == ETIMEDOUT) {
+ device_printf(softc->dev,
+ "dscp2pri qcfg timed out, leaking DMA buffer\n");
+ return rc;
+ }
iflib_dma_free(&dma_data);
return rc;
}
@@ -549,8 +580,13 @@
dscp2pri->pri = app->priority;
req.entry_cnt = htole16(1);
req.port_id = htole16(softc->pf.port_id);
- rc = _hwrm_send_message(softc, &req, sizeof(req));
+ rc = hwrm_send_message(softc, &req, sizeof(req));
+ if (rc == ETIMEDOUT) {
+ device_printf(softc->dev,
+ "dscp2pri cfg timed out, leaking DMA buffer\n");
+ return rc;
+ }
iflib_dma_free(&dma_data);
return rc;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 10, 3:36 PM (18 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40027436
Default Alt Text
D60179.diff (4 KB)
Attached To
Mode
D60179: bnxt_en: dcb: serialize HWRM sends and avoid freeing DMA bufs on timeout
Attached
Detach File
Event Timeline
Log In to Comment