Commit e0c6d1d8 authored by David S. Miller's avatar David S. Miller

Merge branch 'cxgb4-SGE-doorbell-queue-timer'

Vishal Kulkarni says:

====================
cxgb4/cxgb4vfSupport for SGE doorbell queue timer

This series of patchs add SGE doorbell queue timer for faster DMA completions.

Patch 1 Implements SGE doorbell queue timer

Patch 2 Adds ethtool capability to set/get SGE doorbell queue timer tick

v2
- Reverse christmas tree formatting for local variables.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents f694be27 543a1b85
...@@ -617,6 +617,7 @@ enum { /* adapter flags */ ...@@ -617,6 +617,7 @@ enum { /* adapter flags */
FW_OFLD_CONN = (1 << 9), FW_OFLD_CONN = (1 << 9),
ROOT_NO_RELAXED_ORDERING = (1 << 10), ROOT_NO_RELAXED_ORDERING = (1 << 10),
SHUTTING_DOWN = (1 << 11), SHUTTING_DOWN = (1 << 11),
SGE_DBQ_TIMER = (1 << 12),
}; };
enum { enum {
...@@ -756,6 +757,8 @@ struct sge_eth_txq { /* state for an SGE Ethernet Tx queue */ ...@@ -756,6 +757,8 @@ struct sge_eth_txq { /* state for an SGE Ethernet Tx queue */
#ifdef CONFIG_CHELSIO_T4_DCB #ifdef CONFIG_CHELSIO_T4_DCB
u8 dcb_prio; /* DCB Priority bound to queue */ u8 dcb_prio; /* DCB Priority bound to queue */
#endif #endif
u8 dbqt; /* SGE Doorbell Queue Timer in use */
unsigned int dbqtimerix; /* SGE Doorbell Queue Timer Index */
unsigned long tso; /* # of TSO requests */ unsigned long tso; /* # of TSO requests */
unsigned long tx_cso; /* # of Tx checksum offloads */ unsigned long tx_cso; /* # of Tx checksum offloads */
unsigned long vlan_ins; /* # of Tx VLAN insertions */ unsigned long vlan_ins; /* # of Tx VLAN insertions */
...@@ -816,6 +819,8 @@ struct sge { ...@@ -816,6 +819,8 @@ struct sge {
u16 nqs_per_uld; /* # of Rx queues per ULD */ u16 nqs_per_uld; /* # of Rx queues per ULD */
u16 timer_val[SGE_NTIMERS]; u16 timer_val[SGE_NTIMERS];
u8 counter_val[SGE_NCOUNTERS]; u8 counter_val[SGE_NCOUNTERS];
u16 dbqtimer_tick;
u16 dbqtimer_val[SGE_NDBQTIMERS];
u32 fl_pg_order; /* large page allocation size */ u32 fl_pg_order; /* large page allocation size */
u32 stat_len; /* length of status page at ring end */ u32 stat_len; /* length of status page at ring end */
u32 pktshift; /* padding between CPL & packet data */ u32 pktshift; /* padding between CPL & packet data */
...@@ -1402,7 +1407,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, ...@@ -1402,7 +1407,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
rspq_flush_handler_t flush_handler, int cong); rspq_flush_handler_t flush_handler, int cong);
int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
struct net_device *dev, struct netdev_queue *netdevq, struct net_device *dev, struct netdev_queue *netdevq,
unsigned int iqid); unsigned int iqid, u8 dbqt);
int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq, int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq,
struct net_device *dev, unsigned int iqid, struct net_device *dev, unsigned int iqid,
unsigned int cmplqid); unsigned int cmplqid);
...@@ -1415,6 +1420,8 @@ irqreturn_t t4_sge_intr_msix(int irq, void *cookie); ...@@ -1415,6 +1420,8 @@ irqreturn_t t4_sge_intr_msix(int irq, void *cookie);
int t4_sge_init(struct adapter *adap); int t4_sge_init(struct adapter *adap);
void t4_sge_start(struct adapter *adap); void t4_sge_start(struct adapter *adap);
void t4_sge_stop(struct adapter *adap); void t4_sge_stop(struct adapter *adap);
int t4_sge_eth_txq_egress_update(struct adapter *adap, struct sge_eth_txq *q,
int maxreclaim);
void cxgb4_set_ethtool_ops(struct net_device *netdev); void cxgb4_set_ethtool_ops(struct net_device *netdev);
int cxgb4_write_rss(const struct port_info *pi, const u16 *queues); int cxgb4_write_rss(const struct port_info *pi, const u16 *queues);
enum cpl_tx_tnl_lso_type cxgb_encap_offload_supported(struct sk_buff *skb); enum cpl_tx_tnl_lso_type cxgb_encap_offload_supported(struct sk_buff *skb);
...@@ -1821,6 +1828,8 @@ int t4_ctrl_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, ...@@ -1821,6 +1828,8 @@ int t4_ctrl_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
int t4_ofld_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, int t4_ofld_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
unsigned int vf, unsigned int eqid); unsigned int vf, unsigned int eqid);
int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox, int ctxt_type); int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox, int ctxt_type);
int t4_read_sge_dbqtimers(struct adapter *adap, unsigned int ndbqtimers,
u16 *dbqtimers);
void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl); void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl);
int t4_update_port_info(struct port_info *pi); int t4_update_port_info(struct port_info *pi);
int t4_get_link_params(struct port_info *pi, unsigned int *link_okp, int t4_get_link_params(struct port_info *pi, unsigned int *link_okp,
......
...@@ -932,11 +932,190 @@ static int get_adaptive_rx_setting(struct net_device *dev) ...@@ -932,11 +932,190 @@ static int get_adaptive_rx_setting(struct net_device *dev)
return q->rspq.adaptive_rx; return q->rspq.adaptive_rx;
} }
static int set_coalesce(struct net_device *dev, struct ethtool_coalesce *c) /* Return the current global Adapter SGE Doorbell Queue Timer Tick for all
* Ethernet TX Queues.
*/
static int get_dbqtimer_tick(struct net_device *dev)
{
struct port_info *pi = netdev_priv(dev);
struct adapter *adap = pi->adapter;
if (!(adap->flags & SGE_DBQ_TIMER))
return 0;
return adap->sge.dbqtimer_tick;
}
/* Return the SGE Doorbell Queue Timer Value for the Ethernet TX Queues
* associated with a Network Device.
*/
static int get_dbqtimer(struct net_device *dev)
{
struct port_info *pi = netdev_priv(dev);
struct adapter *adap = pi->adapter;
struct sge_eth_txq *txq;
txq = &adap->sge.ethtxq[pi->first_qset];
if (!(adap->flags & SGE_DBQ_TIMER))
return 0;
/* all of the TX Queues use the same Timer Index */
return adap->sge.dbqtimer_val[txq->dbqtimerix];
}
/* Set the global Adapter SGE Doorbell Queue Timer Tick for all Ethernet TX
* Queues. This is the fundamental "Tick" that sets the scale of values which
* can be used. Individual Ethernet TX Queues index into a relatively small
* array of Tick Multipliers. Changing the base Tick will thus change all of
* the resulting Timer Values associated with those multipliers for all
* Ethernet TX Queues.
*/
static int set_dbqtimer_tick(struct net_device *dev, int usecs)
{
struct port_info *pi = netdev_priv(dev);
struct adapter *adap = pi->adapter;
struct sge *s = &adap->sge;
u32 param, val;
int ret;
if (!(adap->flags & SGE_DBQ_TIMER))
return 0;
/* return early if it's the same Timer Tick we're already using */
if (s->dbqtimer_tick == usecs)
return 0;
/* attempt to set the new Timer Tick value */
param = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) |
FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_DBQ_TIMERTICK));
val = usecs;
ret = t4_set_params(adap, adap->mbox, adap->pf, 0, 1, &param, &val);
if (ret)
return ret;
s->dbqtimer_tick = usecs;
/* if successful, reread resulting dependent Timer values */
ret = t4_read_sge_dbqtimers(adap, ARRAY_SIZE(s->dbqtimer_val),
s->dbqtimer_val);
return ret;
}
/* Set the SGE Doorbell Queue Timer Value for the Ethernet TX Queues
* associated with a Network Device. There is a relatively small array of
* possible Timer Values so we need to pick the closest value available.
*/
static int set_dbqtimer(struct net_device *dev, int usecs)
{ {
set_adaptive_rx_setting(dev, c->use_adaptive_rx_coalesce); int qix, timerix, min_timerix, delta, min_delta;
return set_rx_intr_params(dev, c->rx_coalesce_usecs, struct port_info *pi = netdev_priv(dev);
c->rx_max_coalesced_frames); struct adapter *adap = pi->adapter;
struct sge *s = &adap->sge;
struct sge_eth_txq *txq;
u32 param, val;
int ret;
if (!(adap->flags & SGE_DBQ_TIMER))
return 0;
/* Find the SGE Doorbell Timer Value that's closest to the requested
* value.
*/
min_delta = INT_MAX;
min_timerix = 0;
for (timerix = 0; timerix < ARRAY_SIZE(s->dbqtimer_val); timerix++) {
delta = s->dbqtimer_val[timerix] - usecs;
if (delta < 0)
delta = -delta;
if (delta < min_delta) {
min_delta = delta;
min_timerix = timerix;
}
}
/* Return early if it's the same Timer Index we're already using.
* We use the same Timer Index for all of the TX Queues for an
* interface so it's only necessary to check the first one.
*/
txq = &s->ethtxq[pi->first_qset];
if (txq->dbqtimerix == min_timerix)
return 0;
for (qix = 0; qix < pi->nqsets; qix++, txq++) {
if (adap->flags & FULL_INIT_DONE) {
param =
(FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DMAQ) |
FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DMAQ_EQ_TIMERIX) |
FW_PARAMS_PARAM_YZ_V(txq->q.cntxt_id));
val = min_timerix;
ret = t4_set_params(adap, adap->mbox, adap->pf, 0,
1, &param, &val);
if (ret)
return ret;
}
txq->dbqtimerix = min_timerix;
}
return 0;
}
/* Set the global Adapter SGE Doorbell Queue Timer Tick for all Ethernet TX
* Queues and the Timer Value for the Ethernet TX Queues associated with a
* Network Device. Since changing the global Tick changes all of the
* available Timer Values, we need to do this first before selecting the
* resulting closest Timer Value. Moreover, since the Tick is global,
* changing it affects the Timer Values for all Network Devices on the
* adapter. So, before changing the Tick, we grab all of the current Timer
* Values for other Network Devices on this Adapter and then attempt to select
* new Timer Values which are close to the old values ...
*/
static int set_dbqtimer_tickval(struct net_device *dev,
int tick_usecs, int timer_usecs)
{
struct port_info *pi = netdev_priv(dev);
struct adapter *adap = pi->adapter;
int timer[MAX_NPORTS];
unsigned int port;
int ret;
/* Grab the other adapter Network Interface current timers and fill in
* the new one for this Network Interface.
*/
for_each_port(adap, port)
if (port == pi->port_id)
timer[port] = timer_usecs;
else
timer[port] = get_dbqtimer(adap->port[port]);
/* Change the global Tick first ... */
ret = set_dbqtimer_tick(dev, tick_usecs);
if (ret)
return ret;
/* ... and then set all of the Network Interface Timer Values ... */
for_each_port(adap, port) {
ret = set_dbqtimer(adap->port[port], timer[port]);
if (ret)
return ret;
}
return 0;
}
static int set_coalesce(struct net_device *dev,
struct ethtool_coalesce *coalesce)
{
int ret;
set_adaptive_rx_setting(dev, coalesce->use_adaptive_rx_coalesce);
ret = set_rx_intr_params(dev, coalesce->rx_coalesce_usecs,
coalesce->rx_max_coalesced_frames);
if (ret)
return ret;
return set_dbqtimer_tickval(dev,
coalesce->tx_coalesce_usecs_irq,
coalesce->tx_coalesce_usecs);
} }
static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c) static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
...@@ -949,6 +1128,8 @@ static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c) ...@@ -949,6 +1128,8 @@ static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
c->rx_max_coalesced_frames = (rq->intr_params & QINTR_CNT_EN_F) ? c->rx_max_coalesced_frames = (rq->intr_params & QINTR_CNT_EN_F) ?
adap->sge.counter_val[rq->pktcnt_idx] : 0; adap->sge.counter_val[rq->pktcnt_idx] : 0;
c->use_adaptive_rx_coalesce = get_adaptive_rx_setting(dev); c->use_adaptive_rx_coalesce = get_adaptive_rx_setting(dev);
c->tx_coalesce_usecs_irq = get_dbqtimer_tick(dev);
c->tx_coalesce_usecs = get_dbqtimer(dev);
return 0; return 0;
} }
......
...@@ -575,7 +575,7 @@ static int fwevtq_handler(struct sge_rspq *q, const __be64 *rsp, ...@@ -575,7 +575,7 @@ static int fwevtq_handler(struct sge_rspq *q, const __be64 *rsp,
struct sge_eth_txq *eq; struct sge_eth_txq *eq;
eq = container_of(txq, struct sge_eth_txq, q); eq = container_of(txq, struct sge_eth_txq, q);
netif_tx_wake_queue(eq->txq); t4_sge_eth_txq_egress_update(q->adap, eq, -1);
} else { } else {
struct sge_uld_txq *oq; struct sge_uld_txq *oq;
...@@ -933,10 +933,13 @@ static int setup_sge_queues(struct adapter *adap) ...@@ -933,10 +933,13 @@ static int setup_sge_queues(struct adapter *adap)
q->rspq.idx = j; q->rspq.idx = j;
memset(&q->stats, 0, sizeof(q->stats)); memset(&q->stats, 0, sizeof(q->stats));
} }
for (j = 0; j < pi->nqsets; j++, t++) {
q = &s->ethrxq[pi->first_qset];
for (j = 0; j < pi->nqsets; j++, t++, q++) {
err = t4_sge_alloc_eth_txq(adap, t, dev, err = t4_sge_alloc_eth_txq(adap, t, dev,
netdev_get_tx_queue(dev, j), netdev_get_tx_queue(dev, j),
s->fw_evtq.cntxt_id); q->rspq.cntxt_id,
!!(adap->flags & SGE_DBQ_TIMER));
if (err) if (err)
goto freeout; goto freeout;
} }
...@@ -958,7 +961,7 @@ static int setup_sge_queues(struct adapter *adap) ...@@ -958,7 +961,7 @@ static int setup_sge_queues(struct adapter *adap)
if (!is_t4(adap->params.chip)) { if (!is_t4(adap->params.chip)) {
err = t4_sge_alloc_eth_txq(adap, &s->ptptxq, adap->port[0], err = t4_sge_alloc_eth_txq(adap, &s->ptptxq, adap->port[0],
netdev_get_tx_queue(adap->port[0], 0) netdev_get_tx_queue(adap->port[0], 0)
, s->fw_evtq.cntxt_id); , s->fw_evtq.cntxt_id, false);
if (err) if (err)
goto freeout; goto freeout;
} }
...@@ -4325,6 +4328,24 @@ static int adap_init0(struct adapter *adap) ...@@ -4325,6 +4328,24 @@ static int adap_init0(struct adapter *adap)
if (ret < 0) if (ret < 0)
goto bye; goto bye;
/* Grab the SGE Doorbell Queue Timer values. If successful, that
* indicates that the Firmware and Hardware support this.
*/
params[0] = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) |
FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_DBQ_TIMERTICK));
ret = t4_query_params(adap, adap->mbox, adap->pf, 0,
1, params, val);
if (!ret) {
adap->sge.dbqtimer_tick = val[0];
ret = t4_read_sge_dbqtimers(adap,
ARRAY_SIZE(adap->sge.dbqtimer_val),
adap->sge.dbqtimer_val);
}
if (!ret)
adap->flags |= SGE_DBQ_TIMER;
if (is_bypass_device(adap->pdev->device)) if (is_bypass_device(adap->pdev->device))
adap->params.bypass = 1; adap->params.bypass = 1;
......
This diff is collapsed.
...@@ -6712,6 +6712,47 @@ int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox, int ctxt_type) ...@@ -6712,6 +6712,47 @@ int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox, int ctxt_type)
return ret; return ret;
} }
/**
* t4_read_sge_dbqtimers - reag SGE Doorbell Queue Timer values
* @adap - the adapter
* @ndbqtimers: size of the provided SGE Doorbell Queue Timer table
* @dbqtimers: SGE Doorbell Queue Timer table
*
* Reads the SGE Doorbell Queue Timer values into the provided table.
* Returns 0 on success (Firmware and Hardware support this feature),
* an error on failure.
*/
int t4_read_sge_dbqtimers(struct adapter *adap, unsigned int ndbqtimers,
u16 *dbqtimers)
{
int ret, dbqtimerix;
ret = 0;
dbqtimerix = 0;
while (dbqtimerix < ndbqtimers) {
int nparams, param;
u32 params[7], vals[7];
nparams = ndbqtimers - dbqtimerix;
if (nparams > ARRAY_SIZE(params))
nparams = ARRAY_SIZE(params);
for (param = 0; param < nparams; param++)
params[param] =
(FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) |
FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_DBQ_TIMER) |
FW_PARAMS_PARAM_Y_V(dbqtimerix + param));
ret = t4_query_params(adap, adap->mbox, adap->pf, 0,
nparams, params, vals);
if (ret)
break;
for (param = 0; param < nparams; param++)
dbqtimers[dbqtimerix++] = vals[param];
}
return ret;
}
/** /**
* t4_fw_hello - establish communication with FW * t4_fw_hello - establish communication with FW
* @adap: the adapter * @adap: the adapter
......
...@@ -91,6 +91,7 @@ enum { ...@@ -91,6 +91,7 @@ enum {
SGE_CTXT_SIZE = 24, /* size of SGE context */ SGE_CTXT_SIZE = 24, /* size of SGE context */
SGE_NTIMERS = 6, /* # of interrupt holdoff timer values */ SGE_NTIMERS = 6, /* # of interrupt holdoff timer values */
SGE_NCOUNTERS = 4, /* # of interrupt packet counter values */ SGE_NCOUNTERS = 4, /* # of interrupt packet counter values */
SGE_NDBQTIMERS = 8, /* # of Doorbell Queue Timer values */
SGE_MAX_IQ_SIZE = 65520, SGE_MAX_IQ_SIZE = 65520,
SGE_TIMER_RSTRT_CNTR = 6, /* restart RX packet threshold counter */ SGE_TIMER_RSTRT_CNTR = 6, /* restart RX packet threshold counter */
......
...@@ -71,12 +71,18 @@ ...@@ -71,12 +71,18 @@
#define FETCHBURSTMIN_64B_X 2 #define FETCHBURSTMIN_64B_X 2
#define FETCHBURSTMIN_128B_X 3 #define FETCHBURSTMIN_128B_X 3
/* T6 and later use a single-bit encoding for FetchBurstMin */
#define FETCHBURSTMIN_64B_T6_X 0
#define FETCHBURSTMIN_128B_T6_X 1
#define FETCHBURSTMAX_256B_X 2 #define FETCHBURSTMAX_256B_X 2
#define FETCHBURSTMAX_512B_X 3 #define FETCHBURSTMAX_512B_X 3
#define HOSTFCMODE_INGRESS_QUEUE_X 1
#define HOSTFCMODE_STATUS_PAGE_X 2 #define HOSTFCMODE_STATUS_PAGE_X 2
#define CIDXFLUSHTHRESH_32_X 5 #define CIDXFLUSHTHRESH_32_X 5
#define CIDXFLUSHTHRESH_128_X 7
#define UPDATEDELIVERY_INTERRUPT_X 1 #define UPDATEDELIVERY_INTERRUPT_X 1
......
...@@ -1254,6 +1254,8 @@ enum fw_params_param_dev { ...@@ -1254,6 +1254,8 @@ enum fw_params_param_dev {
FW_PARAMS_PARAM_DEV_RDMA_WRITE_WITH_IMM = 0x21, FW_PARAMS_PARAM_DEV_RDMA_WRITE_WITH_IMM = 0x21,
FW_PARAMS_PARAM_DEV_RI_WRITE_CMPL_WR = 0x24, FW_PARAMS_PARAM_DEV_RI_WRITE_CMPL_WR = 0x24,
FW_PARAMS_PARAM_DEV_OPAQUE_VIID_SMT_EXTN = 0x27, FW_PARAMS_PARAM_DEV_OPAQUE_VIID_SMT_EXTN = 0x27,
FW_PARAMS_PARAM_DEV_DBQ_TIMER = 0x29,
FW_PARAMS_PARAM_DEV_DBQ_TIMERTICK = 0x2A,
}; };
/* /*
...@@ -1322,6 +1324,7 @@ enum fw_params_param_dmaq { ...@@ -1322,6 +1324,7 @@ enum fw_params_param_dmaq {
FW_PARAMS_PARAM_DMAQ_EQ_CMPLIQID_CTRL = 0x11, FW_PARAMS_PARAM_DMAQ_EQ_CMPLIQID_CTRL = 0x11,
FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH = 0x12, FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH = 0x12,
FW_PARAMS_PARAM_DMAQ_EQ_DCBPRIO_ETH = 0x13, FW_PARAMS_PARAM_DMAQ_EQ_DCBPRIO_ETH = 0x13,
FW_PARAMS_PARAM_DMAQ_EQ_TIMERIX = 0x15,
FW_PARAMS_PARAM_DMAQ_CONM_CTXT = 0x20, FW_PARAMS_PARAM_DMAQ_CONM_CTXT = 0x20,
}; };
...@@ -1751,8 +1754,8 @@ struct fw_eq_eth_cmd { ...@@ -1751,8 +1754,8 @@ struct fw_eq_eth_cmd {
__be32 fetchszm_to_iqid; __be32 fetchszm_to_iqid;
__be32 dcaen_to_eqsize; __be32 dcaen_to_eqsize;
__be64 eqaddr; __be64 eqaddr;
__be32 viid_pkd; __be32 autoequiqe_to_viid;
__be32 r8_lo; __be32 timeren_timerix;
__be64 r9; __be64 r9;
}; };
...@@ -1847,6 +1850,10 @@ struct fw_eq_eth_cmd { ...@@ -1847,6 +1850,10 @@ struct fw_eq_eth_cmd {
#define FW_EQ_ETH_CMD_EQSIZE_S 0 #define FW_EQ_ETH_CMD_EQSIZE_S 0
#define FW_EQ_ETH_CMD_EQSIZE_V(x) ((x) << FW_EQ_ETH_CMD_EQSIZE_S) #define FW_EQ_ETH_CMD_EQSIZE_V(x) ((x) << FW_EQ_ETH_CMD_EQSIZE_S)
#define FW_EQ_ETH_CMD_AUTOEQUIQE_S 31
#define FW_EQ_ETH_CMD_AUTOEQUIQE_V(x) ((x) << FW_EQ_ETH_CMD_AUTOEQUIQE_S)
#define FW_EQ_ETH_CMD_AUTOEQUIQE_F FW_EQ_ETH_CMD_AUTOEQUIQE_V(1U)
#define FW_EQ_ETH_CMD_AUTOEQUEQE_S 30 #define FW_EQ_ETH_CMD_AUTOEQUEQE_S 30
#define FW_EQ_ETH_CMD_AUTOEQUEQE_V(x) ((x) << FW_EQ_ETH_CMD_AUTOEQUEQE_S) #define FW_EQ_ETH_CMD_AUTOEQUEQE_V(x) ((x) << FW_EQ_ETH_CMD_AUTOEQUEQE_S)
#define FW_EQ_ETH_CMD_AUTOEQUEQE_F FW_EQ_ETH_CMD_AUTOEQUEQE_V(1U) #define FW_EQ_ETH_CMD_AUTOEQUEQE_F FW_EQ_ETH_CMD_AUTOEQUEQE_V(1U)
...@@ -1854,6 +1861,19 @@ struct fw_eq_eth_cmd { ...@@ -1854,6 +1861,19 @@ struct fw_eq_eth_cmd {
#define FW_EQ_ETH_CMD_VIID_S 16 #define FW_EQ_ETH_CMD_VIID_S 16
#define FW_EQ_ETH_CMD_VIID_V(x) ((x) << FW_EQ_ETH_CMD_VIID_S) #define FW_EQ_ETH_CMD_VIID_V(x) ((x) << FW_EQ_ETH_CMD_VIID_S)
#define FW_EQ_ETH_CMD_TIMEREN_S 3
#define FW_EQ_ETH_CMD_TIMEREN_M 0x1
#define FW_EQ_ETH_CMD_TIMEREN_V(x) ((x) << FW_EQ_ETH_CMD_TIMEREN_S)
#define FW_EQ_ETH_CMD_TIMEREN_G(x) \
(((x) >> FW_EQ_ETH_CMD_TIMEREN_S) & FW_EQ_ETH_CMD_TIMEREN_M)
#define FW_EQ_ETH_CMD_TIMEREN_F FW_EQ_ETH_CMD_TIMEREN_V(1U)
#define FW_EQ_ETH_CMD_TIMERIX_S 0
#define FW_EQ_ETH_CMD_TIMERIX_M 0x7
#define FW_EQ_ETH_CMD_TIMERIX_V(x) ((x) << FW_EQ_ETH_CMD_TIMERIX_S)
#define FW_EQ_ETH_CMD_TIMERIX_G(x) \
(((x) >> FW_EQ_ETH_CMD_TIMERIX_S) & FW_EQ_ETH_CMD_TIMERIX_M)
struct fw_eq_ctrl_cmd { struct fw_eq_ctrl_cmd {
__be32 op_to_vfn; __be32 op_to_vfn;
__be32 alloc_to_len16; __be32 alloc_to_len16;
......
...@@ -2268,7 +2268,7 @@ int t4vf_sge_alloc_rxq(struct adapter *adapter, struct sge_rspq *rspq, ...@@ -2268,7 +2268,7 @@ int t4vf_sge_alloc_rxq(struct adapter *adapter, struct sge_rspq *rspq,
cmd.iqaddr = cpu_to_be64(rspq->phys_addr); cmd.iqaddr = cpu_to_be64(rspq->phys_addr);
if (fl) { if (fl) {
enum chip_type chip = unsigned int chip_ver =
CHELSIO_CHIP_VERSION(adapter->params.chip); CHELSIO_CHIP_VERSION(adapter->params.chip);
/* /*
* Allocate the ring for the hardware free list (with space * Allocate the ring for the hardware free list (with space
...@@ -2319,10 +2319,10 @@ int t4vf_sge_alloc_rxq(struct adapter *adapter, struct sge_rspq *rspq, ...@@ -2319,10 +2319,10 @@ int t4vf_sge_alloc_rxq(struct adapter *adapter, struct sge_rspq *rspq,
*/ */
cmd.fl0dcaen_to_fl0cidxfthresh = cmd.fl0dcaen_to_fl0cidxfthresh =
cpu_to_be16( cpu_to_be16(
FW_IQ_CMD_FL0FBMIN_V(chip <= CHELSIO_T5 ? FW_IQ_CMD_FL0FBMIN_V(chip_ver <= CHELSIO_T5
FETCHBURSTMIN_128B_X : ? FETCHBURSTMIN_128B_X
FETCHBURSTMIN_64B_X) | : FETCHBURSTMIN_64B_T6_X) |
FW_IQ_CMD_FL0FBMAX_V((chip <= CHELSIO_T5) ? FW_IQ_CMD_FL0FBMAX_V((chip_ver <= CHELSIO_T5) ?
FETCHBURSTMAX_512B_X : FETCHBURSTMAX_512B_X :
FETCHBURSTMAX_256B_X)); FETCHBURSTMAX_256B_X));
cmd.fl0size = cpu_to_be16(flsz); cmd.fl0size = cpu_to_be16(flsz);
...@@ -2411,10 +2411,11 @@ int t4vf_sge_alloc_eth_txq(struct adapter *adapter, struct sge_eth_txq *txq, ...@@ -2411,10 +2411,11 @@ int t4vf_sge_alloc_eth_txq(struct adapter *adapter, struct sge_eth_txq *txq,
struct net_device *dev, struct netdev_queue *devq, struct net_device *dev, struct netdev_queue *devq,
unsigned int iqid) unsigned int iqid)
{ {
unsigned int chip_ver = CHELSIO_CHIP_VERSION(adapter->params.chip);
struct port_info *pi = netdev_priv(dev);
struct fw_eq_eth_cmd cmd, rpl;
struct sge *s = &adapter->sge; struct sge *s = &adapter->sge;
int ret, nentries; int ret, nentries;
struct fw_eq_eth_cmd cmd, rpl;
struct port_info *pi = netdev_priv(dev);
/* /*
* Calculate the size of the hardware TX Queue (including the Status * Calculate the size of the hardware TX Queue (including the Status
...@@ -2448,17 +2449,19 @@ int t4vf_sge_alloc_eth_txq(struct adapter *adapter, struct sge_eth_txq *txq, ...@@ -2448,17 +2449,19 @@ int t4vf_sge_alloc_eth_txq(struct adapter *adapter, struct sge_eth_txq *txq,
cmd.alloc_to_len16 = cpu_to_be32(FW_EQ_ETH_CMD_ALLOC_F | cmd.alloc_to_len16 = cpu_to_be32(FW_EQ_ETH_CMD_ALLOC_F |
FW_EQ_ETH_CMD_EQSTART_F | FW_EQ_ETH_CMD_EQSTART_F |
FW_LEN16(cmd)); FW_LEN16(cmd));
cmd.viid_pkd = cpu_to_be32(FW_EQ_ETH_CMD_AUTOEQUEQE_F | cmd.autoequiqe_to_viid = cpu_to_be32(FW_EQ_ETH_CMD_AUTOEQUEQE_F |
FW_EQ_ETH_CMD_VIID_V(pi->viid)); FW_EQ_ETH_CMD_VIID_V(pi->viid));
cmd.fetchszm_to_iqid = cmd.fetchszm_to_iqid =
cpu_to_be32(FW_EQ_ETH_CMD_HOSTFCMODE_V(SGE_HOSTFCMODE_STPG) | cpu_to_be32(FW_EQ_ETH_CMD_HOSTFCMODE_V(SGE_HOSTFCMODE_STPG) |
FW_EQ_ETH_CMD_PCIECHN_V(pi->port_id) | FW_EQ_ETH_CMD_PCIECHN_V(pi->port_id) |
FW_EQ_ETH_CMD_IQID_V(iqid)); FW_EQ_ETH_CMD_IQID_V(iqid));
cmd.dcaen_to_eqsize = cmd.dcaen_to_eqsize =
cpu_to_be32(FW_EQ_ETH_CMD_FBMIN_V(SGE_FETCHBURSTMIN_64B) | cpu_to_be32(FW_EQ_ETH_CMD_FBMIN_V(chip_ver <= CHELSIO_T5
FW_EQ_ETH_CMD_FBMAX_V(SGE_FETCHBURSTMAX_512B) | ? FETCHBURSTMIN_64B_X
: FETCHBURSTMIN_64B_T6_X) |
FW_EQ_ETH_CMD_FBMAX_V(FETCHBURSTMAX_512B_X) |
FW_EQ_ETH_CMD_CIDXFTHRESH_V( FW_EQ_ETH_CMD_CIDXFTHRESH_V(
SGE_CIDXFLUSHTHRESH_32) | CIDXFLUSHTHRESH_32_X) |
FW_EQ_ETH_CMD_EQSIZE_V(nentries)); FW_EQ_ETH_CMD_EQSIZE_V(nentries));
cmd.eqaddr = cpu_to_be64(txq->q.phys_addr); cmd.eqaddr = cpu_to_be64(txq->q.phys_addr);
......
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