Commit 060e0c75 authored by Dimitris Michailidis's avatar Dimitris Michailidis Committed by David S. Miller

cxgb4: support running the driver on PCI functions besides 0

Add support for running the driver on any PCI function.  Mostly this
entails replacing a constant 0 in a number of calls with the variable
function number.
Signed-off-by: default avatarDimitris Michailidis <dm@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 35d35682
...@@ -482,7 +482,8 @@ struct adapter { ...@@ -482,7 +482,8 @@ struct adapter {
struct pci_dev *pdev; struct pci_dev *pdev;
struct device *pdev_dev; struct device *pdev_dev;
unsigned long registered_device_map; unsigned long registered_device_map;
unsigned long flags; unsigned int fn;
unsigned int flags;
const char *name; const char *name;
int msg_enable; int msg_enable;
......
This diff is collapsed.
...@@ -1999,7 +1999,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, ...@@ -1999,7 +1999,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(FW_IQ_CMD) | FW_CMD_REQUEST | c.op_to_vfn = htonl(FW_CMD_OP(FW_IQ_CMD) | FW_CMD_REQUEST |
FW_CMD_WRITE | FW_CMD_EXEC | FW_CMD_WRITE | FW_CMD_EXEC |
FW_IQ_CMD_PFN(0) | FW_IQ_CMD_VFN(0)); FW_IQ_CMD_PFN(adap->fn) | FW_IQ_CMD_VFN(0));
c.alloc_to_len16 = htonl(FW_IQ_CMD_ALLOC | FW_IQ_CMD_IQSTART(1) | c.alloc_to_len16 = htonl(FW_IQ_CMD_ALLOC | FW_IQ_CMD_IQSTART(1) |
FW_LEN16(c)); FW_LEN16(c));
c.type_to_iqandstindex = htonl(FW_IQ_CMD_TYPE(FW_IQ_TYPE_FL_INT_CAP) | c.type_to_iqandstindex = htonl(FW_IQ_CMD_TYPE(FW_IQ_TYPE_FL_INT_CAP) |
...@@ -2031,7 +2031,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, ...@@ -2031,7 +2031,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, 0, &c, sizeof(c), &c); ret = t4_wr_mbox(adap, adap->fn, &c, sizeof(c), &c);
if (ret) if (ret)
goto err; goto err;
...@@ -2110,7 +2110,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, ...@@ -2110,7 +2110,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(FW_EQ_ETH_CMD) | FW_CMD_REQUEST | c.op_to_vfn = htonl(FW_CMD_OP(FW_EQ_ETH_CMD) | FW_CMD_REQUEST |
FW_CMD_WRITE | FW_CMD_EXEC | FW_CMD_WRITE | FW_CMD_EXEC |
FW_EQ_ETH_CMD_PFN(0) | FW_EQ_ETH_CMD_VFN(0)); FW_EQ_ETH_CMD_PFN(adap->fn) | FW_EQ_ETH_CMD_VFN(0));
c.alloc_to_len16 = htonl(FW_EQ_ETH_CMD_ALLOC | c.alloc_to_len16 = htonl(FW_EQ_ETH_CMD_ALLOC |
FW_EQ_ETH_CMD_EQSTART | FW_LEN16(c)); FW_EQ_ETH_CMD_EQSTART | FW_LEN16(c));
c.viid_pkd = htonl(FW_EQ_ETH_CMD_VIID(pi->viid)); c.viid_pkd = htonl(FW_EQ_ETH_CMD_VIID(pi->viid));
...@@ -2123,7 +2123,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, ...@@ -2123,7 +2123,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
FW_EQ_ETH_CMD_EQSIZE(nentries)); FW_EQ_ETH_CMD_EQSIZE(nentries));
c.eqaddr = cpu_to_be64(txq->q.phys_addr); c.eqaddr = cpu_to_be64(txq->q.phys_addr);
ret = t4_wr_mbox(adap, 0, &c, sizeof(c), &c); ret = t4_wr_mbox(adap, adap->fn, &c, sizeof(c), &c);
if (ret) { if (ret) {
kfree(txq->q.sdesc); kfree(txq->q.sdesc);
txq->q.sdesc = NULL; txq->q.sdesc = NULL;
...@@ -2160,7 +2160,8 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq, ...@@ -2160,7 +2160,8 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq,
c.op_to_vfn = htonl(FW_CMD_OP(FW_EQ_CTRL_CMD) | FW_CMD_REQUEST | c.op_to_vfn = htonl(FW_CMD_OP(FW_EQ_CTRL_CMD) | FW_CMD_REQUEST |
FW_CMD_WRITE | FW_CMD_EXEC | FW_CMD_WRITE | FW_CMD_EXEC |
FW_EQ_CTRL_CMD_PFN(0) | FW_EQ_CTRL_CMD_VFN(0)); FW_EQ_CTRL_CMD_PFN(adap->fn) |
FW_EQ_CTRL_CMD_VFN(0));
c.alloc_to_len16 = htonl(FW_EQ_CTRL_CMD_ALLOC | c.alloc_to_len16 = htonl(FW_EQ_CTRL_CMD_ALLOC |
FW_EQ_CTRL_CMD_EQSTART | FW_LEN16(c)); FW_EQ_CTRL_CMD_EQSTART | FW_LEN16(c));
c.cmpliqid_eqid = htonl(FW_EQ_CTRL_CMD_CMPLIQID(cmplqid)); c.cmpliqid_eqid = htonl(FW_EQ_CTRL_CMD_CMPLIQID(cmplqid));
...@@ -2174,7 +2175,7 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq, ...@@ -2174,7 +2175,7 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq,
FW_EQ_CTRL_CMD_EQSIZE(nentries)); FW_EQ_CTRL_CMD_EQSIZE(nentries));
c.eqaddr = cpu_to_be64(txq->q.phys_addr); c.eqaddr = cpu_to_be64(txq->q.phys_addr);
ret = t4_wr_mbox(adap, 0, &c, sizeof(c), &c); ret = t4_wr_mbox(adap, adap->fn, &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),
...@@ -2210,7 +2211,8 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq, ...@@ -2210,7 +2211,8 @@ 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(FW_EQ_OFLD_CMD) | FW_CMD_REQUEST | c.op_to_vfn = htonl(FW_CMD_OP(FW_EQ_OFLD_CMD) | FW_CMD_REQUEST |
FW_CMD_WRITE | FW_CMD_EXEC | FW_CMD_WRITE | FW_CMD_EXEC |
FW_EQ_OFLD_CMD_PFN(0) | FW_EQ_OFLD_CMD_VFN(0)); FW_EQ_OFLD_CMD_PFN(adap->fn) |
FW_EQ_OFLD_CMD_VFN(0));
c.alloc_to_len16 = htonl(FW_EQ_OFLD_CMD_ALLOC | c.alloc_to_len16 = htonl(FW_EQ_OFLD_CMD_ALLOC |
FW_EQ_OFLD_CMD_EQSTART | FW_LEN16(c)); FW_EQ_OFLD_CMD_EQSTART | FW_LEN16(c));
c.fetchszm_to_iqid = htonl(FW_EQ_OFLD_CMD_HOSTFCMODE(2) | c.fetchszm_to_iqid = htonl(FW_EQ_OFLD_CMD_HOSTFCMODE(2) |
...@@ -2222,7 +2224,7 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq, ...@@ -2222,7 +2224,7 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq,
FW_EQ_OFLD_CMD_EQSIZE(nentries)); FW_EQ_OFLD_CMD_EQSIZE(nentries));
c.eqaddr = cpu_to_be64(txq->q.phys_addr); c.eqaddr = cpu_to_be64(txq->q.phys_addr);
ret = t4_wr_mbox(adap, 0, &c, sizeof(c), &c); ret = t4_wr_mbox(adap, adap->fn, &c, sizeof(c), &c);
if (ret) { if (ret) {
kfree(txq->q.sdesc); kfree(txq->q.sdesc);
txq->q.sdesc = NULL; txq->q.sdesc = NULL;
...@@ -2258,8 +2260,8 @@ static void free_rspq_fl(struct adapter *adap, struct sge_rspq *rq, ...@@ -2258,8 +2260,8 @@ 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] = NULL; adap->sge.ingr_map[rq->cntxt_id] = NULL;
t4_iq_free(adap, 0, 0, 0, FW_IQ_TYPE_FL_INT_CAP, rq->cntxt_id, fl_id, t4_iq_free(adap, adap->fn, adap->fn, 0, FW_IQ_TYPE_FL_INT_CAP,
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);
netif_napi_del(&rq->napi); netif_napi_del(&rq->napi);
...@@ -2296,7 +2298,8 @@ void t4_free_sge_resources(struct adapter *adap) ...@@ -2296,7 +2298,8 @@ void t4_free_sge_resources(struct adapter *adap)
if (eq->rspq.desc) if (eq->rspq.desc)
free_rspq_fl(adap, &eq->rspq, &eq->fl); free_rspq_fl(adap, &eq->rspq, &eq->fl);
if (etq->q.desc) { if (etq->q.desc) {
t4_eth_eq_free(adap, 0, 0, 0, etq->q.cntxt_id); t4_eth_eq_free(adap, adap->fn, adap->fn, 0,
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);
free_txq(adap, &etq->q); free_txq(adap, &etq->q);
...@@ -2319,7 +2322,8 @@ void t4_free_sge_resources(struct adapter *adap) ...@@ -2319,7 +2322,8 @@ 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, 0, 0, 0, q->q.cntxt_id); t4_ofld_eq_free(adap, adap->fn, adap->fn, 0,
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);
__skb_queue_purge(&q->sendq); __skb_queue_purge(&q->sendq);
...@@ -2333,7 +2337,8 @@ void t4_free_sge_resources(struct adapter *adap) ...@@ -2333,7 +2337,8 @@ 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, 0, 0, 0, cq->q.cntxt_id); t4_ctrl_eq_free(adap, adap->fn, adap->fn, 0,
cq->q.cntxt_id);
__skb_queue_purge(&cq->sendq); __skb_queue_purge(&cq->sendq);
free_txq(adap, &cq->q); free_txq(adap, &cq->q);
} }
...@@ -2401,6 +2406,7 @@ void t4_sge_stop(struct adapter *adap) ...@@ -2401,6 +2406,7 @@ void t4_sge_stop(struct adapter *adap)
*/ */
void t4_sge_init(struct adapter *adap) void t4_sge_init(struct adapter *adap)
{ {
unsigned int i, v;
struct sge *s = &adap->sge; struct sge *s = &adap->sge;
unsigned int fl_align_log = ilog2(FL_ALIGN); unsigned int fl_align_log = ilog2(FL_ALIGN);
...@@ -2409,8 +2415,10 @@ void t4_sge_init(struct adapter *adap) ...@@ -2409,8 +2415,10 @@ void t4_sge_init(struct adapter *adap)
INGPADBOUNDARY(fl_align_log - 5) | PKTSHIFT(2) | INGPADBOUNDARY(fl_align_log - 5) | PKTSHIFT(2) |
RXPKTCPLMODE | RXPKTCPLMODE |
(STAT_LEN == 128 ? EGRSTATUSPAGESIZE : 0)); (STAT_LEN == 128 ? EGRSTATUSPAGESIZE : 0));
t4_set_reg_field(adap, SGE_HOST_PAGE_SIZE, HOSTPAGESIZEPF0_MASK,
HOSTPAGESIZEPF0(PAGE_SHIFT - 10)); for (i = v = 0; i < 32; i += 4)
v |= (PAGE_SHIFT - 10) << i;
t4_write_reg(adap, SGE_HOST_PAGE_SIZE, v);
t4_write_reg(adap, SGE_FL_BUFFER_SIZE0, PAGE_SIZE); t4_write_reg(adap, SGE_FL_BUFFER_SIZE0, PAGE_SIZE);
#if FL_PG_ORDER > 0 #if FL_PG_ORDER > 0
t4_write_reg(adap, SGE_FL_BUFFER_SIZE1, PAGE_SIZE << FL_PG_ORDER); t4_write_reg(adap, SGE_FL_BUFFER_SIZE1, PAGE_SIZE << FL_PG_ORDER);
......
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