aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb4/cxgb4_main.c
diff options
context:
space:
mode:
authorDimitris Michailidis <dm@chelsio.com>2010-08-23 13:20:58 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-23 23:38:13 -0400
commite46dab4d4be87769b09404135bc34f89e2e155d8 (patch)
tree65f0b0a321939c4b12d40e7674ce93c699c2843e /drivers/net/cxgb4/cxgb4_main.c
parentf04b4dd2b1f533cef0507e0410ffc6732d21a272 (diff)
cxgb4: handle Rx/Tx queue ranges not starting at 0
Currently the driver assumes that queue IDs start at 0 but that's true only for function 0. To support operation on other functions get the start of the queue ranges from FW and offset accordingly. Signed-off-by: Dimitris Michailidis <dm@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb4/cxgb4_main.c')
-rw-r--r--drivers/net/cxgb4/cxgb4_main.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index c327527fbbc8..6e08e2d8eb3e 100644
--- a/drivers/net/cxgb4/cxgb4_main.c
+++ b/drivers/net/cxgb4/cxgb4_main.c
@@ -423,10 +423,11 @@ static int fwevtq_handler(struct sge_rspq *q, const __be64 *rsp,
423 if (likely(opcode == CPL_SGE_EGR_UPDATE)) { 423 if (likely(opcode == CPL_SGE_EGR_UPDATE)) {
424 const struct cpl_sge_egr_update *p = (void *)rsp; 424 const struct cpl_sge_egr_update *p = (void *)rsp;
425 unsigned int qid = EGR_QID(ntohl(p->opcode_qid)); 425 unsigned int qid = EGR_QID(ntohl(p->opcode_qid));
426 struct sge_txq *txq = q->adap->sge.egr_map[qid]; 426 struct sge_txq *txq;
427 427
428 txq = q->adap->sge.egr_map[qid - q->adap->sge.egr_start];
428 txq->restarts++; 429 txq->restarts++;
429 if ((u8 *)txq < (u8 *)q->adap->sge.ethrxq) { 430 if ((u8 *)txq < (u8 *)q->adap->sge.ofldtxq) {
430 struct sge_eth_txq *eq; 431 struct sge_eth_txq *eq;
431 432
432 eq = container_of(txq, struct sge_eth_txq, q); 433 eq = container_of(txq, struct sge_eth_txq, q);
@@ -658,6 +659,15 @@ static int setup_rss(struct adapter *adap)
658} 659}
659 660
660/* 661/*
662 * Return the channel of the ingress queue with the given qid.
663 */
664static unsigned int rxq_to_chan(const struct sge *p, unsigned int qid)
665{
666 qid -= p->ingr_start;
667 return netdev2pinfo(p->ingr_map[qid]->netdev)->tx_chan;
668}
669
670/*
661 * Wait until all NAPI handlers are descheduled. 671 * Wait until all NAPI handlers are descheduled.
662 */ 672 */
663static void quiesce_rx(struct adapter *adap) 673static void quiesce_rx(struct adapter *adap)
@@ -2304,7 +2314,7 @@ int cxgb4_create_server(const struct net_device *dev, unsigned int stid,
2304 req->peer_port = htons(0); 2314 req->peer_port = htons(0);
2305 req->local_ip = sip; 2315 req->local_ip = sip;
2306 req->peer_ip = htonl(0); 2316 req->peer_ip = htonl(0);
2307 chan = netdev2pinfo(adap->sge.ingr_map[queue]->netdev)->tx_chan; 2317 chan = rxq_to_chan(&adap->sge, queue);
2308 req->opt0 = cpu_to_be64(TX_CHAN(chan)); 2318 req->opt0 = cpu_to_be64(TX_CHAN(chan));
2309 req->opt1 = cpu_to_be64(CONN_POLICY_ASK | 2319 req->opt1 = cpu_to_be64(CONN_POLICY_ASK |
2310 SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue)); 2320 SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue));
@@ -2346,7 +2356,7 @@ int cxgb4_create_server6(const struct net_device *dev, unsigned int stid,
2346 req->local_ip_lo = *(__be64 *)(sip->s6_addr + 8); 2356 req->local_ip_lo = *(__be64 *)(sip->s6_addr + 8);
2347 req->peer_ip_hi = cpu_to_be64(0); 2357 req->peer_ip_hi = cpu_to_be64(0);
2348 req->peer_ip_lo = cpu_to_be64(0); 2358 req->peer_ip_lo = cpu_to_be64(0);
2349 chan = netdev2pinfo(adap->sge.ingr_map[queue]->netdev)->tx_chan; 2359 chan = rxq_to_chan(&adap->sge, queue);
2350 req->opt0 = cpu_to_be64(TX_CHAN(chan)); 2360 req->opt0 = cpu_to_be64(TX_CHAN(chan));
2351 req->opt1 = cpu_to_be64(CONN_POLICY_ASK | 2361 req->opt1 = cpu_to_be64(CONN_POLICY_ASK |
2352 SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue)); 2362 SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue));
@@ -3061,12 +3071,16 @@ static int adap_init0(struct adapter *adap)
3061 params[2] = FW_PARAM_PFVF(L2T_END); 3071 params[2] = FW_PARAM_PFVF(L2T_END);
3062 params[3] = FW_PARAM_PFVF(FILTER_START); 3072 params[3] = FW_PARAM_PFVF(FILTER_START);
3063 params[4] = FW_PARAM_PFVF(FILTER_END); 3073 params[4] = FW_PARAM_PFVF(FILTER_END);
3064 ret = t4_query_params(adap, adap->fn, adap->fn, 0, 5, params, val); 3074 params[5] = FW_PARAM_PFVF(IQFLINT_START);
3075 params[6] = FW_PARAM_PFVF(EQ_START);
3076 ret = t4_query_params(adap, adap->fn, adap->fn, 0, 7, params, val);
3065 if (ret < 0) 3077 if (ret < 0)
3066 goto bye; 3078 goto bye;
3067 port_vec = val[0]; 3079 port_vec = val[0];
3068 adap->tids.ftid_base = val[3]; 3080 adap->tids.ftid_base = val[3];
3069 adap->tids.nftids = val[4] - val[3] + 1; 3081 adap->tids.nftids = val[4] - val[3] + 1;
3082 adap->sge.ingr_start = val[5];
3083 adap->sge.egr_start = val[6];
3070 3084
3071 if (c.ofldcaps) { 3085 if (c.ofldcaps) {
3072 /* query offload-related parameters */ 3086 /* query offload-related parameters */