From: kbuild test robot <lkp@intel.com>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>
Cc: linux-arm-kernel@lists.infradead.org,
Antoine Tenart <antoine.tenart@bootlin.com>,
netdev@vger.kernel.org, gregory.clement@bootlin.com,
linux-kernel@vger.kernel.org,
Maxime Chevallier <maxime.chevallier@bootlin.com>,
nadavh@marvell.com, kbuild-all@01.org,
thomas.petazzoni@bootlin.com, miquel.raynal@bootlin.com,
stefanc@marvell.com, mw@semihalf.com, davem@davemloft.net,
Russell King <linux@armlinux.org.uk>
Subject: Re: [PATCH net-next] net: mvpp2: cls: Add Classification offload support
Date: Sun, 21 Apr 2019 09:51:58 +0800 [thread overview]
Message-ID: <201904210940.fJOE1mJy%lkp@intel.com> (raw)
In-Reply-To: <20190419133027.8012-1-maxime.chevallier@bootlin.com>
Hi Maxime,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Maxime-Chevallier/net-mvpp2-cls-Add-Classification-offload-support/20190420-234729
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
smatch warnings:
drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c:1051 mvpp2_port_c2_tcam_rule_add() warn: unsigned 'c2.index' is never less than zero.
drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c:1164 mvpp2_port_flt_has_siblings() error: buffer overflow 'port->rfs_rules' 49 <= 49
drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c:1340 mvpp2_ethtool_cls_rule_ins() warn: unsigned 'info->fs.location' is never less than zero.
vim +1051 drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
1040
1041 static int mvpp2_port_c2_tcam_rule_add(struct mvpp2_port *port,
1042 struct mvpp2_rfs_rule *rule)
1043 {
1044 struct flow_action_entry *act;
1045 struct mvpp2_cls_c2_entry c2;
1046 u8 qh, ql, pmap;
1047
1048 memset(&c2, 0, sizeof(c2));
1049
1050 c2.index = mvpp2_cls_c2_port_flow_index(port, rule->lu_type, rule->loc);
> 1051 if (c2.index < 0)
1052 return -EINVAL;
1053
1054 act = &rule->flow->action.entries[0];
1055
1056 rule->c2_index = c2.index;
1057
1058 c2.tcam[0] = (rule->c2_tcam & 0xffff) |
1059 ((rule->c2_tcam_mask & 0xffff) << 16);
1060 c2.tcam[1] = ((rule->c2_tcam >> 16) & 0xffff) |
1061 (((rule->c2_tcam_mask >> 16) & 0xffff) << 16);
1062 c2.tcam[2] = ((rule->c2_tcam >> 32) & 0xffff) |
1063 (((rule->c2_tcam_mask >> 32) & 0xffff) << 16);
1064 c2.tcam[3] = ((rule->c2_tcam >> 48) & 0xffff) |
1065 (((rule->c2_tcam_mask >> 48) & 0xffff) << 16);
1066
1067 pmap = BIT(port->id);
1068 c2.tcam[4] = MVPP22_CLS_C2_PORT_ID(pmap);
1069 c2.tcam[4] |= MVPP22_CLS_C2_TCAM_EN(MVPP22_CLS_C2_PORT_ID(pmap));
1070
1071 /* Match on Lookup Type */
1072 c2.tcam[4] |= MVPP22_CLS_C2_TCAM_EN(MVPP22_CLS_C2_LU_TYPE(MVPP2_CLS_LU_TYPE_MASK));
1073 c2.tcam[4] |= MVPP22_CLS_C2_LU_TYPE(rule->lu_type);
1074
1075 /* Mark packet as "forwarded to software", needed for RSS */
1076 c2.act |= MVPP22_CLS_C2_ACT_FWD(MVPP22_C2_FWD_SW_LOCK);
1077
1078 c2.act |= MVPP22_CLS_C2_ACT_QHIGH(MVPP22_C2_UPD_LOCK) |
1079 MVPP22_CLS_C2_ACT_QLOW(MVPP22_C2_UPD_LOCK);
1080
1081 qh = ((act->queue.index + port->first_rxq) >> 3) & MVPP22_CLS_C2_ATTR0_QHIGH_MASK;
1082 ql = (act->queue.index + port->first_rxq) & MVPP22_CLS_C2_ATTR0_QLOW_MASK;
1083
1084 c2.attr[0] = MVPP22_CLS_C2_ATTR0_QHIGH(qh) |
1085 MVPP22_CLS_C2_ATTR0_QLOW(ql);
1086
1087 c2.valid = true;
1088
1089 mvpp2_cls_c2_write(port->priv, &c2);
1090
1091 return 0;
1092 }
1093
1094 static int mvpp2_port_c2_rfs_rule_insert(struct mvpp2_port *port,
1095 struct mvpp2_rfs_rule *rule)
1096 {
1097 return mvpp2_port_c2_tcam_rule_add(port, rule);
1098 }
1099
1100 static int mvpp2_port_flow_table_find(struct mvpp2 *priv, int flow_id,
1101 u8 engine, u8 lu_type, u16 hek_fields)
1102 {
1103 struct mvpp2_cls_flow_entry fe;
1104 u16 flow_hek_fields;
1105 int i, flow_engine;
1106 u8 flow_lu_type;
1107
1108 /* Iterate on all flow table entries for this ID */
1109 for (i = MVPP2_CLS_FLT_FIRST(flow_id);
1110 i < MVPP2_CLS_FLT_LAST(flow_id); i++) {
1111 mvpp2_cls_flow_read(priv, i, &fe);
1112
1113 flow_hek_fields = mvpp2_flow_get_hek_fields(&fe);
1114 if (flow_hek_fields != hek_fields)
1115 continue;
1116
1117 flow_engine = mvpp2_cls_flow_eng_get(&fe);
1118 if (flow_engine != engine)
1119 continue;
1120
1121 flow_lu_type = mvpp2_cls_flow_lu_type_get(&fe);
1122 if (flow_lu_type != lu_type)
1123 continue;
1124
1125 return i;
1126 }
1127
1128 return -1;
1129 }
1130
1131 static int mvpp2_port_flow_table_find_free(struct mvpp2 *priv, int flow_id)
1132 {
1133 struct mvpp2_cls_flow_entry fe;
1134 u8 pmap;
1135 int i;
1136
1137 memset(&fe, 0, sizeof(fe));
1138 for (i = 0; i < MVPP2_N_RFS_ENTRIES_PER_FLOW; i++) {
1139 mvpp2_cls_flow_read(priv, MVPP2_CLS_FLT_C2_RFS(flow_id, i),
1140 &fe);
1141
1142 /* get pmap */
1143 pmap = mvpp2_cls_flow_pmap_get(&fe);
1144 if (!pmap)
1145 return MVPP2_CLS_FLT_C2_RFS(flow_id, i);
1146 }
1147
1148 return -1;
1149 }
1150
1151 /**
1152 * It's possible that multiple different rfs rules use the same flow_table
1153 * entry, if the rules use the same key and the same engine. In that case,
1154 * we must make sure not to delete this flow_table entry when removing the
1155 * rule, unless it's the last rule that uses this entry.
1156 */
1157 static bool mvpp2_port_flt_has_siblings(struct mvpp2_port *port,
1158 struct mvpp2_rfs_rule *rule)
1159 {
1160 struct mvpp2_ethtool_fs *efs;
1161 int i;
1162
1163 for (i = 0; i <= MVPP2_N_RFS_RULES; i++) {
> 1164 efs = port->rfs_rules[i];
1165 if (!efs)
1166 continue;
1167 /* Skip the entry we are trying to find the sibling of */
1168 if (efs->rule.loc == rule->loc)
1169 continue;
1170 if (efs->rule.flt_index == rule->flt_index)
1171 return true;
1172 }
1173
1174 return false;
1175 }
1176
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2019-04-21 1:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-19 13:30 [PATCH net-next] net: mvpp2: cls: Add Classification offload support Maxime Chevallier
2019-04-19 22:09 ` David Miller
2019-04-20 10:17 ` Maxime Chevallier
2019-04-21 1:51 ` kbuild test robot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201904210940.fJOE1mJy%lkp@intel.com \
--to=lkp@intel.com \
--cc=antoine.tenart@bootlin.com \
--cc=davem@davemloft.net \
--cc=gregory.clement@bootlin.com \
--cc=kbuild-all@01.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maxime.chevallier@bootlin.com \
--cc=miquel.raynal@bootlin.com \
--cc=mw@semihalf.com \
--cc=nadavh@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=stefanc@marvell.com \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).