#include "clip_tbl.h"
#include "l2t.h"
#include "smt.h"
+#include "cxgbe_pfvf.h"
/**
* Initialize Hash Filters
*/
int cxgbe_init_hash_filter(struct adapter *adap)
{
- unsigned int n_user_filters;
- unsigned int user_filter_perc;
+ unsigned int user_filter_perc, n_user_filters;
+ u32 param, val;
int ret;
- u32 params[7], val[7];
-#define FW_PARAM_DEV(param) \
- (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | \
- V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_##param))
+ if (CHELSIO_CHIP_VERSION(adap->params.chip) > CHELSIO_T5) {
+ val = t4_read_reg(adap, A_LE_DB_RSP_CODE_0);
+ if (G_TCAM_ACTV_HIT(val) != 4) {
+ adap->params.hash_filter = 0;
+ return 0;
+ }
-#define FW_PARAM_PFVF(param) \
- (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_PFVF) | \
- V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_PFVF_##param) | \
- V_FW_PARAMS_PARAM_Y(0) | \
- V_FW_PARAMS_PARAM_Z(0))
+ val = t4_read_reg(adap, A_LE_DB_RSP_CODE_1);
+ if (G_HASH_ACTV_HIT(val) != 4) {
+ adap->params.hash_filter = 0;
+ return 0;
+ }
+ }
- params[0] = FW_PARAM_DEV(NTID);
+ param = CXGBE_FW_PARAM_DEV(NTID);
ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1,
- params, val);
+ ¶m, &val);
if (ret < 0)
return ret;
- adap->tids.ntids = val[0];
+ adap->tids.ntids = val;
adap->tids.natids = min(adap->tids.ntids / 2, MAX_ATIDS);
user_filter_perc = 100;
* then assume it is an absolute qid.
*/
if (fs->iq < pi->n_rx_qsets)
- iq = adapter->sge.ethrxq[pi->first_qset +
+ iq = adapter->sge.ethrxq[pi->first_rxqset +
fs->iq].rspq.abs_id;
else
iq = fs->iq;
if (f->fs.mask.macidx)
cxgbe_mpstcam_remove(pi, f->fs.val.macidx);
+ if (f->smt)
+ cxgbe_smt_release(f->smt);
+
/* The zeroing of the filter rule below clears the filter valid,
* pending, locked flags etc. so it's all we need for
* this operation.
unsigned int port_id = ethdev2pinfo(dev)->port_id;
int ret;
- /* If the new filter requires Source MAC rewriting then we need to
- * allocate a SMT entry for the filter
- */
- if (f->fs.newsmac) {
- f->smt = cxgbe_smt_alloc_switching(f->dev, f->fs.smac);
- if (!f->smt) {
- if (f->l2t) {
- cxgbe_l2t_release(f->l2t);
- f->l2t = NULL;
- }
- return -ENOMEM;
- }
- }
-
ctrlq = &adapter->sge.ctrlq[port_id];
mbuf = rte_pktmbuf_alloc(ctrlq->mb_pool);
if (!mbuf) {
}
}
+ /* If the new filter requires Source MAC rewriting then we need to
+ * allocate a SMT entry for the filter
+ */
+ if (f->fs.newsmac) {
+ f->smt = cxgbe_smt_alloc_switching(f->dev, f->fs.smac);
+ if (!f->smt) {
+ ret = -ENOMEM;
+ goto free_tid;
+ }
+ }
+
iconf = adapter->params.tp.ingress_config;
/* Either PFVF or OVLAN can be active, but not both