Skip to content

Commit d429005

Browse files
vishalsdkdavem330
authored andcommitted
cxgb4/cxgb4vf: Add support for SGE doorbell queue timer
T6 introduced a Timer Mechanism in SGE called the SGE Doorbell Queue Timer. With this we can now configure TX Queues to get CIDX Updates when: Time(CIDX == PIDX) >= Timer Previously we rely on TX Queue Status Page updates by hardware for DMA completions. This will make Hardware/Firmware actually deliver the CIDX Updates as Ingress Queue messages with commensurate Interrupts. So we now have a new RX Path component for processing CIDX Updates and reclaiming TX Descriptors faster. Original work by: Casey Leedom <[email protected]> Signed-off-by: Vishal Kulkarni <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f694be2 commit d429005

File tree

8 files changed

+375
-75
lines changed

8 files changed

+375
-75
lines changed

drivers/net/ethernet/chelsio/cxgb4/cxgb4.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ enum { /* adapter flags */
617617
FW_OFLD_CONN = (1 << 9),
618618
ROOT_NO_RELAXED_ORDERING = (1 << 10),
619619
SHUTTING_DOWN = (1 << 11),
620+
SGE_DBQ_TIMER = (1 << 12),
620621
};
621622

622623
enum {
@@ -756,6 +757,8 @@ struct sge_eth_txq { /* state for an SGE Ethernet Tx queue */
756757
#ifdef CONFIG_CHELSIO_T4_DCB
757758
u8 dcb_prio; /* DCB Priority bound to queue */
758759
#endif
760+
u8 dbqt; /* SGE Doorbell Queue Timer in use */
761+
unsigned int dbqtimerix; /* SGE Doorbell Queue Timer Index */
759762
unsigned long tso; /* # of TSO requests */
760763
unsigned long tx_cso; /* # of Tx checksum offloads */
761764
unsigned long vlan_ins; /* # of Tx VLAN insertions */
@@ -816,6 +819,7 @@ struct sge {
816819
u16 nqs_per_uld; /* # of Rx queues per ULD */
817820
u16 timer_val[SGE_NTIMERS];
818821
u8 counter_val[SGE_NCOUNTERS];
822+
u16 dbqtimer_val[SGE_NDBQTIMERS];
819823
u32 fl_pg_order; /* large page allocation size */
820824
u32 stat_len; /* length of status page at ring end */
821825
u32 pktshift; /* padding between CPL & packet data */
@@ -1402,7 +1406,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
14021406
rspq_flush_handler_t flush_handler, int cong);
14031407
int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
14041408
struct net_device *dev, struct netdev_queue *netdevq,
1405-
unsigned int iqid);
1409+
unsigned int iqid, u8 dbqt);
14061410
int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq,
14071411
struct net_device *dev, unsigned int iqid,
14081412
unsigned int cmplqid);
@@ -1415,6 +1419,8 @@ irqreturn_t t4_sge_intr_msix(int irq, void *cookie);
14151419
int t4_sge_init(struct adapter *adap);
14161420
void t4_sge_start(struct adapter *adap);
14171421
void t4_sge_stop(struct adapter *adap);
1422+
int t4_sge_eth_txq_egress_update(struct adapter *adap, struct sge_eth_txq *q,
1423+
int maxreclaim);
14181424
void cxgb4_set_ethtool_ops(struct net_device *netdev);
14191425
int cxgb4_write_rss(const struct port_info *pi, const u16 *queues);
14201426
enum cpl_tx_tnl_lso_type cxgb_encap_offload_supported(struct sk_buff *skb);
@@ -1821,6 +1827,8 @@ int t4_ctrl_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
18211827
int t4_ofld_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
18221828
unsigned int vf, unsigned int eqid);
18231829
int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox, int ctxt_type);
1830+
int t4_read_sge_dbqtimers(struct adapter *adap, unsigned int ndbqtimers,
1831+
u16 *dbqtimers);
18241832
void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl);
18251833
int t4_update_port_info(struct port_info *pi);
18261834
int t4_get_link_params(struct port_info *pi, unsigned int *link_okp,

drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ static int fwevtq_handler(struct sge_rspq *q, const __be64 *rsp,
575575
struct sge_eth_txq *eq;
576576

577577
eq = container_of(txq, struct sge_eth_txq, q);
578-
netif_tx_wake_queue(eq->txq);
578+
t4_sge_eth_txq_egress_update(q->adap, eq, -1);
579579
} else {
580580
struct sge_uld_txq *oq;
581581

@@ -933,10 +933,13 @@ static int setup_sge_queues(struct adapter *adap)
933933
q->rspq.idx = j;
934934
memset(&q->stats, 0, sizeof(q->stats));
935935
}
936-
for (j = 0; j < pi->nqsets; j++, t++) {
936+
937+
q = &s->ethrxq[pi->first_qset];
938+
for (j = 0; j < pi->nqsets; j++, t++, q++) {
937939
err = t4_sge_alloc_eth_txq(adap, t, dev,
938940
netdev_get_tx_queue(dev, j),
939-
s->fw_evtq.cntxt_id);
941+
q->rspq.cntxt_id,
942+
!!(adap->flags & SGE_DBQ_TIMER));
940943
if (err)
941944
goto freeout;
942945
}
@@ -958,7 +961,7 @@ static int setup_sge_queues(struct adapter *adap)
958961
if (!is_t4(adap->params.chip)) {
959962
err = t4_sge_alloc_eth_txq(adap, &s->ptptxq, adap->port[0],
960963
netdev_get_tx_queue(adap->port[0], 0)
961-
, s->fw_evtq.cntxt_id);
964+
, s->fw_evtq.cntxt_id, false);
962965
if (err)
963966
goto freeout;
964967
}
@@ -4325,6 +4328,14 @@ static int adap_init0(struct adapter *adap)
43254328
if (ret < 0)
43264329
goto bye;
43274330

4331+
/* Grab the SGE Doorbell Queue Timer values. If successful, that
4332+
* indicates that the Firmware and Hardware support this.
4333+
*/
4334+
ret = t4_read_sge_dbqtimers(adap, ARRAY_SIZE(adap->sge.dbqtimer_val),
4335+
adap->sge.dbqtimer_val);
4336+
if (!ret)
4337+
adap->flags |= SGE_DBQ_TIMER;
4338+
43284339
if (is_bypass_device(adap->pdev->device))
43294340
adap->params.bypass = 1;
43304341

0 commit comments

Comments
 (0)