Commit 6f7c7e22 authored by David S. Miller's avatar David S. Miller

Merge branch 'octeontx2-fixes'

Hariprasad Kelam says:

====================
octeontx2: miscellaneous fixes

This series of patches fixes various issues related to NPC MCAM entry
management, debugfs, devlink, CGX LMAC mapping, RSS config etc

Change-log:
v2:
Fixed below review comments
	- corrected Fixed tag syntax with 12 digits SHA1
          and providing space between SHA1 and subject line
	- remove code improvement patch
	- make commit description more clear
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 804741ac 8c16cb03
...@@ -13499,8 +13499,6 @@ static struct npc_mcam_kex npc_mkex_default = { ...@@ -13499,8 +13499,6 @@ static struct npc_mcam_kex npc_mkex_default = {
[NPC_LT_LC_IP] = { [NPC_LT_LC_IP] = {
/* SIP+DIP: 8 bytes, KW2[63:0] */ /* SIP+DIP: 8 bytes, KW2[63:0] */
KEX_LD_CFG(0x07, 0xc, 0x1, 0x0, 0x10), KEX_LD_CFG(0x07, 0xc, 0x1, 0x0, 0x10),
/* TOS: 1 byte, KW1[63:56] */
KEX_LD_CFG(0x0, 0x1, 0x1, 0x0, 0xf),
}, },
/* Layer C: IPv6 */ /* Layer C: IPv6 */
[NPC_LT_LC_IP6] = { [NPC_LT_LC_IP6] = {
......
...@@ -2462,8 +2462,10 @@ static void rvu_unregister_interrupts(struct rvu *rvu) ...@@ -2462,8 +2462,10 @@ static void rvu_unregister_interrupts(struct rvu *rvu)
INTR_MASK(rvu->hw->total_pfs) & ~1ULL); INTR_MASK(rvu->hw->total_pfs) & ~1ULL);
for (irq = 0; irq < rvu->num_vec; irq++) { for (irq = 0; irq < rvu->num_vec; irq++) {
if (rvu->irq_allocated[irq]) if (rvu->irq_allocated[irq]) {
free_irq(pci_irq_vector(rvu->pdev, irq), rvu); free_irq(pci_irq_vector(rvu->pdev, irq), rvu);
rvu->irq_allocated[irq] = false;
}
} }
pci_free_irq_vectors(rvu->pdev); pci_free_irq_vectors(rvu->pdev);
...@@ -2975,8 +2977,8 @@ static void rvu_remove(struct pci_dev *pdev) ...@@ -2975,8 +2977,8 @@ static void rvu_remove(struct pci_dev *pdev)
struct rvu *rvu = pci_get_drvdata(pdev); struct rvu *rvu = pci_get_drvdata(pdev);
rvu_dbg_exit(rvu); rvu_dbg_exit(rvu);
rvu_unregister_interrupts(rvu);
rvu_unregister_dl(rvu); rvu_unregister_dl(rvu);
rvu_unregister_interrupts(rvu);
rvu_flr_wq_destroy(rvu); rvu_flr_wq_destroy(rvu);
rvu_cgx_exit(rvu); rvu_cgx_exit(rvu);
rvu_fwdata_exit(rvu); rvu_fwdata_exit(rvu);
......
...@@ -678,6 +678,7 @@ void npc_read_mcam_entry(struct rvu *rvu, struct npc_mcam *mcam, ...@@ -678,6 +678,7 @@ void npc_read_mcam_entry(struct rvu *rvu, struct npc_mcam *mcam,
u8 *intf, u8 *ena); u8 *intf, u8 *ena);
bool is_mac_feature_supported(struct rvu *rvu, int pf, int feature); bool is_mac_feature_supported(struct rvu *rvu, int pf, int feature);
u32 rvu_cgx_get_fifolen(struct rvu *rvu); u32 rvu_cgx_get_fifolen(struct rvu *rvu);
void *rvu_first_cgx_pdata(struct rvu *rvu);
/* CPT APIs */ /* CPT APIs */
int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int lf, int slot); int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int lf, int slot);
......
...@@ -89,6 +89,21 @@ void *rvu_cgx_pdata(u8 cgx_id, struct rvu *rvu) ...@@ -89,6 +89,21 @@ void *rvu_cgx_pdata(u8 cgx_id, struct rvu *rvu)
return rvu->cgx_idmap[cgx_id]; return rvu->cgx_idmap[cgx_id];
} }
/* Return first enabled CGX instance if none are enabled then return NULL */
void *rvu_first_cgx_pdata(struct rvu *rvu)
{
int first_enabled_cgx = 0;
void *cgxd = NULL;
for (; first_enabled_cgx < rvu->cgx_cnt_max; first_enabled_cgx++) {
cgxd = rvu_cgx_pdata(first_enabled_cgx, rvu);
if (cgxd)
break;
}
return cgxd;
}
/* Based on P2X connectivity find mapped NIX block for a PF */ /* Based on P2X connectivity find mapped NIX block for a PF */
static void rvu_map_cgx_nix_block(struct rvu *rvu, int pf, static void rvu_map_cgx_nix_block(struct rvu *rvu, int pf,
int cgx_id, int lmac_id) int cgx_id, int lmac_id)
...@@ -711,10 +726,9 @@ int rvu_mbox_handler_cgx_features_get(struct rvu *rvu, ...@@ -711,10 +726,9 @@ int rvu_mbox_handler_cgx_features_get(struct rvu *rvu,
u32 rvu_cgx_get_fifolen(struct rvu *rvu) u32 rvu_cgx_get_fifolen(struct rvu *rvu)
{ {
struct mac_ops *mac_ops; struct mac_ops *mac_ops;
int rvu_def_cgx_id = 0;
u32 fifo_len; u32 fifo_len;
mac_ops = get_mac_ops(rvu_cgx_pdata(rvu_def_cgx_id, rvu)); mac_ops = get_mac_ops(rvu_first_cgx_pdata(rvu));
fifo_len = mac_ops ? mac_ops->fifo_len : 0; fifo_len = mac_ops ? mac_ops->fifo_len : 0;
return fifo_len; return fifo_len;
......
...@@ -234,12 +234,14 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp, ...@@ -234,12 +234,14 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp,
char __user *buffer, char __user *buffer,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
int index, off = 0, flag = 0, go_back = 0, off_prev; int index, off = 0, flag = 0, go_back = 0, len = 0;
struct rvu *rvu = filp->private_data; struct rvu *rvu = filp->private_data;
int lf, pf, vf, pcifunc; int lf, pf, vf, pcifunc;
struct rvu_block block; struct rvu_block block;
int bytes_not_copied; int bytes_not_copied;
int lf_str_size = 12;
int buf_size = 2048; int buf_size = 2048;
char *lfs;
char *buf; char *buf;
/* don't allow partial reads */ /* don't allow partial reads */
...@@ -249,12 +251,18 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp, ...@@ -249,12 +251,18 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp,
buf = kzalloc(buf_size, GFP_KERNEL); buf = kzalloc(buf_size, GFP_KERNEL);
if (!buf) if (!buf)
return -ENOSPC; return -ENOSPC;
off += scnprintf(&buf[off], buf_size - 1 - off, "\npcifunc\t\t");
lfs = kzalloc(lf_str_size, GFP_KERNEL);
if (!lfs)
return -ENOMEM;
off += scnprintf(&buf[off], buf_size - 1 - off, "%-*s", lf_str_size,
"pcifunc");
for (index = 0; index < BLK_COUNT; index++) for (index = 0; index < BLK_COUNT; index++)
if (strlen(rvu->hw->block[index].name)) if (strlen(rvu->hw->block[index].name)) {
off += scnprintf(&buf[off], buf_size - 1 - off, off += scnprintf(&buf[off], buf_size - 1 - off,
"%*s\t", (index - 1) * 2, "%-*s", lf_str_size,
rvu->hw->block[index].name); rvu->hw->block[index].name);
}
off += scnprintf(&buf[off], buf_size - 1 - off, "\n"); off += scnprintf(&buf[off], buf_size - 1 - off, "\n");
for (pf = 0; pf < rvu->hw->total_pfs; pf++) { for (pf = 0; pf < rvu->hw->total_pfs; pf++) {
for (vf = 0; vf <= rvu->hw->total_vfs; vf++) { for (vf = 0; vf <= rvu->hw->total_vfs; vf++) {
...@@ -263,14 +271,15 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp, ...@@ -263,14 +271,15 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp,
continue; continue;
if (vf) { if (vf) {
sprintf(lfs, "PF%d:VF%d", pf, vf - 1);
go_back = scnprintf(&buf[off], go_back = scnprintf(&buf[off],
buf_size - 1 - off, buf_size - 1 - off,
"PF%d:VF%d\t\t", pf, "%-*s", lf_str_size, lfs);
vf - 1);
} else { } else {
sprintf(lfs, "PF%d", pf);
go_back = scnprintf(&buf[off], go_back = scnprintf(&buf[off],
buf_size - 1 - off, buf_size - 1 - off,
"PF%d\t\t", pf); "%-*s", lf_str_size, lfs);
} }
off += go_back; off += go_back;
...@@ -278,20 +287,22 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp, ...@@ -278,20 +287,22 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp,
block = rvu->hw->block[index]; block = rvu->hw->block[index];
if (!strlen(block.name)) if (!strlen(block.name))
continue; continue;
off_prev = off; len = 0;
lfs[len] = '\0';
for (lf = 0; lf < block.lf.max; lf++) { for (lf = 0; lf < block.lf.max; lf++) {
if (block.fn_map[lf] != pcifunc) if (block.fn_map[lf] != pcifunc)
continue; continue;
flag = 1; flag = 1;
off += scnprintf(&buf[off], buf_size - 1 len += sprintf(&lfs[len], "%d,", lf);
- off, "%3d,", lf);
} }
if (flag && off_prev != off)
off--; if (flag)
else len--;
go_back++; lfs[len] = '\0';
off += scnprintf(&buf[off], buf_size - 1 - off, off += scnprintf(&buf[off], buf_size - 1 - off,
"\t"); "%-*s", lf_str_size, lfs);
if (!strlen(lfs))
go_back += lf_str_size;
} }
if (!flag) if (!flag)
off -= go_back; off -= go_back;
...@@ -303,6 +314,7 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp, ...@@ -303,6 +314,7 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp,
} }
bytes_not_copied = copy_to_user(buffer, buf, off); bytes_not_copied = copy_to_user(buffer, buf, off);
kfree(lfs);
kfree(buf); kfree(buf);
if (bytes_not_copied) if (bytes_not_copied)
...@@ -319,7 +331,6 @@ static int rvu_dbg_rvu_pf_cgx_map_display(struct seq_file *filp, void *unused) ...@@ -319,7 +331,6 @@ static int rvu_dbg_rvu_pf_cgx_map_display(struct seq_file *filp, void *unused)
struct rvu *rvu = filp->private; struct rvu *rvu = filp->private;
struct pci_dev *pdev = NULL; struct pci_dev *pdev = NULL;
struct mac_ops *mac_ops; struct mac_ops *mac_ops;
int rvu_def_cgx_id = 0;
char cgx[10], lmac[10]; char cgx[10], lmac[10];
struct rvu_pfvf *pfvf; struct rvu_pfvf *pfvf;
int pf, domain, blkid; int pf, domain, blkid;
...@@ -327,7 +338,10 @@ static int rvu_dbg_rvu_pf_cgx_map_display(struct seq_file *filp, void *unused) ...@@ -327,7 +338,10 @@ static int rvu_dbg_rvu_pf_cgx_map_display(struct seq_file *filp, void *unused)
u16 pcifunc; u16 pcifunc;
domain = 2; domain = 2;
mac_ops = get_mac_ops(rvu_cgx_pdata(rvu_def_cgx_id, rvu)); mac_ops = get_mac_ops(rvu_first_cgx_pdata(rvu));
/* There can be no CGX devices at all */
if (!mac_ops)
return 0;
seq_printf(filp, "PCI dev\t\tRVU PF Func\tNIX block\t%s\tLMAC\n", seq_printf(filp, "PCI dev\t\tRVU PF Func\tNIX block\t%s\tLMAC\n",
mac_ops->name); mac_ops->name);
for (pf = 0; pf < rvu->hw->total_pfs; pf++) { for (pf = 0; pf < rvu->hw->total_pfs; pf++) {
...@@ -1818,7 +1832,6 @@ static void rvu_dbg_cgx_init(struct rvu *rvu) ...@@ -1818,7 +1832,6 @@ static void rvu_dbg_cgx_init(struct rvu *rvu)
{ {
struct mac_ops *mac_ops; struct mac_ops *mac_ops;
unsigned long lmac_bmap; unsigned long lmac_bmap;
int rvu_def_cgx_id = 0;
int i, lmac_id; int i, lmac_id;
char dname[20]; char dname[20];
void *cgx; void *cgx;
...@@ -1826,7 +1839,7 @@ static void rvu_dbg_cgx_init(struct rvu *rvu) ...@@ -1826,7 +1839,7 @@ static void rvu_dbg_cgx_init(struct rvu *rvu)
if (!cgx_get_cgxcnt_max()) if (!cgx_get_cgxcnt_max())
return; return;
mac_ops = get_mac_ops(rvu_cgx_pdata(rvu_def_cgx_id, rvu)); mac_ops = get_mac_ops(rvu_first_cgx_pdata(rvu));
if (!mac_ops) if (!mac_ops)
return; return;
......
...@@ -2629,7 +2629,7 @@ static int set_flowkey_fields(struct nix_rx_flowkey_alg *alg, u32 flow_cfg) ...@@ -2629,7 +2629,7 @@ static int set_flowkey_fields(struct nix_rx_flowkey_alg *alg, u32 flow_cfg)
struct nix_rx_flowkey_alg *field; struct nix_rx_flowkey_alg *field;
struct nix_rx_flowkey_alg tmp; struct nix_rx_flowkey_alg tmp;
u32 key_type, valid_key; u32 key_type, valid_key;
int l4_key_offset; int l4_key_offset = 0;
if (!alg) if (!alg)
return -EINVAL; return -EINVAL;
......
...@@ -2490,10 +2490,10 @@ int rvu_mbox_handler_npc_mcam_free_counter(struct rvu *rvu, ...@@ -2490,10 +2490,10 @@ int rvu_mbox_handler_npc_mcam_free_counter(struct rvu *rvu,
index = find_next_bit(mcam->bmap, mcam->bmap_entries, entry); index = find_next_bit(mcam->bmap, mcam->bmap_entries, entry);
if (index >= mcam->bmap_entries) if (index >= mcam->bmap_entries)
break; break;
entry = index + 1;
if (mcam->entry2cntr_map[index] != req->cntr) if (mcam->entry2cntr_map[index] != req->cntr)
continue; continue;
entry = index + 1;
npc_unmap_mcam_entry_and_cntr(rvu, mcam, blkaddr, npc_unmap_mcam_entry_and_cntr(rvu, mcam, blkaddr,
index, req->cntr); index, req->cntr);
} }
......
...@@ -257,17 +257,19 @@ int otx2_get_flow(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc, ...@@ -257,17 +257,19 @@ int otx2_get_flow(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc,
int otx2_get_all_flows(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc, int otx2_get_all_flows(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc,
u32 *rule_locs) u32 *rule_locs)
{ {
u32 rule_cnt = nfc->rule_cnt;
u32 location = 0; u32 location = 0;
int idx = 0; int idx = 0;
int err = 0; int err = 0;
nfc->data = pfvf->flow_cfg->ntuple_max_flows; nfc->data = pfvf->flow_cfg->ntuple_max_flows;
while ((!err || err == -ENOENT) && idx < nfc->rule_cnt) { while ((!err || err == -ENOENT) && idx < rule_cnt) {
err = otx2_get_flow(pfvf, nfc, location); err = otx2_get_flow(pfvf, nfc, location);
if (!err) if (!err)
rule_locs[idx++] = location; rule_locs[idx++] = location;
location++; location++;
} }
nfc->rule_cnt = rule_cnt;
return err; return err;
} }
......
...@@ -1672,6 +1672,7 @@ int otx2_stop(struct net_device *netdev) ...@@ -1672,6 +1672,7 @@ int otx2_stop(struct net_device *netdev)
struct otx2_nic *pf = netdev_priv(netdev); struct otx2_nic *pf = netdev_priv(netdev);
struct otx2_cq_poll *cq_poll = NULL; struct otx2_cq_poll *cq_poll = NULL;
struct otx2_qset *qset = &pf->qset; struct otx2_qset *qset = &pf->qset;
struct otx2_rss_info *rss;
int qidx, vec, wrk; int qidx, vec, wrk;
netif_carrier_off(netdev); netif_carrier_off(netdev);
...@@ -1684,6 +1685,10 @@ int otx2_stop(struct net_device *netdev) ...@@ -1684,6 +1685,10 @@ int otx2_stop(struct net_device *netdev)
/* First stop packet Rx/Tx */ /* First stop packet Rx/Tx */
otx2_rxtx_enable(pf, false); otx2_rxtx_enable(pf, false);
/* Clear RSS enable flag */
rss = &pf->hw.rss_info;
rss->enable = false;
/* Cleanup Queue IRQ */ /* Cleanup Queue IRQ */
vec = pci_irq_vector(pf->pdev, vec = pci_irq_vector(pf->pdev,
pf->hw.nix_msixoff + NIX_LF_QINT_VEC_START); pf->hw.nix_msixoff + NIX_LF_QINT_VEC_START);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment