diff options
author | Hariprasad Shenai <hariprasad@chelsio.com> | 2014-06-06 12:10:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-06-11 01:49:55 -0400 |
commit | c887ad0e226b54b33670e22b3bffb53c8d0e3d28 (patch) | |
tree | c59a7d41979ef120e61d8c7ef57509291e4d31a2 | |
parent | b408ff282dda0ef7a3218dc2e5f1399c665d4c20 (diff) |
cxgb4: Change default Interrupt Holdoff Packet Count Threshold
Based on original work by Casey Leedom <leedom@chelsio.com>
Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 69 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/sge.c | 1 |
2 files changed, 40 insertions, 30 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 5fa5f2ab76da..2f8d6b910383 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -2503,8 +2503,7 @@ static unsigned int qtimer_val(const struct adapter *adap, | |||
2503 | } | 2503 | } |
2504 | 2504 | ||
2505 | /** | 2505 | /** |
2506 | * set_rxq_intr_params - set a queue's interrupt holdoff parameters | 2506 | * set_rspq_intr_params - set a queue's interrupt holdoff parameters |
2507 | * @adap: the adapter | ||
2508 | * @q: the Rx queue | 2507 | * @q: the Rx queue |
2509 | * @us: the hold-off time in us, or 0 to disable timer | 2508 | * @us: the hold-off time in us, or 0 to disable timer |
2510 | * @cnt: the hold-off packet count, or 0 to disable counter | 2509 | * @cnt: the hold-off packet count, or 0 to disable counter |
@@ -2512,9 +2511,11 @@ static unsigned int qtimer_val(const struct adapter *adap, | |||
2512 | * Sets an Rx queue's interrupt hold-off time and packet count. At least | 2511 | * Sets an Rx queue's interrupt hold-off time and packet count. At least |
2513 | * one of the two needs to be enabled for the queue to generate interrupts. | 2512 | * one of the two needs to be enabled for the queue to generate interrupts. |
2514 | */ | 2513 | */ |
2515 | static int set_rxq_intr_params(struct adapter *adap, struct sge_rspq *q, | 2514 | static int set_rspq_intr_params(struct sge_rspq *q, |
2516 | unsigned int us, unsigned int cnt) | 2515 | unsigned int us, unsigned int cnt) |
2517 | { | 2516 | { |
2517 | struct adapter *adap = q->adap; | ||
2518 | |||
2518 | if ((us | cnt) == 0) | 2519 | if ((us | cnt) == 0) |
2519 | cnt = 1; | 2520 | cnt = 1; |
2520 | 2521 | ||
@@ -2541,24 +2542,34 @@ static int set_rxq_intr_params(struct adapter *adap, struct sge_rspq *q, | |||
2541 | return 0; | 2542 | return 0; |
2542 | } | 2543 | } |
2543 | 2544 | ||
2544 | static int set_coalesce(struct net_device *dev, struct ethtool_coalesce *c) | 2545 | /** |
2546 | * set_rx_intr_params - set a net devices's RX interrupt holdoff paramete! | ||
2547 | * @dev: the network device | ||
2548 | * @us: the hold-off time in us, or 0 to disable timer | ||
2549 | * @cnt: the hold-off packet count, or 0 to disable counter | ||
2550 | * | ||
2551 | * Set the RX interrupt hold-off parameters for a network device. | ||
2552 | */ | ||
2553 | static int set_rx_intr_params(struct net_device *dev, | ||
2554 | unsigned int us, unsigned int cnt) | ||
2545 | { | 2555 | { |
2546 | const struct port_info *pi = netdev_priv(dev); | 2556 | int i, err; |
2557 | struct port_info *pi = netdev_priv(dev); | ||
2547 | struct adapter *adap = pi->adapter; | 2558 | struct adapter *adap = pi->adapter; |
2548 | struct sge_rspq *q; | 2559 | struct sge_eth_rxq *q = &adap->sge.ethrxq[pi->first_qset]; |
2549 | int i; | 2560 | |
2550 | int r = 0; | 2561 | for (i = 0; i < pi->nqsets; i++, q++) { |
2551 | 2562 | err = set_rspq_intr_params(&q->rspq, us, cnt); | |
2552 | for (i = pi->first_qset; i < pi->first_qset + pi->nqsets; i++) { | 2563 | if (err) |
2553 | q = &adap->sge.ethrxq[i].rspq; | 2564 | return err; |
2554 | r = set_rxq_intr_params(adap, q, c->rx_coalesce_usecs, | ||
2555 | c->rx_max_coalesced_frames); | ||
2556 | if (r) { | ||
2557 | dev_err(&dev->dev, "failed to set coalesce %d\n", r); | ||
2558 | break; | ||
2559 | } | ||
2560 | } | 2565 | } |
2561 | return r; | 2566 | return 0; |
2567 | } | ||
2568 | |||
2569 | static int set_coalesce(struct net_device *dev, struct ethtool_coalesce *c) | ||
2570 | { | ||
2571 | return set_rx_intr_params(dev, c->rx_coalesce_usecs, | ||
2572 | c->rx_max_coalesced_frames); | ||
2562 | } | 2573 | } |
2563 | 2574 | ||
2564 | static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c) | 2575 | static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c) |
@@ -5812,12 +5823,12 @@ static inline bool is_x_10g_port(const struct link_config *lc) | |||
5812 | (lc->supported & FW_PORT_CAP_SPEED_40G) != 0; | 5823 | (lc->supported & FW_PORT_CAP_SPEED_40G) != 0; |
5813 | } | 5824 | } |
5814 | 5825 | ||
5815 | static inline void init_rspq(struct sge_rspq *q, u8 timer_idx, u8 pkt_cnt_idx, | 5826 | static inline void init_rspq(struct adapter *adap, struct sge_rspq *q, |
5827 | unsigned int us, unsigned int cnt, | ||
5816 | unsigned int size, unsigned int iqe_size) | 5828 | unsigned int size, unsigned int iqe_size) |
5817 | { | 5829 | { |
5818 | q->intr_params = QINTR_TIMER_IDX(timer_idx) | | 5830 | q->adap = adap; |
5819 | (pkt_cnt_idx < SGE_NCOUNTERS ? QINTR_CNT_EN : 0); | 5831 | set_rspq_intr_params(q, us, cnt); |
5820 | q->pktcnt_idx = pkt_cnt_idx < SGE_NCOUNTERS ? pkt_cnt_idx : 0; | ||
5821 | q->iqe_len = iqe_size; | 5832 | q->iqe_len = iqe_size; |
5822 | q->size = size; | 5833 | q->size = size; |
5823 | } | 5834 | } |
@@ -5876,7 +5887,7 @@ static void cfg_queues(struct adapter *adap) | |||
5876 | for (i = 0; i < ARRAY_SIZE(s->ethrxq); i++) { | 5887 | for (i = 0; i < ARRAY_SIZE(s->ethrxq); i++) { |
5877 | struct sge_eth_rxq *r = &s->ethrxq[i]; | 5888 | struct sge_eth_rxq *r = &s->ethrxq[i]; |
5878 | 5889 | ||
5879 | init_rspq(&r->rspq, 0, 0, 1024, 64); | 5890 | init_rspq(adap, &r->rspq, 5, 10, 1024, 64); |
5880 | r->fl.size = 72; | 5891 | r->fl.size = 72; |
5881 | } | 5892 | } |
5882 | 5893 | ||
@@ -5892,7 +5903,7 @@ static void cfg_queues(struct adapter *adap) | |||
5892 | for (i = 0; i < ARRAY_SIZE(s->ofldrxq); i++) { | 5903 | for (i = 0; i < ARRAY_SIZE(s->ofldrxq); i++) { |
5893 | struct sge_ofld_rxq *r = &s->ofldrxq[i]; | 5904 | struct sge_ofld_rxq *r = &s->ofldrxq[i]; |
5894 | 5905 | ||
5895 | init_rspq(&r->rspq, 0, 0, 1024, 64); | 5906 | init_rspq(adap, &r->rspq, 5, 1, 1024, 64); |
5896 | r->rspq.uld = CXGB4_ULD_ISCSI; | 5907 | r->rspq.uld = CXGB4_ULD_ISCSI; |
5897 | r->fl.size = 72; | 5908 | r->fl.size = 72; |
5898 | } | 5909 | } |
@@ -5900,7 +5911,7 @@ static void cfg_queues(struct adapter *adap) | |||
5900 | for (i = 0; i < ARRAY_SIZE(s->rdmarxq); i++) { | 5911 | for (i = 0; i < ARRAY_SIZE(s->rdmarxq); i++) { |
5901 | struct sge_ofld_rxq *r = &s->rdmarxq[i]; | 5912 | struct sge_ofld_rxq *r = &s->rdmarxq[i]; |
5902 | 5913 | ||
5903 | init_rspq(&r->rspq, 0, 0, 511, 64); | 5914 | init_rspq(adap, &r->rspq, 5, 1, 511, 64); |
5904 | r->rspq.uld = CXGB4_ULD_RDMA; | 5915 | r->rspq.uld = CXGB4_ULD_RDMA; |
5905 | r->fl.size = 72; | 5916 | r->fl.size = 72; |
5906 | } | 5917 | } |
@@ -5914,12 +5925,12 @@ static void cfg_queues(struct adapter *adap) | |||
5914 | for (i = 0; i < ARRAY_SIZE(s->rdmaciq); i++) { | 5925 | for (i = 0; i < ARRAY_SIZE(s->rdmaciq); i++) { |
5915 | struct sge_ofld_rxq *r = &s->rdmaciq[i]; | 5926 | struct sge_ofld_rxq *r = &s->rdmaciq[i]; |
5916 | 5927 | ||
5917 | init_rspq(&r->rspq, 0, 0, ciq_size, 64); | 5928 | init_rspq(adap, &r->rspq, 5, 1, ciq_size, 64); |
5918 | r->rspq.uld = CXGB4_ULD_RDMA; | 5929 | r->rspq.uld = CXGB4_ULD_RDMA; |
5919 | } | 5930 | } |
5920 | 5931 | ||
5921 | init_rspq(&s->fw_evtq, 6, 0, 512, 64); | 5932 | init_rspq(adap, &s->fw_evtq, 0, 1, 1024, 64); |
5922 | init_rspq(&s->intrq, 6, 0, 2 * MAX_INGQ, 64); | 5933 | init_rspq(adap, &s->intrq, 0, 1, 2 * MAX_INGQ, 64); |
5923 | } | 5934 | } |
5924 | 5935 | ||
5925 | /* | 5936 | /* |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c index bd82939ae8f4..58bd213fcaf2 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c | |||
@@ -2215,7 +2215,6 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, | |||
2215 | iq->cntxt_id = ntohs(c.iqid); | 2215 | iq->cntxt_id = ntohs(c.iqid); |
2216 | iq->abs_id = ntohs(c.physiqid); | 2216 | iq->abs_id = ntohs(c.physiqid); |
2217 | iq->size--; /* subtract status entry */ | 2217 | iq->size--; /* subtract status entry */ |
2218 | iq->adap = adap; | ||
2219 | iq->netdev = dev; | 2218 | iq->netdev = dev; |
2220 | iq->handler = hnd; | 2219 | iq->handler = hnd; |
2221 | 2220 | ||