Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cxgb4: collect SGE PF/VF queue map

For T6, collect info on queue mapping to corresponding PF/VF in SGE.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Rahul Lakkireddy and committed by
David S. Miller
80a95a80 a3302baa

+65 -2
+17
drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h
··· 62 62 u32 map; 63 63 }; 64 64 65 + #define SGE_QBASE_DATA_REG_NUM 4 66 + 67 + struct sge_qbase_reg_field { 68 + u32 reg_addr; 69 + u32 reg_data[SGE_QBASE_DATA_REG_NUM]; 70 + /* Max supported PFs */ 71 + u32 pf_data_value[PCIE_FW_MASTER_M + 1][SGE_QBASE_DATA_REG_NUM]; 72 + /* Max supported VFs */ 73 + u32 vf_data_value[T6_VF_M + 1][SGE_QBASE_DATA_REG_NUM]; 74 + u32 vfcount; /* Actual number of max vfs in current configuration */ 75 + }; 76 + 65 77 struct ireg_field { 66 78 u32 ireg_addr; 67 79 u32 ireg_data; ··· 367 355 static const u32 t5_sge_dbg_index_array[2][IREG_NUM_ELEM] = { 368 356 {0x10cc, 0x10d0, 0x0, 16}, 369 357 {0x10cc, 0x10d4, 0x0, 16}, 358 + }; 359 + 360 + static const u32 t6_sge_qbase_index_array[] = { 361 + /* 1 addr reg SGE_QBASE_INDEX and 4 data reg SGE_QBASE_MAP[0-3] */ 362 + 0x1250, 0x1240, 0x1244, 0x1248, 0x124c, 370 363 }; 371 364 372 365 static const u32 t5_pcie_pdbg_array[][IREG_NUM_ELEM] = {
+46 -1
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
··· 1339 1339 return cudbg_write_and_release_buff(pdbg_init, &temp_buff, dbg_buff); 1340 1340 } 1341 1341 1342 + static void cudbg_read_sge_qbase_indirect_reg(struct adapter *padap, 1343 + struct sge_qbase_reg_field *qbase, 1344 + u32 func, bool is_pf) 1345 + { 1346 + u32 *buff, i; 1347 + 1348 + if (is_pf) { 1349 + buff = qbase->pf_data_value[func]; 1350 + } else { 1351 + buff = qbase->vf_data_value[func]; 1352 + /* In SGE_QBASE_INDEX, 1353 + * Entries 0->7 are PF0->7, Entries 8->263 are VFID0->256. 1354 + */ 1355 + func += 8; 1356 + } 1357 + 1358 + t4_write_reg(padap, qbase->reg_addr, func); 1359 + for (i = 0; i < SGE_QBASE_DATA_REG_NUM; i++, buff++) 1360 + *buff = t4_read_reg(padap, qbase->reg_data[i]); 1361 + } 1362 + 1342 1363 int cudbg_collect_sge_indirect(struct cudbg_init *pdbg_init, 1343 1364 struct cudbg_buffer *dbg_buff, 1344 1365 struct cudbg_error *cudbg_err) 1345 1366 { 1346 1367 struct adapter *padap = pdbg_init->adap; 1347 1368 struct cudbg_buffer temp_buff = { 0 }; 1369 + struct sge_qbase_reg_field *sge_qbase; 1348 1370 struct ireg_buf *ch_sge_dbg; 1349 1371 int i, rc; 1350 1372 1351 - rc = cudbg_get_buff(pdbg_init, dbg_buff, sizeof(*ch_sge_dbg) * 2, 1373 + rc = cudbg_get_buff(pdbg_init, dbg_buff, 1374 + sizeof(*ch_sge_dbg) * 2 + sizeof(*sge_qbase), 1352 1375 &temp_buff); 1353 1376 if (rc) 1354 1377 return rc; ··· 1393 1370 sge_pio->ireg_local_offset); 1394 1371 ch_sge_dbg++; 1395 1372 } 1373 + 1374 + if (CHELSIO_CHIP_VERSION(padap->params.chip) > CHELSIO_T5) { 1375 + sge_qbase = (struct sge_qbase_reg_field *)ch_sge_dbg; 1376 + /* 1 addr reg SGE_QBASE_INDEX and 4 data reg 1377 + * SGE_QBASE_MAP[0-3] 1378 + */ 1379 + sge_qbase->reg_addr = t6_sge_qbase_index_array[0]; 1380 + for (i = 0; i < SGE_QBASE_DATA_REG_NUM; i++) 1381 + sge_qbase->reg_data[i] = 1382 + t6_sge_qbase_index_array[i + 1]; 1383 + 1384 + for (i = 0; i <= PCIE_FW_MASTER_M; i++) 1385 + cudbg_read_sge_qbase_indirect_reg(padap, sge_qbase, 1386 + i, true); 1387 + 1388 + for (i = 0; i < padap->params.arch.vfcount; i++) 1389 + cudbg_read_sge_qbase_indirect_reg(padap, sge_qbase, 1390 + i, false); 1391 + 1392 + sge_qbase->vfcount = padap->params.arch.vfcount; 1393 + } 1394 + 1396 1395 return cudbg_write_and_release_buff(pdbg_init, &temp_buff, dbg_buff); 1397 1396 } 1398 1397
+2 -1
drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c
··· 214 214 len = sizeof(struct ireg_buf) * n; 215 215 break; 216 216 case CUDBG_SGE_INDIRECT: 217 - len = sizeof(struct ireg_buf) * 2; 217 + len = sizeof(struct ireg_buf) * 2 + 218 + sizeof(struct sge_qbase_reg_field); 218 219 break; 219 220 case CUDBG_ULPRX_LA: 220 221 len = sizeof(struct cudbg_ulprx_la);