net/cxgbe: support flow API for destination MAC rewrite
[dpdk.git] / drivers / net / cxgbe / cxgbe_filter.c
index 4c50932..b009217 100644 (file)
@@ -312,8 +312,9 @@ static u64 hash_filter_ntuple(const struct filter_entry *f)
        if (tp->vnic_shift >= 0) {
                if ((adap->params.tp.ingress_config & F_VNIC) &&
                    f->fs.mask.pfvf_vld)
-                       ntuple |= (u64)((f->fs.val.pfvf_vld << 16) |
-                                       (f->fs.val.pf << 13)) << tp->vnic_shift;
+                       ntuple |= (u64)(f->fs.val.pfvf_vld << 16 |
+                                       f->fs.val.pf << 13 | f->fs.val.vf) <<
+                                       tp->vnic_shift;
                else if (!(adap->params.tp.ingress_config & F_VNIC) &&
                         f->fs.mask.ovlan_vld)
                        ntuple |= (u64)(f->fs.val.ovlan_vld << 16 |
@@ -592,7 +593,7 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev,
         * rewriting then we need to allocate a Layer 2 Table (L2T) entry for
         * the filter.
         */
-       if (f->fs.newvlan == VLAN_INSERT ||
+       if (f->fs.newdmac || f->fs.newvlan == VLAN_INSERT ||
            f->fs.newvlan == VLAN_REWRITE) {
                /* allocate L2T entry for new filter */
                f->l2t = cxgbe_l2t_alloc_switching(dev, f->fs.vlan,
@@ -748,10 +749,11 @@ static int set_filter_wr(struct rte_eth_dev *dev, unsigned int fidx)
         * rewriting then we need to allocate a Layer 2 Table (L2T) entry for
         * the filter.
         */
-       if (f->fs.newvlan) {
+       if (f->fs.newvlan || f->fs.newdmac) {
                /* allocate L2T entry for new filter */
                f->l2t = cxgbe_l2t_alloc_switching(f->dev, f->fs.vlan,
                                                   f->fs.eport, f->fs.dmac);
+
                if (!f->l2t)
                        return -ENOMEM;
        }
@@ -786,6 +788,7 @@ static int set_filter_wr(struct rte_eth_dev *dev, unsigned int fidx)
                cpu_to_be32(V_FW_FILTER_WR_DROP(f->fs.action == FILTER_DROP) |
                            V_FW_FILTER_WR_DIRSTEER(f->fs.dirsteer) |
                            V_FW_FILTER_WR_LPBK(f->fs.action == FILTER_SWITCH) |
+                           V_FW_FILTER_WR_DMAC(f->fs.newdmac) |
                            V_FW_FILTER_WR_INSVLAN
                                (f->fs.newvlan == VLAN_INSERT ||
                                 f->fs.newvlan == VLAN_REWRITE) |
@@ -1067,8 +1070,8 @@ int cxgbe_set_filter(struct rte_eth_dev *dev, unsigned int filter_id,
         * to hardware.
         */
        if (iconf & F_VNIC) {
-               f->fs.val.ovlan = fs->val.pf << 13;
-               f->fs.mask.ovlan = fs->mask.pf << 13;
+               f->fs.val.ovlan = fs->val.pf << 13 | fs->val.vf;
+               f->fs.mask.ovlan = fs->mask.pf << 13 | fs->mask.vf;
                f->fs.val.ovlan_vld = fs->val.pfvf_vld;
                f->fs.mask.ovlan_vld = fs->mask.pfvf_vld;
        }
@@ -1136,6 +1139,8 @@ void cxgbe_hash_filter_rpl(struct adapter *adap,
                                      V_TCB_TIMESTAMP(0ULL) |
                                      V_TCB_T_RTT_TS_RECENT_AGE(0ULL),
                                      1);
+               if (f->fs.newdmac)
+                       set_tcb_tflag(adap, tid, S_TF_CCTRL_ECE, 1, 1);
                if (f->fs.newvlan == VLAN_INSERT ||
                    f->fs.newvlan == VLAN_REWRITE)
                        set_tcb_tflag(adap, tid, S_TF_CCTRL_RFR, 1, 1);