|
@@ -5052,23 +5052,26 @@ static unsigned int t4_use_ldst(struct adapter *adap)
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * t4_fw_tp_pio_rw - Access TP PIO through LDST
|
|
|
- * @adap: the adapter
|
|
|
- * @vals: where the indirect register values are stored/written
|
|
|
- * @nregs: how many indirect registers to read/write
|
|
|
- * @start_idx: index of first indirect register to read/write
|
|
|
- * @rw: Read (1) or Write (0)
|
|
|
+ * t4_tp_fw_ldst_rw - Access TP indirect register through LDST
|
|
|
+ * @adap: the adapter
|
|
|
+ * @cmd: TP fw ldst address space type
|
|
|
+ * @vals: where the indirect register values are stored/written
|
|
|
+ * @nregs: how many indirect registers to read/write
|
|
|
+ * @start_idx: index of first indirect register to read/write
|
|
|
+ * @rw: Read (1) or Write (0)
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
*
|
|
|
- * Access TP PIO registers through LDST
|
|
|
+ * Access TP indirect registers through LDST
|
|
|
*/
|
|
|
-static void t4_fw_tp_pio_rw(struct adapter *adap, u32 *vals, unsigned int nregs,
|
|
|
- unsigned int start_index, unsigned int rw)
|
|
|
+static int t4_tp_fw_ldst_rw(struct adapter *adap, int cmd, u32 *vals,
|
|
|
+ unsigned int nregs, unsigned int start_index,
|
|
|
+ unsigned int rw, bool sleep_ok)
|
|
|
{
|
|
|
- int ret, i;
|
|
|
- int cmd = FW_LDST_ADDRSPC_TP_PIO;
|
|
|
+ int ret = 0;
|
|
|
+ unsigned int i;
|
|
|
struct fw_ldst_cmd c;
|
|
|
|
|
|
- for (i = 0 ; i < nregs; i++) {
|
|
|
+ for (i = 0; i < nregs; i++) {
|
|
|
memset(&c, 0, sizeof(c));
|
|
|
c.op_to_addrspace = cpu_to_be32(FW_CMD_OP_V(FW_LDST_CMD) |
|
|
|
FW_CMD_REQUEST_F |
|
|
@@ -5079,26 +5082,127 @@ static void t4_fw_tp_pio_rw(struct adapter *adap, u32 *vals, unsigned int nregs,
|
|
|
|
|
|
c.u.addrval.addr = cpu_to_be32(start_index + i);
|
|
|
c.u.addrval.val = rw ? 0 : cpu_to_be32(vals[i]);
|
|
|
- ret = t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), &c);
|
|
|
- if (!ret && rw)
|
|
|
+ ret = t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c,
|
|
|
+ sleep_ok);
|
|
|
+ if (ret)
|
|
|
+ return ret;
|
|
|
+
|
|
|
+ if (rw)
|
|
|
vals[i] = be32_to_cpu(c.u.addrval.val);
|
|
|
}
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * t4_tp_indirect_rw - Read/Write TP indirect register through LDST or backdoor
|
|
|
+ * @adap: the adapter
|
|
|
+ * @reg_addr: Address Register
|
|
|
+ * @reg_data: Data register
|
|
|
+ * @buff: where the indirect register values are stored/written
|
|
|
+ * @nregs: how many indirect registers to read/write
|
|
|
+ * @start_index: index of first indirect register to read/write
|
|
|
+ * @rw: READ(1) or WRITE(0)
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
+ *
|
|
|
+ * Read/Write TP indirect registers through LDST if possible.
|
|
|
+ * Else, use backdoor access
|
|
|
+ **/
|
|
|
+static void t4_tp_indirect_rw(struct adapter *adap, u32 reg_addr, u32 reg_data,
|
|
|
+ u32 *buff, u32 nregs, u32 start_index, int rw,
|
|
|
+ bool sleep_ok)
|
|
|
+{
|
|
|
+ int rc = -EINVAL;
|
|
|
+ int cmd;
|
|
|
+
|
|
|
+ switch (reg_addr) {
|
|
|
+ case TP_PIO_ADDR_A:
|
|
|
+ cmd = FW_LDST_ADDRSPC_TP_PIO;
|
|
|
+ break;
|
|
|
+ case TP_MIB_INDEX_A:
|
|
|
+ cmd = FW_LDST_ADDRSPC_TP_MIB;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ goto indirect_access;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (t4_use_ldst(adap))
|
|
|
+ rc = t4_tp_fw_ldst_rw(adap, cmd, buff, nregs, start_index, rw,
|
|
|
+ sleep_ok);
|
|
|
+
|
|
|
+indirect_access:
|
|
|
+
|
|
|
+ if (rc) {
|
|
|
+ if (rw)
|
|
|
+ t4_read_indirect(adap, reg_addr, reg_data, buff, nregs,
|
|
|
+ start_index);
|
|
|
+ else
|
|
|
+ t4_write_indirect(adap, reg_addr, reg_data, buff, nregs,
|
|
|
+ start_index);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * t4_tp_pio_read - Read TP PIO registers
|
|
|
+ * @adap: the adapter
|
|
|
+ * @buff: where the indirect register values are written
|
|
|
+ * @nregs: how many indirect registers to read
|
|
|
+ * @start_index: index of first indirect register to read
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
+ *
|
|
|
+ * Read TP PIO Registers
|
|
|
+ **/
|
|
|
+void t4_tp_pio_read(struct adapter *adap, u32 *buff, u32 nregs,
|
|
|
+ u32 start_index, bool sleep_ok)
|
|
|
+{
|
|
|
+ t4_tp_indirect_rw(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, buff, nregs,
|
|
|
+ start_index, 1, sleep_ok);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * t4_tp_pio_write - Write TP PIO registers
|
|
|
+ * @adap: the adapter
|
|
|
+ * @buff: where the indirect register values are stored
|
|
|
+ * @nregs: how many indirect registers to write
|
|
|
+ * @start_index: index of first indirect register to write
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
+ *
|
|
|
+ * Write TP PIO Registers
|
|
|
+ **/
|
|
|
+static void t4_tp_pio_write(struct adapter *adap, u32 *buff, u32 nregs,
|
|
|
+ u32 start_index, bool sleep_ok)
|
|
|
+{
|
|
|
+ t4_tp_indirect_rw(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, buff, nregs,
|
|
|
+ start_index, 0, sleep_ok);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * t4_tp_mib_read - Read TP MIB registers
|
|
|
+ * @adap: the adapter
|
|
|
+ * @buff: where the indirect register values are written
|
|
|
+ * @nregs: how many indirect registers to read
|
|
|
+ * @start_index: index of first indirect register to read
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
+ *
|
|
|
+ * Read TP MIB Registers
|
|
|
+ **/
|
|
|
+void t4_tp_mib_read(struct adapter *adap, u32 *buff, u32 nregs, u32 start_index,
|
|
|
+ bool sleep_ok)
|
|
|
+{
|
|
|
+ t4_tp_indirect_rw(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, buff, nregs,
|
|
|
+ start_index, 1, sleep_ok);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* t4_read_rss_key - read the global RSS key
|
|
|
* @adap: the adapter
|
|
|
* @key: 10-entry array holding the 320-bit RSS key
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
*
|
|
|
* Reads the global 320-bit RSS key.
|
|
|
*/
|
|
|
-void t4_read_rss_key(struct adapter *adap, u32 *key)
|
|
|
+void t4_read_rss_key(struct adapter *adap, u32 *key, bool sleep_ok)
|
|
|
{
|
|
|
- if (t4_use_ldst(adap))
|
|
|
- t4_fw_tp_pio_rw(adap, key, 10, TP_RSS_SECRET_KEY0_A, 1);
|
|
|
- else
|
|
|
- t4_read_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, key, 10,
|
|
|
- TP_RSS_SECRET_KEY0_A);
|
|
|
+ t4_tp_pio_read(adap, key, 10, TP_RSS_SECRET_KEY0_A, sleep_ok);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -5106,12 +5210,14 @@ void t4_read_rss_key(struct adapter *adap, u32 *key)
|
|
|
* @adap: the adapter
|
|
|
* @key: 10-entry array holding the 320-bit RSS key
|
|
|
* @idx: which RSS key to write
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
*
|
|
|
* Writes one of the RSS keys with the given 320-bit value. If @idx is
|
|
|
* 0..15 the corresponding entry in the RSS key table is written,
|
|
|
* otherwise the global RSS key is written.
|
|
|
*/
|
|
|
-void t4_write_rss_key(struct adapter *adap, const u32 *key, int idx)
|
|
|
+void t4_write_rss_key(struct adapter *adap, const u32 *key, int idx,
|
|
|
+ bool sleep_ok)
|
|
|
{
|
|
|
u8 rss_key_addr_cnt = 16;
|
|
|
u32 vrt = t4_read_reg(adap, TP_RSS_CONFIG_VRT_A);
|
|
@@ -5124,11 +5230,7 @@ void t4_write_rss_key(struct adapter *adap, const u32 *key, int idx)
|
|
|
(vrt & KEYEXTEND_F) && (KEYMODE_G(vrt) == 3))
|
|
|
rss_key_addr_cnt = 32;
|
|
|
|
|
|
- if (t4_use_ldst(adap))
|
|
|
- t4_fw_tp_pio_rw(adap, (void *)key, 10, TP_RSS_SECRET_KEY0_A, 0);
|
|
|
- else
|
|
|
- t4_write_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, key, 10,
|
|
|
- TP_RSS_SECRET_KEY0_A);
|
|
|
+ t4_tp_pio_write(adap, (void *)key, 10, TP_RSS_SECRET_KEY0_A, sleep_ok);
|
|
|
|
|
|
if (idx >= 0 && idx < rss_key_addr_cnt) {
|
|
|
if (rss_key_addr_cnt > 16)
|
|
@@ -5146,19 +5248,15 @@ void t4_write_rss_key(struct adapter *adap, const u32 *key, int idx)
|
|
|
* @adapter: the adapter
|
|
|
* @index: the entry in the PF RSS table to read
|
|
|
* @valp: where to store the returned value
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
*
|
|
|
* Reads the PF RSS Configuration Table at the specified index and returns
|
|
|
* the value found there.
|
|
|
*/
|
|
|
void t4_read_rss_pf_config(struct adapter *adapter, unsigned int index,
|
|
|
- u32 *valp)
|
|
|
+ u32 *valp, bool sleep_ok)
|
|
|
{
|
|
|
- if (t4_use_ldst(adapter))
|
|
|
- t4_fw_tp_pio_rw(adapter, valp, 1,
|
|
|
- TP_RSS_PF0_CONFIG_A + index, 1);
|
|
|
- else
|
|
|
- t4_read_indirect(adapter, TP_PIO_ADDR_A, TP_PIO_DATA_A,
|
|
|
- valp, 1, TP_RSS_PF0_CONFIG_A + index);
|
|
|
+ t4_tp_pio_read(adapter, valp, 1, TP_RSS_PF0_CONFIG_A + index, sleep_ok);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -5167,12 +5265,13 @@ void t4_read_rss_pf_config(struct adapter *adapter, unsigned int index,
|
|
|
* @index: the entry in the VF RSS table to read
|
|
|
* @vfl: where to store the returned VFL
|
|
|
* @vfh: where to store the returned VFH
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
*
|
|
|
* Reads the VF RSS Configuration Table at the specified index and returns
|
|
|
* the (VFL, VFH) values found there.
|
|
|
*/
|
|
|
void t4_read_rss_vf_config(struct adapter *adapter, unsigned int index,
|
|
|
- u32 *vfl, u32 *vfh)
|
|
|
+ u32 *vfl, u32 *vfh, bool sleep_ok)
|
|
|
{
|
|
|
u32 vrt, mask, data;
|
|
|
|
|
@@ -5193,50 +5292,37 @@ void t4_read_rss_vf_config(struct adapter *adapter, unsigned int index,
|
|
|
|
|
|
/* Grab the VFL/VFH values ...
|
|
|
*/
|
|
|
- if (t4_use_ldst(adapter)) {
|
|
|
- t4_fw_tp_pio_rw(adapter, vfl, 1, TP_RSS_VFL_CONFIG_A, 1);
|
|
|
- t4_fw_tp_pio_rw(adapter, vfh, 1, TP_RSS_VFH_CONFIG_A, 1);
|
|
|
- } else {
|
|
|
- t4_read_indirect(adapter, TP_PIO_ADDR_A, TP_PIO_DATA_A,
|
|
|
- vfl, 1, TP_RSS_VFL_CONFIG_A);
|
|
|
- t4_read_indirect(adapter, TP_PIO_ADDR_A, TP_PIO_DATA_A,
|
|
|
- vfh, 1, TP_RSS_VFH_CONFIG_A);
|
|
|
- }
|
|
|
+ t4_tp_pio_read(adapter, vfl, 1, TP_RSS_VFL_CONFIG_A, sleep_ok);
|
|
|
+ t4_tp_pio_read(adapter, vfh, 1, TP_RSS_VFH_CONFIG_A, sleep_ok);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* t4_read_rss_pf_map - read PF RSS Map
|
|
|
* @adapter: the adapter
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
*
|
|
|
* Reads the PF RSS Map register and returns its value.
|
|
|
*/
|
|
|
-u32 t4_read_rss_pf_map(struct adapter *adapter)
|
|
|
+u32 t4_read_rss_pf_map(struct adapter *adapter, bool sleep_ok)
|
|
|
{
|
|
|
u32 pfmap;
|
|
|
|
|
|
- if (t4_use_ldst(adapter))
|
|
|
- t4_fw_tp_pio_rw(adapter, &pfmap, 1, TP_RSS_PF_MAP_A, 1);
|
|
|
- else
|
|
|
- t4_read_indirect(adapter, TP_PIO_ADDR_A, TP_PIO_DATA_A,
|
|
|
- &pfmap, 1, TP_RSS_PF_MAP_A);
|
|
|
+ t4_tp_pio_read(adapter, &pfmap, 1, TP_RSS_PF_MAP_A, sleep_ok);
|
|
|
return pfmap;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* t4_read_rss_pf_mask - read PF RSS Mask
|
|
|
* @adapter: the adapter
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
*
|
|
|
* Reads the PF RSS Mask register and returns its value.
|
|
|
*/
|
|
|
-u32 t4_read_rss_pf_mask(struct adapter *adapter)
|
|
|
+u32 t4_read_rss_pf_mask(struct adapter *adapter, bool sleep_ok)
|
|
|
{
|
|
|
u32 pfmask;
|
|
|
|
|
|
- if (t4_use_ldst(adapter))
|
|
|
- t4_fw_tp_pio_rw(adapter, &pfmask, 1, TP_RSS_PF_MSK_A, 1);
|
|
|
- else
|
|
|
- t4_read_indirect(adapter, TP_PIO_ADDR_A, TP_PIO_DATA_A,
|
|
|
- &pfmask, 1, TP_RSS_PF_MSK_A);
|
|
|
+ t4_tp_pio_read(adapter, &pfmask, 1, TP_RSS_PF_MSK_A, sleep_ok);
|
|
|
return pfmask;
|
|
|
}
|
|
|
|
|
@@ -5245,12 +5331,13 @@ u32 t4_read_rss_pf_mask(struct adapter *adapter)
|
|
|
* @adap: the adapter
|
|
|
* @v4: holds the TCP/IP counter values
|
|
|
* @v6: holds the TCP/IPv6 counter values
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
*
|
|
|
* Returns the values of TP's TCP/IP and TCP/IPv6 MIB counters.
|
|
|
* Either @v4 or @v6 may be %NULL to skip the corresponding stats.
|
|
|
*/
|
|
|
void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4,
|
|
|
- struct tp_tcp_stats *v6)
|
|
|
+ struct tp_tcp_stats *v6, bool sleep_ok)
|
|
|
{
|
|
|
u32 val[TP_MIB_TCP_RXT_SEG_LO_A - TP_MIB_TCP_OUT_RST_A + 1];
|
|
|
|
|
@@ -5259,16 +5346,16 @@ void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4,
|
|
|
#define STAT64(x) (((u64)STAT(x##_HI) << 32) | STAT(x##_LO))
|
|
|
|
|
|
if (v4) {
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, val,
|
|
|
- ARRAY_SIZE(val), TP_MIB_TCP_OUT_RST_A);
|
|
|
+ t4_tp_mib_read(adap, val, ARRAY_SIZE(val),
|
|
|
+ TP_MIB_TCP_OUT_RST_A, sleep_ok);
|
|
|
v4->tcp_out_rsts = STAT(OUT_RST);
|
|
|
v4->tcp_in_segs = STAT64(IN_SEG);
|
|
|
v4->tcp_out_segs = STAT64(OUT_SEG);
|
|
|
v4->tcp_retrans_segs = STAT64(RXT_SEG);
|
|
|
}
|
|
|
if (v6) {
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, val,
|
|
|
- ARRAY_SIZE(val), TP_MIB_TCP_V6OUT_RST_A);
|
|
|
+ t4_tp_mib_read(adap, val, ARRAY_SIZE(val),
|
|
|
+ TP_MIB_TCP_V6OUT_RST_A, sleep_ok);
|
|
|
v6->tcp_out_rsts = STAT(OUT_RST);
|
|
|
v6->tcp_in_segs = STAT64(IN_SEG);
|
|
|
v6->tcp_out_segs = STAT64(OUT_SEG);
|
|
@@ -5283,63 +5370,66 @@ void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4,
|
|
|
* t4_tp_get_err_stats - read TP's error MIB counters
|
|
|
* @adap: the adapter
|
|
|
* @st: holds the counter values
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
*
|
|
|
* Returns the values of TP's error counters.
|
|
|
*/
|
|
|
-void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st)
|
|
|
+void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st,
|
|
|
+ bool sleep_ok)
|
|
|
{
|
|
|
int nchan = adap->params.arch.nchan;
|
|
|
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A,
|
|
|
- st->mac_in_errs, nchan, TP_MIB_MAC_IN_ERR_0_A);
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A,
|
|
|
- st->hdr_in_errs, nchan, TP_MIB_HDR_IN_ERR_0_A);
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A,
|
|
|
- st->tcp_in_errs, nchan, TP_MIB_TCP_IN_ERR_0_A);
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A,
|
|
|
- st->tnl_cong_drops, nchan, TP_MIB_TNL_CNG_DROP_0_A);
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A,
|
|
|
- st->ofld_chan_drops, nchan, TP_MIB_OFD_CHN_DROP_0_A);
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A,
|
|
|
- st->tnl_tx_drops, nchan, TP_MIB_TNL_DROP_0_A);
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A,
|
|
|
- st->ofld_vlan_drops, nchan, TP_MIB_OFD_VLN_DROP_0_A);
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A,
|
|
|
- st->tcp6_in_errs, nchan, TP_MIB_TCP_V6IN_ERR_0_A);
|
|
|
-
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A,
|
|
|
- &st->ofld_no_neigh, 2, TP_MIB_OFD_ARP_DROP_A);
|
|
|
+ t4_tp_mib_read(adap, st->mac_in_errs, nchan, TP_MIB_MAC_IN_ERR_0_A,
|
|
|
+ sleep_ok);
|
|
|
+ t4_tp_mib_read(adap, st->hdr_in_errs, nchan, TP_MIB_HDR_IN_ERR_0_A,
|
|
|
+ sleep_ok);
|
|
|
+ t4_tp_mib_read(adap, st->tcp_in_errs, nchan, TP_MIB_TCP_IN_ERR_0_A,
|
|
|
+ sleep_ok);
|
|
|
+ t4_tp_mib_read(adap, st->tnl_cong_drops, nchan,
|
|
|
+ TP_MIB_TNL_CNG_DROP_0_A, sleep_ok);
|
|
|
+ t4_tp_mib_read(adap, st->ofld_chan_drops, nchan,
|
|
|
+ TP_MIB_OFD_CHN_DROP_0_A, sleep_ok);
|
|
|
+ t4_tp_mib_read(adap, st->tnl_tx_drops, nchan, TP_MIB_TNL_DROP_0_A,
|
|
|
+ sleep_ok);
|
|
|
+ t4_tp_mib_read(adap, st->ofld_vlan_drops, nchan,
|
|
|
+ TP_MIB_OFD_VLN_DROP_0_A, sleep_ok);
|
|
|
+ t4_tp_mib_read(adap, st->tcp6_in_errs, nchan,
|
|
|
+ TP_MIB_TCP_V6IN_ERR_0_A, sleep_ok);
|
|
|
+ t4_tp_mib_read(adap, &st->ofld_no_neigh, 2, TP_MIB_OFD_ARP_DROP_A,
|
|
|
+ sleep_ok);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* t4_tp_get_cpl_stats - read TP's CPL MIB counters
|
|
|
* @adap: the adapter
|
|
|
* @st: holds the counter values
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
*
|
|
|
* Returns the values of TP's CPL counters.
|
|
|
*/
|
|
|
-void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st)
|
|
|
+void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st,
|
|
|
+ bool sleep_ok)
|
|
|
{
|
|
|
int nchan = adap->params.arch.nchan;
|
|
|
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, st->req,
|
|
|
- nchan, TP_MIB_CPL_IN_REQ_0_A);
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, st->rsp,
|
|
|
- nchan, TP_MIB_CPL_OUT_RSP_0_A);
|
|
|
+ t4_tp_mib_read(adap, st->req, nchan, TP_MIB_CPL_IN_REQ_0_A, sleep_ok);
|
|
|
|
|
|
+ t4_tp_mib_read(adap, st->rsp, nchan, TP_MIB_CPL_OUT_RSP_0_A, sleep_ok);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* t4_tp_get_rdma_stats - read TP's RDMA MIB counters
|
|
|
* @adap: the adapter
|
|
|
* @st: holds the counter values
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
*
|
|
|
* Returns the values of TP's RDMA counters.
|
|
|
*/
|
|
|
-void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st)
|
|
|
+void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st,
|
|
|
+ bool sleep_ok)
|
|
|
{
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, &st->rqe_dfr_pkt,
|
|
|
- 2, TP_MIB_RQE_DFR_PKT_A);
|
|
|
+ t4_tp_mib_read(adap, &st->rqe_dfr_pkt, 2, TP_MIB_RQE_DFR_PKT_A,
|
|
|
+ sleep_ok);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -5347,20 +5437,24 @@ void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st)
|
|
|
* @adap: the adapter
|
|
|
* @idx: the port index
|
|
|
* @st: holds the counter values
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
*
|
|
|
* Returns the values of TP's FCoE counters for the selected port.
|
|
|
*/
|
|
|
void t4_get_fcoe_stats(struct adapter *adap, unsigned int idx,
|
|
|
- struct tp_fcoe_stats *st)
|
|
|
+ struct tp_fcoe_stats *st, bool sleep_ok)
|
|
|
{
|
|
|
u32 val[2];
|
|
|
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, &st->frames_ddp,
|
|
|
- 1, TP_MIB_FCOE_DDP_0_A + idx);
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, &st->frames_drop,
|
|
|
- 1, TP_MIB_FCOE_DROP_0_A + idx);
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, val,
|
|
|
- 2, TP_MIB_FCOE_BYTE_0_HI_A + 2 * idx);
|
|
|
+ t4_tp_mib_read(adap, &st->frames_ddp, 1, TP_MIB_FCOE_DDP_0_A + idx,
|
|
|
+ sleep_ok);
|
|
|
+
|
|
|
+ t4_tp_mib_read(adap, &st->frames_drop, 1,
|
|
|
+ TP_MIB_FCOE_DROP_0_A + idx, sleep_ok);
|
|
|
+
|
|
|
+ t4_tp_mib_read(adap, val, 2, TP_MIB_FCOE_BYTE_0_HI_A + 2 * idx,
|
|
|
+ sleep_ok);
|
|
|
+
|
|
|
st->octets_ddp = ((u64)val[0] << 32) | val[1];
|
|
|
}
|
|
|
|
|
@@ -5368,15 +5462,16 @@ void t4_get_fcoe_stats(struct adapter *adap, unsigned int idx,
|
|
|
* t4_get_usm_stats - read TP's non-TCP DDP MIB counters
|
|
|
* @adap: the adapter
|
|
|
* @st: holds the counter values
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
*
|
|
|
* Returns the values of TP's counters for non-TCP directly-placed packets.
|
|
|
*/
|
|
|
-void t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st)
|
|
|
+void t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st,
|
|
|
+ bool sleep_ok)
|
|
|
{
|
|
|
u32 val[4];
|
|
|
|
|
|
- t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, val, 4,
|
|
|
- TP_MIB_USM_PKTS_A);
|
|
|
+ t4_tp_mib_read(adap, val, 4, TP_MIB_USM_PKTS_A, sleep_ok);
|
|
|
st->frames = val[0];
|
|
|
st->drops = val[1];
|
|
|
st->octets = ((u64)val[2] << 32) | val[3];
|
|
@@ -8663,10 +8758,11 @@ int t4_init_sge_params(struct adapter *adapter)
|
|
|
/**
|
|
|
* t4_init_tp_params - initialize adap->params.tp
|
|
|
* @adap: the adapter
|
|
|
+ * @sleep_ok: if true we may sleep while awaiting command completion
|
|
|
*
|
|
|
* Initialize various fields of the adapter's TP Parameters structure.
|
|
|
*/
|
|
|
-int t4_init_tp_params(struct adapter *adap)
|
|
|
+int t4_init_tp_params(struct adapter *adap, bool sleep_ok)
|
|
|
{
|
|
|
int chan;
|
|
|
u32 v;
|
|
@@ -8682,19 +8778,11 @@ int t4_init_tp_params(struct adapter *adap)
|
|
|
/* Cache the adapter's Compressed Filter Mode and global Incress
|
|
|
* Configuration.
|
|
|
*/
|
|
|
- if (t4_use_ldst(adap)) {
|
|
|
- t4_fw_tp_pio_rw(adap, &adap->params.tp.vlan_pri_map, 1,
|
|
|
- TP_VLAN_PRI_MAP_A, 1);
|
|
|
- t4_fw_tp_pio_rw(adap, &adap->params.tp.ingress_config, 1,
|
|
|
- TP_INGRESS_CONFIG_A, 1);
|
|
|
- } else {
|
|
|
- t4_read_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A,
|
|
|
- &adap->params.tp.vlan_pri_map, 1,
|
|
|
- TP_VLAN_PRI_MAP_A);
|
|
|
- t4_read_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A,
|
|
|
- &adap->params.tp.ingress_config, 1,
|
|
|
- TP_INGRESS_CONFIG_A);
|
|
|
- }
|
|
|
+ t4_tp_pio_read(adap, &adap->params.tp.vlan_pri_map, 1,
|
|
|
+ TP_VLAN_PRI_MAP_A, sleep_ok);
|
|
|
+ t4_tp_pio_read(adap, &adap->params.tp.ingress_config, 1,
|
|
|
+ TP_INGRESS_CONFIG_A, sleep_ok);
|
|
|
+
|
|
|
/* For T6, cache the adapter's compressed error vector
|
|
|
* and passing outer header info for encapsulated packets.
|
|
|
*/
|