tree:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: e7b08814b16b80a0bf76eeca16317f8c2ed23b8c
commit: 86b956de119c09818d0aabaf668280d8e4bd0d4b [3191/14131] net: mscc: ocelot: support
matching on EtherType
:::::: branch date: 3 days ago
:::::: commit date: 6 weeks ago
config: openrisc-randconfig-s031-20200601 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-243-gc100a7ab-dirty
git checkout 86b956de119c09818d0aabaf668280d8e4bd0d4b
# save the attached .config to linux build tree
make W=1 C=1 ARCH=openrisc CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
drivers/net/ethernet/mscc/ocelot_flower.c:184:54: sparse: sparse: incorrect type in
assignment (different base types) @@ expected unsigned short [usertype] @@ got
restricted __be16 [usertype] @@
drivers/net/ethernet/mscc/ocelot_flower.c:184:54: sparse: expected unsigned short
[usertype]
> drivers/net/ethernet/mscc/ocelot_flower.c:184:54: sparse: got
restricted __be16 [usertype]
#
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commi...
git remote add linux-next
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git remote update linux-next
git checkout 86b956de119c09818d0aabaf668280d8e4bd0d4b
vim +184 drivers/net/ethernet/mscc/ocelot_flower.c
fe3490e6107e10 Horatiu Vultur 2019-05-31 48
f9e30088d20016 Pablo Neira Ayuso 2019-07-09 49 static int ocelot_flower_parse(struct
flow_cls_offload *f,
ce6659c55b7dad Vladimir Oltean 2020-02-29 50 struct ocelot_ace_rule *ace)
fe3490e6107e10 Horatiu Vultur 2019-05-31 51 {
f9e30088d20016 Pablo Neira Ayuso 2019-07-09 52 struct flow_rule *rule =
flow_cls_offload_flow_rule(f);
fe3490e6107e10 Horatiu Vultur 2019-05-31 53 struct flow_dissector *dissector =
rule->match.dissector;
86b956de119c09 Vladimir Oltean 2020-04-20 54 u16 proto =
ntohs(f->common.protocol);
86b956de119c09 Vladimir Oltean 2020-04-20 55 bool match_protocol = true;
fe3490e6107e10 Horatiu Vultur 2019-05-31 56
fe3490e6107e10 Horatiu Vultur 2019-05-31 57 if (dissector->used_keys &
fe3490e6107e10 Horatiu Vultur 2019-05-31 58 ~(BIT(FLOW_DISSECTOR_KEY_CONTROL)
|
fe3490e6107e10 Horatiu Vultur 2019-05-31 59 BIT(FLOW_DISSECTOR_KEY_BASIC) |
fe3490e6107e10 Horatiu Vultur 2019-05-31 60 BIT(FLOW_DISSECTOR_KEY_PORTS) |
fe3490e6107e10 Horatiu Vultur 2019-05-31 61 BIT(FLOW_DISSECTOR_KEY_VLAN) |
fe3490e6107e10 Horatiu Vultur 2019-05-31 62
BIT(FLOW_DISSECTOR_KEY_IPV4_ADDRS) |
fe3490e6107e10 Horatiu Vultur 2019-05-31 63
BIT(FLOW_DISSECTOR_KEY_IPV6_ADDRS) |
fe3490e6107e10 Horatiu Vultur 2019-05-31 64
BIT(FLOW_DISSECTOR_KEY_ETH_ADDRS))) {
fe3490e6107e10 Horatiu Vultur 2019-05-31 65 return -EOPNOTSUPP;
fe3490e6107e10 Horatiu Vultur 2019-05-31 66 }
fe3490e6107e10 Horatiu Vultur 2019-05-31 67
fe3490e6107e10 Horatiu Vultur 2019-05-31 68 if (flow_rule_match_key(rule,
FLOW_DISSECTOR_KEY_CONTROL)) {
fe3490e6107e10 Horatiu Vultur 2019-05-31 69 struct flow_match_control match;
fe3490e6107e10 Horatiu Vultur 2019-05-31 70
fe3490e6107e10 Horatiu Vultur 2019-05-31 71 flow_rule_match_control(rule,
&match);
fe3490e6107e10 Horatiu Vultur 2019-05-31 72 }
fe3490e6107e10 Horatiu Vultur 2019-05-31 73
fe3490e6107e10 Horatiu Vultur 2019-05-31 74 if (flow_rule_match_key(rule,
FLOW_DISSECTOR_KEY_ETH_ADDRS)) {
fe3490e6107e10 Horatiu Vultur 2019-05-31 75 struct flow_match_eth_addrs match;
fe3490e6107e10 Horatiu Vultur 2019-05-31 76
fe3490e6107e10 Horatiu Vultur 2019-05-31 77 /* The hw support mac matches only for
MAC_ETYPE key,
fe3490e6107e10 Horatiu Vultur 2019-05-31 78 * therefore if other matches(port,
tcp flags, etc) are added
fe3490e6107e10 Horatiu Vultur 2019-05-31 79 * then just bail out
fe3490e6107e10 Horatiu Vultur 2019-05-31 80 */
fe3490e6107e10 Horatiu Vultur 2019-05-31 81 if ((dissector->used_keys &
fe3490e6107e10 Horatiu Vultur 2019-05-31 82 (BIT(FLOW_DISSECTOR_KEY_ETH_ADDRS)
|
fe3490e6107e10 Horatiu Vultur 2019-05-31 83 BIT(FLOW_DISSECTOR_KEY_BASIC) |
fe3490e6107e10 Horatiu Vultur 2019-05-31 84 BIT(FLOW_DISSECTOR_KEY_CONTROL)))
!=
fe3490e6107e10 Horatiu Vultur 2019-05-31 85 (BIT(FLOW_DISSECTOR_KEY_ETH_ADDRS)
|
fe3490e6107e10 Horatiu Vultur 2019-05-31 86 BIT(FLOW_DISSECTOR_KEY_BASIC) |
fe3490e6107e10 Horatiu Vultur 2019-05-31 87
BIT(FLOW_DISSECTOR_KEY_CONTROL)))
fe3490e6107e10 Horatiu Vultur 2019-05-31 88 return -EOPNOTSUPP;
fe3490e6107e10 Horatiu Vultur 2019-05-31 89
fe3490e6107e10 Horatiu Vultur 2019-05-31 90 if (proto == ETH_P_IP ||
fe3490e6107e10 Horatiu Vultur 2019-05-31 91 proto == ETH_P_IPV6 ||
fe3490e6107e10 Horatiu Vultur 2019-05-31 92 proto == ETH_P_ARP)
fe3490e6107e10 Horatiu Vultur 2019-05-31 93 return -EOPNOTSUPP;
fe3490e6107e10 Horatiu Vultur 2019-05-31 94
fe3490e6107e10 Horatiu Vultur 2019-05-31 95 flow_rule_match_eth_addrs(rule,
&match);
ce6659c55b7dad Vladimir Oltean 2020-02-29 96 ace->type = OCELOT_ACE_TYPE_ETYPE;
ce6659c55b7dad Vladimir Oltean 2020-02-29 97
ether_addr_copy(ace->frame.etype.dmac.value,
fe3490e6107e10 Horatiu Vultur 2019-05-31 98 match.key->dst);
ce6659c55b7dad Vladimir Oltean 2020-02-29 99
ether_addr_copy(ace->frame.etype.smac.value,
fe3490e6107e10 Horatiu Vultur 2019-05-31 100 match.key->src);
ce6659c55b7dad Vladimir Oltean 2020-02-29 101
ether_addr_copy(ace->frame.etype.dmac.mask,
fe3490e6107e10 Horatiu Vultur 2019-05-31 102 match.mask->dst);
ce6659c55b7dad Vladimir Oltean 2020-02-29 103
ether_addr_copy(ace->frame.etype.smac.mask,
fe3490e6107e10 Horatiu Vultur 2019-05-31 104 match.mask->src);
fe3490e6107e10 Horatiu Vultur 2019-05-31 105 goto finished_key_parsing;
fe3490e6107e10 Horatiu Vultur 2019-05-31 106 }
fe3490e6107e10 Horatiu Vultur 2019-05-31 107
fe3490e6107e10 Horatiu Vultur 2019-05-31 108 if (flow_rule_match_key(rule,
FLOW_DISSECTOR_KEY_BASIC)) {
fe3490e6107e10 Horatiu Vultur 2019-05-31 109 struct flow_match_basic match;
fe3490e6107e10 Horatiu Vultur 2019-05-31 110
fe3490e6107e10 Horatiu Vultur 2019-05-31 111 flow_rule_match_basic(rule,
&match);
fe3490e6107e10 Horatiu Vultur 2019-05-31 112 if (ntohs(match.key->n_proto) ==
ETH_P_IP) {
ce6659c55b7dad Vladimir Oltean 2020-02-29 113 ace->type = OCELOT_ACE_TYPE_IPV4;
ce6659c55b7dad Vladimir Oltean 2020-02-29 114 ace->frame.ipv4.proto.value[0] =
fe3490e6107e10 Horatiu Vultur 2019-05-31 115 match.key->ip_proto;
ce6659c55b7dad Vladimir Oltean 2020-02-29 116 ace->frame.ipv4.proto.mask[0] =
fe3490e6107e10 Horatiu Vultur 2019-05-31 117 match.mask->ip_proto;
86b956de119c09 Vladimir Oltean 2020-04-20 118 match_protocol = false;
fe3490e6107e10 Horatiu Vultur 2019-05-31 119 }
fe3490e6107e10 Horatiu Vultur 2019-05-31 120 if (ntohs(match.key->n_proto) ==
ETH_P_IPV6) {
ce6659c55b7dad Vladimir Oltean 2020-02-29 121 ace->type = OCELOT_ACE_TYPE_IPV6;
ce6659c55b7dad Vladimir Oltean 2020-02-29 122 ace->frame.ipv6.proto.value[0] =
fe3490e6107e10 Horatiu Vultur 2019-05-31 123 match.key->ip_proto;
ce6659c55b7dad Vladimir Oltean 2020-02-29 124 ace->frame.ipv6.proto.mask[0] =
fe3490e6107e10 Horatiu Vultur 2019-05-31 125 match.mask->ip_proto;
86b956de119c09 Vladimir Oltean 2020-04-20 126 match_protocol = false;
fe3490e6107e10 Horatiu Vultur 2019-05-31 127 }
fe3490e6107e10 Horatiu Vultur 2019-05-31 128 }
fe3490e6107e10 Horatiu Vultur 2019-05-31 129
fe3490e6107e10 Horatiu Vultur 2019-05-31 130 if (flow_rule_match_key(rule,
FLOW_DISSECTOR_KEY_IPV4_ADDRS) &&
86b956de119c09 Vladimir Oltean 2020-04-20 131 proto == ETH_P_IP) {
fe3490e6107e10 Horatiu Vultur 2019-05-31 132 struct flow_match_ipv4_addrs match;
fe3490e6107e10 Horatiu Vultur 2019-05-31 133 u8 *tmp;
fe3490e6107e10 Horatiu Vultur 2019-05-31 134
fe3490e6107e10 Horatiu Vultur 2019-05-31 135 flow_rule_match_ipv4_addrs(rule,
&match);
ce6659c55b7dad Vladimir Oltean 2020-02-29 136 tmp =
&ace->frame.ipv4.sip.value.addr[0];
fe3490e6107e10 Horatiu Vultur 2019-05-31 137 memcpy(tmp, &match.key->src,
4);
fe3490e6107e10 Horatiu Vultur 2019-05-31 138
ce6659c55b7dad Vladimir Oltean 2020-02-29 139 tmp =
&ace->frame.ipv4.sip.mask.addr[0];
fe3490e6107e10 Horatiu Vultur 2019-05-31 140 memcpy(tmp, &match.mask->src,
4);
fe3490e6107e10 Horatiu Vultur 2019-05-31 141
ce6659c55b7dad Vladimir Oltean 2020-02-29 142 tmp =
&ace->frame.ipv4.dip.value.addr[0];
fe3490e6107e10 Horatiu Vultur 2019-05-31 143 memcpy(tmp, &match.key->dst,
4);
fe3490e6107e10 Horatiu Vultur 2019-05-31 144
ce6659c55b7dad Vladimir Oltean 2020-02-29 145 tmp =
&ace->frame.ipv4.dip.mask.addr[0];
fe3490e6107e10 Horatiu Vultur 2019-05-31 146 memcpy(tmp, &match.mask->dst,
4);
86b956de119c09 Vladimir Oltean 2020-04-20 147 match_protocol = false;
fe3490e6107e10 Horatiu Vultur 2019-05-31 148 }
fe3490e6107e10 Horatiu Vultur 2019-05-31 149
fe3490e6107e10 Horatiu Vultur 2019-05-31 150 if (flow_rule_match_key(rule,
FLOW_DISSECTOR_KEY_IPV6_ADDRS) &&
86b956de119c09 Vladimir Oltean 2020-04-20 151 proto == ETH_P_IPV6) {
fe3490e6107e10 Horatiu Vultur 2019-05-31 152 return -EOPNOTSUPP;
fe3490e6107e10 Horatiu Vultur 2019-05-31 153 }
fe3490e6107e10 Horatiu Vultur 2019-05-31 154
fe3490e6107e10 Horatiu Vultur 2019-05-31 155 if (flow_rule_match_key(rule,
FLOW_DISSECTOR_KEY_PORTS)) {
fe3490e6107e10 Horatiu Vultur 2019-05-31 156 struct flow_match_ports match;
fe3490e6107e10 Horatiu Vultur 2019-05-31 157
fe3490e6107e10 Horatiu Vultur 2019-05-31 158 flow_rule_match_ports(rule,
&match);
ce6659c55b7dad Vladimir Oltean 2020-02-29 159 ace->frame.ipv4.sport.value =
ntohs(match.key->src);
ce6659c55b7dad Vladimir Oltean 2020-02-29 160 ace->frame.ipv4.sport.mask =
ntohs(match.mask->src);
ce6659c55b7dad Vladimir Oltean 2020-02-29 161 ace->frame.ipv4.dport.value =
ntohs(match.key->dst);
ce6659c55b7dad Vladimir Oltean 2020-02-29 162 ace->frame.ipv4.dport.mask =
ntohs(match.mask->dst);
86b956de119c09 Vladimir Oltean 2020-04-20 163 match_protocol = false;
fe3490e6107e10 Horatiu Vultur 2019-05-31 164 }
fe3490e6107e10 Horatiu Vultur 2019-05-31 165
fe3490e6107e10 Horatiu Vultur 2019-05-31 166 if (flow_rule_match_key(rule,
FLOW_DISSECTOR_KEY_VLAN)) {
fe3490e6107e10 Horatiu Vultur 2019-05-31 167 struct flow_match_vlan match;
fe3490e6107e10 Horatiu Vultur 2019-05-31 168
fe3490e6107e10 Horatiu Vultur 2019-05-31 169 flow_rule_match_vlan(rule,
&match);
ce6659c55b7dad Vladimir Oltean 2020-02-29 170 ace->type = OCELOT_ACE_TYPE_ANY;
ce6659c55b7dad Vladimir Oltean 2020-02-29 171 ace->vlan.vid.value =
match.key->vlan_id;
ce6659c55b7dad Vladimir Oltean 2020-02-29 172 ace->vlan.vid.mask =
match.mask->vlan_id;
ce6659c55b7dad Vladimir Oltean 2020-02-29 173 ace->vlan.pcp.value[0] =
match.key->vlan_priority;
ce6659c55b7dad Vladimir Oltean 2020-02-29 174 ace->vlan.pcp.mask[0] =
match.mask->vlan_priority;
86b956de119c09 Vladimir Oltean 2020-04-20 175 match_protocol = false;
fe3490e6107e10 Horatiu Vultur 2019-05-31 176 }
fe3490e6107e10 Horatiu Vultur 2019-05-31 177
fe3490e6107e10 Horatiu Vultur 2019-05-31 178 finished_key_parsing:
86b956de119c09 Vladimir Oltean 2020-04-20 179 if (match_protocol && proto !=
ETH_P_ALL) {
86b956de119c09 Vladimir Oltean 2020-04-20 180 /* TODO: support SNAP, LLC etc */
86b956de119c09 Vladimir Oltean 2020-04-20 181 if (proto < ETH_P_802_3_MIN)
86b956de119c09 Vladimir Oltean 2020-04-20 182 return -EOPNOTSUPP;
86b956de119c09 Vladimir Oltean 2020-04-20 183 ace->type = OCELOT_ACE_TYPE_ETYPE;
86b956de119c09 Vladimir Oltean 2020-04-20 @184 *(u16
*)ace->frame.etype.etype.value = htons(proto);
86b956de119c09 Vladimir Oltean 2020-04-20 185 *(u16 *)ace->frame.etype.etype.mask
= 0xffff;
86b956de119c09 Vladimir Oltean 2020-04-20 186 }
86b956de119c09 Vladimir Oltean 2020-04-20 187 /* else, a rule of type
OCELOT_ACE_TYPE_ANY is implicitly added */
86b956de119c09 Vladimir Oltean 2020-04-20 188
ce6659c55b7dad Vladimir Oltean 2020-02-29 189 ace->prio = f->common.prio;
ce6659c55b7dad Vladimir Oltean 2020-02-29 190 ace->id = f->cookie;
ce6659c55b7dad Vladimir Oltean 2020-02-29 191 return ocelot_flower_parse_action(f,
ace);
fe3490e6107e10 Horatiu Vultur 2019-05-31 192 }
fe3490e6107e10 Horatiu Vultur 2019-05-31 193
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org