Commit 937d8420 authored by Raju Rangoju's avatar Raju Rangoju Committed by Jakub Kicinski

cxgb4: set up filter action after rewrites

The current code sets up the filter action field before
rewrites are set up. When the action 'switch' is used
with rewrites, this may result in initial few packets
that get switched out don't have rewrites applied
on them.

So, make sure filter action is set up along with rewrites
or only after everything else is set up for rewrites.

Fixes: 12b276fb ("cxgb4: add support to create hash filters")
Signed-off-by: default avatarRaju Rangoju <rajur@chelsio.com>
Link: https://lore.kernel.org/r/20201023115852.18262-1-rajur@chelsio.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent ee7a3764
...@@ -145,13 +145,13 @@ static int configure_filter_smac(struct adapter *adap, struct filter_entry *f) ...@@ -145,13 +145,13 @@ static int configure_filter_smac(struct adapter *adap, struct filter_entry *f)
int err; int err;
/* do a set-tcb for smac-sel and CWR bit.. */ /* do a set-tcb for smac-sel and CWR bit.. */
err = set_tcb_tflag(adap, f, f->tid, TF_CCTRL_CWR_S, 1, 1);
if (err)
goto smac_err;
err = set_tcb_field(adap, f, f->tid, TCB_SMAC_SEL_W, err = set_tcb_field(adap, f, f->tid, TCB_SMAC_SEL_W,
TCB_SMAC_SEL_V(TCB_SMAC_SEL_M), TCB_SMAC_SEL_V(TCB_SMAC_SEL_M),
TCB_SMAC_SEL_V(f->smt->idx), 1); TCB_SMAC_SEL_V(f->smt->idx), 1);
if (err)
goto smac_err;
err = set_tcb_tflag(adap, f, f->tid, TF_CCTRL_CWR_S, 1, 1);
if (!err) if (!err)
return 0; return 0;
...@@ -862,6 +862,7 @@ int set_filter_wr(struct adapter *adapter, int fidx) ...@@ -862,6 +862,7 @@ int set_filter_wr(struct adapter *adapter, int fidx)
FW_FILTER_WR_DIRSTEERHASH_V(f->fs.dirsteerhash) | FW_FILTER_WR_DIRSTEERHASH_V(f->fs.dirsteerhash) |
FW_FILTER_WR_LPBK_V(f->fs.action == FILTER_SWITCH) | FW_FILTER_WR_LPBK_V(f->fs.action == FILTER_SWITCH) |
FW_FILTER_WR_DMAC_V(f->fs.newdmac) | FW_FILTER_WR_DMAC_V(f->fs.newdmac) |
FW_FILTER_WR_SMAC_V(f->fs.newsmac) |
FW_FILTER_WR_INSVLAN_V(f->fs.newvlan == VLAN_INSERT || FW_FILTER_WR_INSVLAN_V(f->fs.newvlan == VLAN_INSERT ||
f->fs.newvlan == VLAN_REWRITE) | f->fs.newvlan == VLAN_REWRITE) |
FW_FILTER_WR_RMVLAN_V(f->fs.newvlan == VLAN_REMOVE || FW_FILTER_WR_RMVLAN_V(f->fs.newvlan == VLAN_REMOVE ||
...@@ -879,7 +880,7 @@ int set_filter_wr(struct adapter *adapter, int fidx) ...@@ -879,7 +880,7 @@ int set_filter_wr(struct adapter *adapter, int fidx)
FW_FILTER_WR_OVLAN_VLD_V(f->fs.val.ovlan_vld) | FW_FILTER_WR_OVLAN_VLD_V(f->fs.val.ovlan_vld) |
FW_FILTER_WR_IVLAN_VLDM_V(f->fs.mask.ivlan_vld) | FW_FILTER_WR_IVLAN_VLDM_V(f->fs.mask.ivlan_vld) |
FW_FILTER_WR_OVLAN_VLDM_V(f->fs.mask.ovlan_vld)); FW_FILTER_WR_OVLAN_VLDM_V(f->fs.mask.ovlan_vld));
fwr->smac_sel = 0; fwr->smac_sel = f->smt->idx;
fwr->rx_chan_rx_rpl_iq = fwr->rx_chan_rx_rpl_iq =
htons(FW_FILTER_WR_RX_CHAN_V(0) | htons(FW_FILTER_WR_RX_CHAN_V(0) |
FW_FILTER_WR_RX_RPL_IQ_V(adapter->sge.fw_evtq.abs_id)); FW_FILTER_WR_RX_RPL_IQ_V(adapter->sge.fw_evtq.abs_id));
...@@ -1323,11 +1324,8 @@ static void mk_act_open_req6(struct filter_entry *f, struct sk_buff *skb, ...@@ -1323,11 +1324,8 @@ static void mk_act_open_req6(struct filter_entry *f, struct sk_buff *skb,
TX_QUEUE_V(f->fs.nat_mode) | TX_QUEUE_V(f->fs.nat_mode) |
T5_OPT_2_VALID_F | T5_OPT_2_VALID_F |
RX_CHANNEL_V(cxgb4_port_e2cchan(f->dev)) | RX_CHANNEL_V(cxgb4_port_e2cchan(f->dev)) |
CONG_CNTRL_V((f->fs.action == FILTER_DROP) |
(f->fs.dirsteer << 1)) |
PACE_V((f->fs.maskhash) | PACE_V((f->fs.maskhash) |
((f->fs.dirsteerhash) << 1)) | ((f->fs.dirsteerhash) << 1)));
CCTRL_ECN_V(f->fs.action == FILTER_SWITCH));
} }
static void mk_act_open_req(struct filter_entry *f, struct sk_buff *skb, static void mk_act_open_req(struct filter_entry *f, struct sk_buff *skb,
...@@ -1363,11 +1361,8 @@ static void mk_act_open_req(struct filter_entry *f, struct sk_buff *skb, ...@@ -1363,11 +1361,8 @@ static void mk_act_open_req(struct filter_entry *f, struct sk_buff *skb,
TX_QUEUE_V(f->fs.nat_mode) | TX_QUEUE_V(f->fs.nat_mode) |
T5_OPT_2_VALID_F | T5_OPT_2_VALID_F |
RX_CHANNEL_V(cxgb4_port_e2cchan(f->dev)) | RX_CHANNEL_V(cxgb4_port_e2cchan(f->dev)) |
CONG_CNTRL_V((f->fs.action == FILTER_DROP) |
(f->fs.dirsteer << 1)) |
PACE_V((f->fs.maskhash) | PACE_V((f->fs.maskhash) |
((f->fs.dirsteerhash) << 1)) | ((f->fs.dirsteerhash) << 1)));
CCTRL_ECN_V(f->fs.action == FILTER_SWITCH));
} }
static int cxgb4_set_hash_filter(struct net_device *dev, static int cxgb4_set_hash_filter(struct net_device *dev,
...@@ -2039,6 +2034,20 @@ void hash_filter_rpl(struct adapter *adap, const struct cpl_act_open_rpl *rpl) ...@@ -2039,6 +2034,20 @@ void hash_filter_rpl(struct adapter *adap, const struct cpl_act_open_rpl *rpl)
} }
return; return;
} }
switch (f->fs.action) {
case FILTER_PASS:
if (f->fs.dirsteer)
set_tcb_tflag(adap, f, tid,
TF_DIRECT_STEER_S, 1, 1);
break;
case FILTER_DROP:
set_tcb_tflag(adap, f, tid, TF_DROP_S, 1, 1);
break;
case FILTER_SWITCH:
set_tcb_tflag(adap, f, tid, TF_LPBK_S, 1, 1);
break;
}
break; break;
default: default:
...@@ -2106,22 +2115,11 @@ void filter_rpl(struct adapter *adap, const struct cpl_set_tcb_rpl *rpl) ...@@ -2106,22 +2115,11 @@ void filter_rpl(struct adapter *adap, const struct cpl_set_tcb_rpl *rpl)
if (ctx) if (ctx)
ctx->result = 0; ctx->result = 0;
} else if (ret == FW_FILTER_WR_FLT_ADDED) { } else if (ret == FW_FILTER_WR_FLT_ADDED) {
int err = 0; f->pending = 0; /* async setup completed */
f->valid = 1;
if (f->fs.newsmac) if (ctx) {
err = configure_filter_smac(adap, f); ctx->result = 0;
ctx->tid = idx;
if (!err) {
f->pending = 0; /* async setup completed */
f->valid = 1;
if (ctx) {
ctx->result = 0;
ctx->tid = idx;
}
} else {
clear_filter(adap, f);
if (ctx)
ctx->result = err;
} }
} else { } else {
/* Something went wrong. Issue a warning about the /* Something went wrong. Issue a warning about the
......
...@@ -50,6 +50,10 @@ ...@@ -50,6 +50,10 @@
#define TCB_T_FLAGS_M 0xffffffffffffffffULL #define TCB_T_FLAGS_M 0xffffffffffffffffULL
#define TCB_T_FLAGS_V(x) ((__u64)(x) << TCB_T_FLAGS_S) #define TCB_T_FLAGS_V(x) ((__u64)(x) << TCB_T_FLAGS_S)
#define TF_DROP_S 22
#define TF_DIRECT_STEER_S 23
#define TF_LPBK_S 59
#define TF_CCTRL_ECE_S 60 #define TF_CCTRL_ECE_S 60
#define TF_CCTRL_CWR_S 61 #define TF_CCTRL_CWR_S 61
#define TF_CCTRL_RFR_S 62 #define TF_CCTRL_RFR_S 62
......
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