Commit 5a7e4b48 authored by David S. Miller's avatar David S. Miller

Merge branch 'cxgb4-next'

Hariprasad Shenai says:

====================
cxgb4/cxgb4vf: Adds FL starvation support and cleanup

This patch series adds the following.
Adds debugfs entry to inject freelist starvation and some function and
argument cleanup

This patch series has been created against net-next tree and includes
patches on cxgb4 and cxgb4vf driver.

We have included all the maintainers of respective drivers. Kindly review
the change and let us know in case of any review comments.

Thanks

V2:
Skipping patch "cxgb4: Add support for loopback between VI of same port".
This needs some major code change, since module param is not recommended.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c6bfda8d b2612722
...@@ -650,6 +650,7 @@ struct sge { ...@@ -650,6 +650,7 @@ struct sge {
struct sge_rspq **ingr_map; /* qid->queue ingress queue map */ struct sge_rspq **ingr_map; /* qid->queue ingress queue map */
unsigned long *starving_fl; unsigned long *starving_fl;
unsigned long *txq_maperr; unsigned long *txq_maperr;
unsigned long *blocked_fl;
struct timer_list rx_timer; /* refills starving FLs */ struct timer_list rx_timer; /* refills starving FLs */
struct timer_list tx_timer; /* checks Tx queues */ struct timer_list tx_timer; /* checks Tx queues */
}; };
...@@ -678,7 +679,7 @@ struct adapter { ...@@ -678,7 +679,7 @@ struct adapter {
struct pci_dev *pdev; struct pci_dev *pdev;
struct device *pdev_dev; struct device *pdev_dev;
unsigned int mbox; unsigned int mbox;
unsigned int fn; unsigned int pf;
unsigned int flags; unsigned int flags;
enum chip_type chip; enum chip_type chip;
...@@ -1220,7 +1221,7 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, ...@@ -1220,7 +1221,7 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info,
int t4_prep_adapter(struct adapter *adapter); int t4_prep_adapter(struct adapter *adapter);
enum t4_bar2_qtype { T4_BAR2_QTYPE_EGRESS, T4_BAR2_QTYPE_INGRESS }; enum t4_bar2_qtype { T4_BAR2_QTYPE_EGRESS, T4_BAR2_QTYPE_INGRESS };
int cxgb4_t4_bar2_sge_qregs(struct adapter *adapter, int t4_bar2_sge_qregs(struct adapter *adapter,
unsigned int qid, unsigned int qid,
enum t4_bar2_qtype qtype, enum t4_bar2_qtype qtype,
u64 *pbar2_qoffset, u64 *pbar2_qoffset,
......
...@@ -1222,7 +1222,7 @@ static int sensors_show(struct seq_file *seq, void *v) ...@@ -1222,7 +1222,7 @@ static int sensors_show(struct seq_file *seq, void *v)
param[1] = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) | param[1] = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) |
FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_DIAG) | FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_DIAG) |
FW_PARAMS_PARAM_Y_V(FW_PARAM_DEV_DIAG_VDD)); FW_PARAMS_PARAM_Y_V(FW_PARAM_DEV_DIAG_VDD));
ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2, ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 2,
param, val); param, val);
if (ret < 0 || val[0] == 0) if (ret < 0 || val[0] == 0)
...@@ -1959,6 +1959,61 @@ static void add_debugfs_mem(struct adapter *adap, const char *name, ...@@ -1959,6 +1959,61 @@ static void add_debugfs_mem(struct adapter *adap, const char *name,
size_mb << 20); size_mb << 20);
} }
static int blocked_fl_open(struct inode *inode, struct file *file)
{
file->private_data = inode->i_private;
return 0;
}
static ssize_t blocked_fl_read(struct file *filp, char __user *ubuf,
size_t count, loff_t *ppos)
{
int len;
const struct adapter *adap = filp->private_data;
char *buf;
ssize_t size = (adap->sge.egr_sz + 3) / 4 +
adap->sge.egr_sz / 32 + 2; /* includes ,/\n/\0 */
buf = kzalloc(size, GFP_KERNEL);
if (!buf)
return -ENOMEM;
len = snprintf(buf, size - 1, "%*pb\n",
adap->sge.egr_sz, adap->sge.blocked_fl);
len += sprintf(buf + len, "\n");
size = simple_read_from_buffer(ubuf, count, ppos, buf, len);
t4_free_mem(buf);
return size;
}
static ssize_t blocked_fl_write(struct file *filp, const char __user *ubuf,
size_t count, loff_t *ppos)
{
int err;
unsigned long *t;
struct adapter *adap = filp->private_data;
t = kcalloc(BITS_TO_LONGS(adap->sge.egr_sz), sizeof(long), GFP_KERNEL);
if (!t)
return -ENOMEM;
err = bitmap_parse_user(ubuf, count, t, adap->sge.egr_sz);
if (err)
return err;
bitmap_copy(adap->sge.blocked_fl, t, adap->sge.egr_sz);
t4_free_mem(t);
return count;
}
static const struct file_operations blocked_fl_fops = {
.owner = THIS_MODULE,
.open = blocked_fl_open,
.read = blocked_fl_read,
.write = blocked_fl_write,
.llseek = generic_file_llseek,
};
/* Add an array of Debug FS files. /* Add an array of Debug FS files.
*/ */
void add_debugfs_files(struct adapter *adap, void add_debugfs_files(struct adapter *adap,
...@@ -2022,6 +2077,7 @@ int t4_setup_debugfs(struct adapter *adap) ...@@ -2022,6 +2077,7 @@ int t4_setup_debugfs(struct adapter *adap)
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
{ "clip_tbl", &clip_tbl_debugfs_fops, S_IRUSR, 0 }, { "clip_tbl", &clip_tbl_debugfs_fops, S_IRUSR, 0 },
#endif #endif
{ "blocked_fl", &blocked_fl_fops, S_IRUSR | S_IWUSR, 0 },
}; };
/* Debug FS nodes common to all T5 and later adapters. /* Debug FS nodes common to all T5 and later adapters.
......
...@@ -250,7 +250,7 @@ static int restart_autoneg(struct net_device *dev) ...@@ -250,7 +250,7 @@ static int restart_autoneg(struct net_device *dev)
return -EAGAIN; return -EAGAIN;
if (p->link_cfg.autoneg != AUTONEG_ENABLE) if (p->link_cfg.autoneg != AUTONEG_ENABLE)
return -EINVAL; return -EINVAL;
t4_restart_aneg(p->adapter, p->adapter->fn, p->tx_chan); t4_restart_aneg(p->adapter, p->adapter->pf, p->tx_chan);
return 0; return 0;
} }
...@@ -267,7 +267,7 @@ static int identify_port(struct net_device *dev, ...@@ -267,7 +267,7 @@ static int identify_port(struct net_device *dev,
else else
return -EINVAL; return -EINVAL;
return t4_identify_port(adap, adap->fn, netdev2pinfo(dev)->viid, val); return t4_identify_port(adap, adap->pf, netdev2pinfo(dev)->viid, val);
} }
static unsigned int from_fw_linkcaps(enum fw_port_type type, unsigned int caps) static unsigned int from_fw_linkcaps(enum fw_port_type type, unsigned int caps)
...@@ -439,7 +439,7 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -439,7 +439,7 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
lc->autoneg = cmd->autoneg; lc->autoneg = cmd->autoneg;
if (netif_running(dev)) if (netif_running(dev))
return t4_link_start(p->adapter, p->adapter->fn, p->tx_chan, return t4_link_start(p->adapter, p->adapter->pf, p->tx_chan,
lc); lc);
return 0; return 0;
} }
...@@ -472,7 +472,7 @@ static int set_pauseparam(struct net_device *dev, ...@@ -472,7 +472,7 @@ static int set_pauseparam(struct net_device *dev,
if (epause->tx_pause) if (epause->tx_pause)
lc->requested_fc |= PAUSE_TX; lc->requested_fc |= PAUSE_TX;
if (netif_running(dev)) if (netif_running(dev))
return t4_link_start(p->adapter, p->adapter->fn, p->tx_chan, return t4_link_start(p->adapter, p->adapter->pf, p->tx_chan,
lc); lc);
return 0; return 0;
} }
...@@ -617,7 +617,7 @@ static int eeprom_ptov(unsigned int phys_addr, unsigned int fn, unsigned int sz) ...@@ -617,7 +617,7 @@ static int eeprom_ptov(unsigned int phys_addr, unsigned int fn, unsigned int sz)
*/ */
static int eeprom_rd_phys(struct adapter *adap, unsigned int phys_addr, u32 *v) static int eeprom_rd_phys(struct adapter *adap, unsigned int phys_addr, u32 *v)
{ {
int vaddr = eeprom_ptov(phys_addr, adap->fn, EEPROMPFSIZE); int vaddr = eeprom_ptov(phys_addr, adap->pf, EEPROMPFSIZE);
if (vaddr >= 0) if (vaddr >= 0)
vaddr = pci_read_vpd(adap->pdev, vaddr, sizeof(u32), v); vaddr = pci_read_vpd(adap->pdev, vaddr, sizeof(u32), v);
...@@ -626,7 +626,7 @@ static int eeprom_rd_phys(struct adapter *adap, unsigned int phys_addr, u32 *v) ...@@ -626,7 +626,7 @@ static int eeprom_rd_phys(struct adapter *adap, unsigned int phys_addr, u32 *v)
static int eeprom_wr_phys(struct adapter *adap, unsigned int phys_addr, u32 v) static int eeprom_wr_phys(struct adapter *adap, unsigned int phys_addr, u32 v)
{ {
int vaddr = eeprom_ptov(phys_addr, adap->fn, EEPROMPFSIZE); int vaddr = eeprom_ptov(phys_addr, adap->pf, EEPROMPFSIZE);
if (vaddr >= 0) if (vaddr >= 0)
vaddr = pci_write_vpd(adap->pdev, vaddr, sizeof(u32), &v); vaddr = pci_write_vpd(adap->pdev, vaddr, sizeof(u32), &v);
...@@ -669,8 +669,8 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, ...@@ -669,8 +669,8 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
aligned_offset = eeprom->offset & ~3; aligned_offset = eeprom->offset & ~3;
aligned_len = (eeprom->len + (eeprom->offset & 3) + 3) & ~3; aligned_len = (eeprom->len + (eeprom->offset & 3) + 3) & ~3;
if (adapter->fn > 0) { if (adapter->pf > 0) {
u32 start = 1024 + adapter->fn * EEPROMPFSIZE; u32 start = 1024 + adapter->pf * EEPROMPFSIZE;
if (aligned_offset < start || if (aligned_offset < start ||
aligned_offset + aligned_len > start + EEPROMPFSIZE) aligned_offset + aligned_len > start + EEPROMPFSIZE)
......
...@@ -588,6 +588,11 @@ static unsigned int refill_fl(struct adapter *adap, struct sge_fl *q, int n, ...@@ -588,6 +588,11 @@ static unsigned int refill_fl(struct adapter *adap, struct sge_fl *q, int n,
struct rx_sw_desc *sd = &q->sdesc[q->pidx]; struct rx_sw_desc *sd = &q->sdesc[q->pidx];
int node; int node;
#ifdef CONFIG_DEBUG_FS
if (test_bit(q->cntxt_id - adap->sge.egr_start, adap->sge.blocked_fl))
goto out;
#endif
gfp |= __GFP_NOWARN; gfp |= __GFP_NOWARN;
node = dev_to_node(adap->pdev_dev); node = dev_to_node(adap->pdev_dev);
...@@ -1260,7 +1265,7 @@ out_free: dev_kfree_skb_any(skb); ...@@ -1260,7 +1265,7 @@ out_free: dev_kfree_skb_any(skb);
cpl->ctrl0 = htonl(TXPKT_OPCODE_V(CPL_TX_PKT_XT) | cpl->ctrl0 = htonl(TXPKT_OPCODE_V(CPL_TX_PKT_XT) |
TXPKT_INTF_V(pi->tx_chan) | TXPKT_INTF_V(pi->tx_chan) |
TXPKT_PF_V(adap->fn)); TXPKT_PF_V(adap->pf));
cpl->pack = htons(0); cpl->pack = htons(0);
cpl->len = htons(skb->len); cpl->len = htons(skb->len);
cpl->ctrl1 = cpu_to_be64(cntrl); cpl->ctrl1 = cpu_to_be64(cntrl);
...@@ -2385,7 +2390,7 @@ static void __iomem *bar2_address(struct adapter *adapter, ...@@ -2385,7 +2390,7 @@ static void __iomem *bar2_address(struct adapter *adapter,
u64 bar2_qoffset; u64 bar2_qoffset;
int ret; int ret;
ret = cxgb4_t4_bar2_sge_qregs(adapter, qid, qtype, ret = t4_bar2_sge_qregs(adapter, qid, qtype,
&bar2_qoffset, pbar2_qid); &bar2_qoffset, pbar2_qid);
if (ret) if (ret)
return NULL; return NULL;
...@@ -2416,7 +2421,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, ...@@ -2416,7 +2421,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
memset(&c, 0, sizeof(c)); memset(&c, 0, sizeof(c));
c.op_to_vfn = htonl(FW_CMD_OP_V(FW_IQ_CMD) | FW_CMD_REQUEST_F | c.op_to_vfn = htonl(FW_CMD_OP_V(FW_IQ_CMD) | FW_CMD_REQUEST_F |
FW_CMD_WRITE_F | FW_CMD_EXEC_F | FW_CMD_WRITE_F | FW_CMD_EXEC_F |
FW_IQ_CMD_PFN_V(adap->fn) | FW_IQ_CMD_VFN_V(0)); FW_IQ_CMD_PFN_V(adap->pf) | FW_IQ_CMD_VFN_V(0));
c.alloc_to_len16 = htonl(FW_IQ_CMD_ALLOC_F | FW_IQ_CMD_IQSTART_F | c.alloc_to_len16 = htonl(FW_IQ_CMD_ALLOC_F | FW_IQ_CMD_IQSTART_F |
FW_LEN16(c)); FW_LEN16(c));
c.type_to_iqandstindex = htonl(FW_IQ_CMD_TYPE_V(FW_IQ_TYPE_FL_INT_CAP) | c.type_to_iqandstindex = htonl(FW_IQ_CMD_TYPE_V(FW_IQ_TYPE_FL_INT_CAP) |
...@@ -2468,7 +2473,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, ...@@ -2468,7 +2473,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
c.fl0addr = cpu_to_be64(fl->addr); c.fl0addr = cpu_to_be64(fl->addr);
} }
ret = t4_wr_mbox(adap, adap->fn, &c, sizeof(c), &c); ret = t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), &c);
if (ret) if (ret)
goto err; goto err;
...@@ -2536,7 +2541,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, ...@@ -2536,7 +2541,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
CONMCTXT_CNGCHMAP_V(1 << (i << 2)); CONMCTXT_CNGCHMAP_V(1 << (i << 2));
} }
} }
ret = t4_set_params(adap, adap->mbox, adap->fn, 0, 1, ret = t4_set_params(adap, adap->mbox, adap->pf, 0, 1,
&param, &val); &param, &val);
if (ret) if (ret)
dev_warn(adap->pdev_dev, "Failed to set Congestion" dev_warn(adap->pdev_dev, "Failed to set Congestion"
...@@ -2601,7 +2606,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, ...@@ -2601,7 +2606,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
memset(&c, 0, sizeof(c)); memset(&c, 0, sizeof(c));
c.op_to_vfn = htonl(FW_CMD_OP_V(FW_EQ_ETH_CMD) | FW_CMD_REQUEST_F | c.op_to_vfn = htonl(FW_CMD_OP_V(FW_EQ_ETH_CMD) | FW_CMD_REQUEST_F |
FW_CMD_WRITE_F | FW_CMD_EXEC_F | FW_CMD_WRITE_F | FW_CMD_EXEC_F |
FW_EQ_ETH_CMD_PFN_V(adap->fn) | FW_EQ_ETH_CMD_PFN_V(adap->pf) |
FW_EQ_ETH_CMD_VFN_V(0)); FW_EQ_ETH_CMD_VFN_V(0));
c.alloc_to_len16 = htonl(FW_EQ_ETH_CMD_ALLOC_F | c.alloc_to_len16 = htonl(FW_EQ_ETH_CMD_ALLOC_F |
FW_EQ_ETH_CMD_EQSTART_F | FW_LEN16(c)); FW_EQ_ETH_CMD_EQSTART_F | FW_LEN16(c));
...@@ -2618,7 +2623,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, ...@@ -2618,7 +2623,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
FW_EQ_ETH_CMD_EQSIZE_V(nentries)); FW_EQ_ETH_CMD_EQSIZE_V(nentries));
c.eqaddr = cpu_to_be64(txq->q.phys_addr); c.eqaddr = cpu_to_be64(txq->q.phys_addr);
ret = t4_wr_mbox(adap, adap->fn, &c, sizeof(c), &c); ret = t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), &c);
if (ret) { if (ret) {
kfree(txq->q.sdesc); kfree(txq->q.sdesc);
txq->q.sdesc = NULL; txq->q.sdesc = NULL;
...@@ -2656,7 +2661,7 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq, ...@@ -2656,7 +2661,7 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq,
c.op_to_vfn = htonl(FW_CMD_OP_V(FW_EQ_CTRL_CMD) | FW_CMD_REQUEST_F | c.op_to_vfn = htonl(FW_CMD_OP_V(FW_EQ_CTRL_CMD) | FW_CMD_REQUEST_F |
FW_CMD_WRITE_F | FW_CMD_EXEC_F | FW_CMD_WRITE_F | FW_CMD_EXEC_F |
FW_EQ_CTRL_CMD_PFN_V(adap->fn) | FW_EQ_CTRL_CMD_PFN_V(adap->pf) |
FW_EQ_CTRL_CMD_VFN_V(0)); FW_EQ_CTRL_CMD_VFN_V(0));
c.alloc_to_len16 = htonl(FW_EQ_CTRL_CMD_ALLOC_F | c.alloc_to_len16 = htonl(FW_EQ_CTRL_CMD_ALLOC_F |
FW_EQ_CTRL_CMD_EQSTART_F | FW_LEN16(c)); FW_EQ_CTRL_CMD_EQSTART_F | FW_LEN16(c));
...@@ -2673,7 +2678,7 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq, ...@@ -2673,7 +2678,7 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq,
FW_EQ_CTRL_CMD_EQSIZE_V(nentries)); FW_EQ_CTRL_CMD_EQSIZE_V(nentries));
c.eqaddr = cpu_to_be64(txq->q.phys_addr); c.eqaddr = cpu_to_be64(txq->q.phys_addr);
ret = t4_wr_mbox(adap, adap->fn, &c, sizeof(c), &c); ret = t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), &c);
if (ret) { if (ret) {
dma_free_coherent(adap->pdev_dev, dma_free_coherent(adap->pdev_dev,
nentries * sizeof(struct tx_desc), nentries * sizeof(struct tx_desc),
...@@ -2711,7 +2716,7 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq, ...@@ -2711,7 +2716,7 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq,
memset(&c, 0, sizeof(c)); memset(&c, 0, sizeof(c));
c.op_to_vfn = htonl(FW_CMD_OP_V(FW_EQ_OFLD_CMD) | FW_CMD_REQUEST_F | c.op_to_vfn = htonl(FW_CMD_OP_V(FW_EQ_OFLD_CMD) | FW_CMD_REQUEST_F |
FW_CMD_WRITE_F | FW_CMD_EXEC_F | FW_CMD_WRITE_F | FW_CMD_EXEC_F |
FW_EQ_OFLD_CMD_PFN_V(adap->fn) | FW_EQ_OFLD_CMD_PFN_V(adap->pf) |
FW_EQ_OFLD_CMD_VFN_V(0)); FW_EQ_OFLD_CMD_VFN_V(0));
c.alloc_to_len16 = htonl(FW_EQ_OFLD_CMD_ALLOC_F | c.alloc_to_len16 = htonl(FW_EQ_OFLD_CMD_ALLOC_F |
FW_EQ_OFLD_CMD_EQSTART_F | FW_LEN16(c)); FW_EQ_OFLD_CMD_EQSTART_F | FW_LEN16(c));
...@@ -2726,7 +2731,7 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq, ...@@ -2726,7 +2731,7 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq,
FW_EQ_OFLD_CMD_EQSIZE_V(nentries)); FW_EQ_OFLD_CMD_EQSIZE_V(nentries));
c.eqaddr = cpu_to_be64(txq->q.phys_addr); c.eqaddr = cpu_to_be64(txq->q.phys_addr);
ret = t4_wr_mbox(adap, adap->fn, &c, sizeof(c), &c); ret = t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), &c);
if (ret) { if (ret) {
kfree(txq->q.sdesc); kfree(txq->q.sdesc);
txq->q.sdesc = NULL; txq->q.sdesc = NULL;
...@@ -2765,7 +2770,7 @@ static void free_rspq_fl(struct adapter *adap, struct sge_rspq *rq, ...@@ -2765,7 +2770,7 @@ static void free_rspq_fl(struct adapter *adap, struct sge_rspq *rq,
unsigned int fl_id = fl ? fl->cntxt_id : 0xffff; unsigned int fl_id = fl ? fl->cntxt_id : 0xffff;
adap->sge.ingr_map[rq->cntxt_id - adap->sge.ingr_start] = NULL; adap->sge.ingr_map[rq->cntxt_id - adap->sge.ingr_start] = NULL;
t4_iq_free(adap, adap->fn, adap->fn, 0, FW_IQ_TYPE_FL_INT_CAP, t4_iq_free(adap, adap->mbox, adap->pf, 0, FW_IQ_TYPE_FL_INT_CAP,
rq->cntxt_id, fl_id, 0xffff); rq->cntxt_id, fl_id, 0xffff);
dma_free_coherent(adap->pdev_dev, (rq->size + 1) * rq->iqe_len, dma_free_coherent(adap->pdev_dev, (rq->size + 1) * rq->iqe_len,
rq->desc, rq->phys_addr); rq->desc, rq->phys_addr);
...@@ -2820,7 +2825,7 @@ void t4_free_sge_resources(struct adapter *adap) ...@@ -2820,7 +2825,7 @@ void t4_free_sge_resources(struct adapter *adap)
free_rspq_fl(adap, &eq->rspq, free_rspq_fl(adap, &eq->rspq,
eq->fl.size ? &eq->fl : NULL); eq->fl.size ? &eq->fl : NULL);
if (etq->q.desc) { if (etq->q.desc) {
t4_eth_eq_free(adap, adap->fn, adap->fn, 0, t4_eth_eq_free(adap, adap->mbox, adap->pf, 0,
etq->q.cntxt_id); etq->q.cntxt_id);
free_tx_desc(adap, &etq->q, etq->q.in_use, true); free_tx_desc(adap, &etq->q, etq->q.in_use, true);
kfree(etq->q.sdesc); kfree(etq->q.sdesc);
...@@ -2839,7 +2844,7 @@ void t4_free_sge_resources(struct adapter *adap) ...@@ -2839,7 +2844,7 @@ void t4_free_sge_resources(struct adapter *adap)
if (q->q.desc) { if (q->q.desc) {
tasklet_kill(&q->qresume_tsk); tasklet_kill(&q->qresume_tsk);
t4_ofld_eq_free(adap, adap->fn, adap->fn, 0, t4_ofld_eq_free(adap, adap->mbox, adap->pf, 0,
q->q.cntxt_id); q->q.cntxt_id);
free_tx_desc(adap, &q->q, q->q.in_use, false); free_tx_desc(adap, &q->q, q->q.in_use, false);
kfree(q->q.sdesc); kfree(q->q.sdesc);
...@@ -2854,7 +2859,7 @@ void t4_free_sge_resources(struct adapter *adap) ...@@ -2854,7 +2859,7 @@ void t4_free_sge_resources(struct adapter *adap)
if (cq->q.desc) { if (cq->q.desc) {
tasklet_kill(&cq->qresume_tsk); tasklet_kill(&cq->qresume_tsk);
t4_ctrl_eq_free(adap, adap->fn, adap->fn, 0, t4_ctrl_eq_free(adap, adap->mbox, adap->pf, 0,
cq->q.cntxt_id); cq->q.cntxt_id);
__skb_queue_purge(&cq->sendq); __skb_queue_purge(&cq->sendq);
free_txq(adap, &cq->q); free_txq(adap, &cq->q);
......
...@@ -150,7 +150,7 @@ void t4_write_indirect(struct adapter *adap, unsigned int addr_reg, ...@@ -150,7 +150,7 @@ void t4_write_indirect(struct adapter *adap, unsigned int addr_reg,
*/ */
void t4_hw_pci_read_cfg4(struct adapter *adap, int reg, u32 *val) void t4_hw_pci_read_cfg4(struct adapter *adap, int reg, u32 *val)
{ {
u32 req = ENABLE_F | FUNCTION_V(adap->fn) | REGISTER_V(reg); u32 req = ENABLE_F | FUNCTION_V(adap->pf) | REGISTER_V(reg);
if (is_t4(adap->params.chip)) if (is_t4(adap->params.chip))
req |= LOCALCFG_F; req |= LOCALCFG_F;
...@@ -412,7 +412,7 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, ...@@ -412,7 +412,7 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr,
mem_base = PCIEOFST_G(mem_reg) << PCIEOFST_SHIFT_X; mem_base = PCIEOFST_G(mem_reg) << PCIEOFST_SHIFT_X;
if (is_t4(adap->params.chip)) if (is_t4(adap->params.chip))
mem_base -= adap->t4_bar0; mem_base -= adap->t4_bar0;
win_pf = is_t4(adap->params.chip) ? 0 : PFNUM_V(adap->fn); win_pf = is_t4(adap->params.chip) ? 0 : PFNUM_V(adap->pf);
/* Calculate our initial PCI-E Memory Window Position and Offset into /* Calculate our initial PCI-E Memory Window Position and Offset into
* that Window. * that Window.
...@@ -547,7 +547,7 @@ u32 t4_read_pcie_cfg4(struct adapter *adap, int reg) ...@@ -547,7 +547,7 @@ u32 t4_read_pcie_cfg4(struct adapter *adap, int reg)
ldst_cmd.cycles_to_len16 = cpu_to_be32(FW_LEN16(ldst_cmd)); ldst_cmd.cycles_to_len16 = cpu_to_be32(FW_LEN16(ldst_cmd));
ldst_cmd.u.pcie.select_naccess = FW_LDST_CMD_NACCESS_V(1); ldst_cmd.u.pcie.select_naccess = FW_LDST_CMD_NACCESS_V(1);
ldst_cmd.u.pcie.ctrl_to_fn = ldst_cmd.u.pcie.ctrl_to_fn =
(FW_LDST_CMD_LC_F | FW_LDST_CMD_FN_V(adap->fn)); (FW_LDST_CMD_LC_F | FW_LDST_CMD_FN_V(adap->pf));
ldst_cmd.u.pcie.r = reg; ldst_cmd.u.pcie.r = reg;
/* If the LDST Command succeeds, return the result, otherwise /* If the LDST Command succeeds, return the result, otherwise
...@@ -2062,7 +2062,7 @@ int t4_phy_fw_ver(struct adapter *adap, int *phy_fw_ver) ...@@ -2062,7 +2062,7 @@ int t4_phy_fw_ver(struct adapter *adap, int *phy_fw_ver)
FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_PHYFW) | FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_PHYFW) |
FW_PARAMS_PARAM_Y_V(adap->params.portvec) | FW_PARAMS_PARAM_Y_V(adap->params.portvec) |
FW_PARAMS_PARAM_Z_V(FW_PARAMS_PARAM_DEV_PHYFW_VERSION)); FW_PARAMS_PARAM_Z_V(FW_PARAMS_PARAM_DEV_PHYFW_VERSION));
ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 1, ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1,
&param, &val); &param, &val);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -2134,7 +2134,7 @@ int t4_load_phy_fw(struct adapter *adap, ...@@ -2134,7 +2134,7 @@ int t4_load_phy_fw(struct adapter *adap,
FW_PARAMS_PARAM_Y_V(adap->params.portvec) | FW_PARAMS_PARAM_Y_V(adap->params.portvec) |
FW_PARAMS_PARAM_Z_V(FW_PARAMS_PARAM_DEV_PHYFW_DOWNLOAD)); FW_PARAMS_PARAM_Z_V(FW_PARAMS_PARAM_DEV_PHYFW_DOWNLOAD));
val = phy_fw_size; val = phy_fw_size;
ret = t4_query_params_rw(adap, adap->mbox, adap->fn, 0, 1, ret = t4_query_params_rw(adap, adap->mbox, adap->pf, 0, 1,
&param, &val, 1); &param, &val, 1);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -2163,7 +2163,7 @@ int t4_load_phy_fw(struct adapter *adap, ...@@ -2163,7 +2163,7 @@ int t4_load_phy_fw(struct adapter *adap,
FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_PHYFW) | FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_PHYFW) |
FW_PARAMS_PARAM_Y_V(adap->params.portvec) | FW_PARAMS_PARAM_Y_V(adap->params.portvec) |
FW_PARAMS_PARAM_Z_V(FW_PARAMS_PARAM_DEV_PHYFW_DOWNLOAD)); FW_PARAMS_PARAM_Z_V(FW_PARAMS_PARAM_DEV_PHYFW_DOWNLOAD));
ret = t4_set_params_timeout(adap, adap->mbox, adap->fn, 0, 1, ret = t4_set_params_timeout(adap, adap->mbox, adap->pf, 0, 1,
&param, &val, 30000); &param, &val, 30000);
/* If we have version number support, then check to see that the new /* If we have version number support, then check to see that the new
...@@ -2199,7 +2199,7 @@ int t4_fwcache(struct adapter *adap, enum fw_params_param_dev_fwcache op) ...@@ -2199,7 +2199,7 @@ int t4_fwcache(struct adapter *adap, enum fw_params_param_dev_fwcache op)
c.op_to_vfn = c.op_to_vfn =
cpu_to_be32(FW_CMD_OP_V(FW_PARAMS_CMD) | cpu_to_be32(FW_CMD_OP_V(FW_PARAMS_CMD) |
FW_CMD_REQUEST_F | FW_CMD_WRITE_F | FW_CMD_REQUEST_F | FW_CMD_WRITE_F |
FW_PARAMS_CMD_PFN_V(adap->fn) | FW_PARAMS_CMD_PFN_V(adap->pf) |
FW_PARAMS_CMD_VFN_V(0)); FW_PARAMS_CMD_VFN_V(0));
c.retval_len16 = cpu_to_be32(FW_LEN16(c)); c.retval_len16 = cpu_to_be32(FW_LEN16(c));
c.param[0].mnem = c.param[0].mnem =
...@@ -5299,7 +5299,7 @@ int t4_prep_adapter(struct adapter *adapter) ...@@ -5299,7 +5299,7 @@ int t4_prep_adapter(struct adapter *adapter)
} }
/** /**
* cxgb4_t4_bar2_sge_qregs - return BAR2 SGE Queue register information * t4_bar2_sge_qregs - return BAR2 SGE Queue register information
* @adapter: the adapter * @adapter: the adapter
* @qid: the Queue ID * @qid: the Queue ID
* @qtype: the Ingress or Egress type for @qid * @qtype: the Ingress or Egress type for @qid
...@@ -5323,7 +5323,7 @@ int t4_prep_adapter(struct adapter *adapter) ...@@ -5323,7 +5323,7 @@ int t4_prep_adapter(struct adapter *adapter)
* Write Combining Doorbell Buffer. If the BAR2 Queue ID is not 0, * Write Combining Doorbell Buffer. If the BAR2 Queue ID is not 0,
* then these "Inferred Queue ID" register may not be used. * then these "Inferred Queue ID" register may not be used.
*/ */
int cxgb4_t4_bar2_sge_qregs(struct adapter *adapter, int t4_bar2_sge_qregs(struct adapter *adapter,
unsigned int qid, unsigned int qid,
enum t4_bar2_qtype qtype, enum t4_bar2_qtype qtype,
u64 *pbar2_qoffset, u64 *pbar2_qoffset,
...@@ -5457,13 +5457,13 @@ int t4_init_sge_params(struct adapter *adapter) ...@@ -5457,13 +5457,13 @@ int t4_init_sge_params(struct adapter *adapter)
*/ */
hps = t4_read_reg(adapter, SGE_HOST_PAGE_SIZE_A); hps = t4_read_reg(adapter, SGE_HOST_PAGE_SIZE_A);
s_hps = (HOSTPAGESIZEPF0_S + s_hps = (HOSTPAGESIZEPF0_S +
(HOSTPAGESIZEPF1_S - HOSTPAGESIZEPF0_S) * adapter->fn); (HOSTPAGESIZEPF1_S - HOSTPAGESIZEPF0_S) * adapter->pf);
sge_params->hps = ((hps >> s_hps) & HOSTPAGESIZEPF0_M); sge_params->hps = ((hps >> s_hps) & HOSTPAGESIZEPF0_M);
/* Extract the SGE Egress and Ingess Queues Per Page for our PF. /* Extract the SGE Egress and Ingess Queues Per Page for our PF.
*/ */
s_qpp = (QUEUESPERPAGEPF0_S + s_qpp = (QUEUESPERPAGEPF0_S +
(QUEUESPERPAGEPF1_S - QUEUESPERPAGEPF0_S) * adapter->fn); (QUEUESPERPAGEPF1_S - QUEUESPERPAGEPF0_S) * adapter->pf);
qpp = t4_read_reg(adapter, SGE_EGRESS_QUEUES_PER_PAGE_PF_A); qpp = t4_read_reg(adapter, SGE_EGRESS_QUEUES_PER_PAGE_PF_A);
sge_params->eq_qpp = ((qpp >> s_qpp) & QUEUESPERPAGEPF0_M); sge_params->eq_qpp = ((qpp >> s_qpp) & QUEUESPERPAGEPF0_M);
qpp = t4_read_reg(adapter, SGE_INGRESS_QUEUES_PER_PAGE_PF_A); qpp = t4_read_reg(adapter, SGE_INGRESS_QUEUES_PER_PAGE_PF_A);
......
...@@ -2162,8 +2162,8 @@ static void __iomem *bar2_address(struct adapter *adapter, ...@@ -2162,8 +2162,8 @@ static void __iomem *bar2_address(struct adapter *adapter,
u64 bar2_qoffset; u64 bar2_qoffset;
int ret; int ret;
ret = t4_bar2_sge_qregs(adapter, qid, qtype, ret = t4vf_bar2_sge_qregs(adapter, qid, qtype,
&bar2_qoffset, pbar2_qid); &bar2_qoffset, pbar2_qid);
if (ret) if (ret)
return NULL; return NULL;
......
...@@ -284,11 +284,11 @@ int t4vf_fw_reset(struct adapter *); ...@@ -284,11 +284,11 @@ int t4vf_fw_reset(struct adapter *);
int t4vf_set_params(struct adapter *, unsigned int, const u32 *, const u32 *); int t4vf_set_params(struct adapter *, unsigned int, const u32 *, const u32 *);
enum t4_bar2_qtype { T4_BAR2_QTYPE_EGRESS, T4_BAR2_QTYPE_INGRESS }; enum t4_bar2_qtype { T4_BAR2_QTYPE_EGRESS, T4_BAR2_QTYPE_INGRESS };
int t4_bar2_sge_qregs(struct adapter *adapter, int t4vf_bar2_sge_qregs(struct adapter *adapter,
unsigned int qid, unsigned int qid,
enum t4_bar2_qtype qtype, enum t4_bar2_qtype qtype,
u64 *pbar2_qoffset, u64 *pbar2_qoffset,
unsigned int *pbar2_qid); unsigned int *pbar2_qid);
int t4vf_get_sge_params(struct adapter *); int t4vf_get_sge_params(struct adapter *);
int t4vf_get_vpd_params(struct adapter *); int t4vf_get_vpd_params(struct adapter *);
......
...@@ -428,7 +428,7 @@ int t4vf_set_params(struct adapter *adapter, unsigned int nparams, ...@@ -428,7 +428,7 @@ int t4vf_set_params(struct adapter *adapter, unsigned int nparams,
} }
/** /**
* t4_bar2_sge_qregs - return BAR2 SGE Queue register information * t4vf_bar2_sge_qregs - return BAR2 SGE Queue register information
* @adapter: the adapter * @adapter: the adapter
* @qid: the Queue ID * @qid: the Queue ID
* @qtype: the Ingress or Egress type for @qid * @qtype: the Ingress or Egress type for @qid
...@@ -452,11 +452,11 @@ int t4vf_set_params(struct adapter *adapter, unsigned int nparams, ...@@ -452,11 +452,11 @@ int t4vf_set_params(struct adapter *adapter, unsigned int nparams,
* Write Combining Doorbell Buffer. If the BAR2 Queue ID is not 0, * Write Combining Doorbell Buffer. If the BAR2 Queue ID is not 0,
* then these "Inferred Queue ID" register may not be used. * then these "Inferred Queue ID" register may not be used.
*/ */
int t4_bar2_sge_qregs(struct adapter *adapter, int t4vf_bar2_sge_qregs(struct adapter *adapter,
unsigned int qid, unsigned int qid,
enum t4_bar2_qtype qtype, enum t4_bar2_qtype qtype,
u64 *pbar2_qoffset, u64 *pbar2_qoffset,
unsigned int *pbar2_qid) unsigned int *pbar2_qid)
{ {
unsigned int page_shift, page_size, qpp_shift, qpp_mask; unsigned int page_shift, page_size, qpp_shift, qpp_mask;
u64 bar2_page_offset, bar2_qoffset; u64 bar2_page_offset, bar2_qoffset;
......
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