aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/marvell/mvpp2/mvpp2.h1
-rw-r--r--drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c29
-rw-r--r--drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.h11
3 files changed, 32 insertions, 9 deletions
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
index 9d2222ab60ae..6171270a016c 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
@@ -136,6 +136,7 @@
136#define MVPP22_CLS_C2_ACT_FWD(act) (((act) & 0x7) << 13) 136#define MVPP22_CLS_C2_ACT_FWD(act) (((act) & 0x7) << 13)
137#define MVPP22_CLS_C2_ACT_QHIGH(act) (((act) & 0x3) << 11) 137#define MVPP22_CLS_C2_ACT_QHIGH(act) (((act) & 0x3) << 11)
138#define MVPP22_CLS_C2_ACT_QLOW(act) (((act) & 0x3) << 9) 138#define MVPP22_CLS_C2_ACT_QLOW(act) (((act) & 0x3) << 9)
139#define MVPP22_CLS_C2_ACT_COLOR(act) ((act) & 0x7)
139#define MVPP22_CLS_C2_ATTR0 0x1b64 140#define MVPP22_CLS_C2_ATTR0 0x1b64
140#define MVPP22_CLS_C2_ATTR0_QHIGH(qh) (((qh) & 0x1f) << 24) 141#define MVPP22_CLS_C2_ATTR0_QHIGH(qh) (((qh) & 0x1f) << 24)
141#define MVPP22_CLS_C2_ATTR0_QHIGH_MASK 0x1f 142#define MVPP22_CLS_C2_ATTR0_QHIGH_MASK 0x1f
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
index f4dd59c00d80..4989fb13244f 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
@@ -1057,17 +1057,28 @@ static int mvpp2_port_c2_tcam_rule_add(struct mvpp2_port *port,
1057 c2.tcam[4] |= MVPP22_CLS_C2_TCAM_EN(MVPP22_CLS_C2_LU_TYPE(MVPP2_CLS_LU_TYPE_MASK)); 1057 c2.tcam[4] |= MVPP22_CLS_C2_TCAM_EN(MVPP22_CLS_C2_LU_TYPE(MVPP2_CLS_LU_TYPE_MASK));
1058 c2.tcam[4] |= MVPP22_CLS_C2_LU_TYPE(rule->loc); 1058 c2.tcam[4] |= MVPP22_CLS_C2_LU_TYPE(rule->loc);
1059 1059
1060 /* Mark packet as "forwarded to software", needed for RSS */ 1060 if (act->id == FLOW_ACTION_DROP) {
1061 c2.act |= MVPP22_CLS_C2_ACT_FWD(MVPP22_C2_FWD_SW_LOCK); 1061 c2.act = MVPP22_CLS_C2_ACT_COLOR(MVPP22_C2_COL_RED_LOCK);
1062 } else {
1063 /* We want to keep the default color derived from the Header
1064 * Parser drop entries, for VLAN and MAC filtering. This will
1065 * assign a default color of Green or Red, and we want matches
1066 * with a non-drop action to keep that color.
1067 */
1068 c2.act = MVPP22_CLS_C2_ACT_COLOR(MVPP22_C2_COL_NO_UPD_LOCK);
1062 1069
1063 c2.act |= MVPP22_CLS_C2_ACT_QHIGH(MVPP22_C2_UPD_LOCK) | 1070 /* Mark packet as "forwarded to software", needed for RSS */
1064 MVPP22_CLS_C2_ACT_QLOW(MVPP22_C2_UPD_LOCK); 1071 c2.act |= MVPP22_CLS_C2_ACT_FWD(MVPP22_C2_FWD_SW_LOCK);
1065 1072
1066 qh = ((act->queue.index + port->first_rxq) >> 3) & MVPP22_CLS_C2_ATTR0_QHIGH_MASK; 1073 c2.act |= MVPP22_CLS_C2_ACT_QHIGH(MVPP22_C2_UPD_LOCK) |
1067 ql = (act->queue.index + port->first_rxq) & MVPP22_CLS_C2_ATTR0_QLOW_MASK; 1074 MVPP22_CLS_C2_ACT_QLOW(MVPP22_C2_UPD_LOCK);
1068 1075
1069 c2.attr[0] = MVPP22_CLS_C2_ATTR0_QHIGH(qh) | 1076 qh = ((act->queue.index + port->first_rxq) >> 3) & MVPP22_CLS_C2_ATTR0_QHIGH_MASK;
1070 MVPP22_CLS_C2_ATTR0_QLOW(ql); 1077 ql = (act->queue.index + port->first_rxq) & MVPP22_CLS_C2_ATTR0_QLOW_MASK;
1078
1079 c2.attr[0] = MVPP22_CLS_C2_ATTR0_QHIGH(qh) |
1080 MVPP22_CLS_C2_ATTR0_QLOW(ql);
1081 }
1071 1082
1072 c2.valid = true; 1083 c2.valid = true;
1073 1084
@@ -1183,7 +1194,7 @@ static int mvpp2_cls_rfs_parse_rule(struct mvpp2_rfs_rule *rule)
1183 struct flow_action_entry *act; 1194 struct flow_action_entry *act;
1184 1195
1185 act = &flow->action.entries[0]; 1196 act = &flow->action.entries[0];
1186 if (act->id != FLOW_ACTION_QUEUE) 1197 if (act->id != FLOW_ACTION_QUEUE && act->id != FLOW_ACTION_DROP)
1187 return -EOPNOTSUPP; 1198 return -EOPNOTSUPP;
1188 1199
1189 /* For now, only use the C2 engine which has a HEK size limited to 64 1200 /* For now, only use the C2 engine which has a HEK size limited to 64
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.h
index 431563a13524..56b617375a65 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.h
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.h
@@ -92,6 +92,17 @@ enum mvpp22_cls_c2_fwd_action {
92 MVPP22_C2_FWD_HW_LOW_LAT_LOCK, 92 MVPP22_C2_FWD_HW_LOW_LAT_LOCK,
93}; 93};
94 94
95enum mvpp22_cls_c2_color_action {
96 MVPP22_C2_COL_NO_UPD = 0,
97 MVPP22_C2_COL_NO_UPD_LOCK,
98 MVPP22_C2_COL_GREEN,
99 MVPP22_C2_COL_GREEN_LOCK,
100 MVPP22_C2_COL_YELLOW,
101 MVPP22_C2_COL_YELLOW_LOCK,
102 MVPP22_C2_COL_RED, /* Drop */
103 MVPP22_C2_COL_RED_LOCK, /* Drop */
104};
105
95#define MVPP2_CLS_C2_TCAM_WORDS 5 106#define MVPP2_CLS_C2_TCAM_WORDS 5
96#define MVPP2_CLS_C2_ATTR_WORDS 5 107#define MVPP2_CLS_C2_ATTR_WORDS 5
97 108