mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 21:24:52 +07:00
cxgb4: add tc flower match support for vlan
Add support for matching on vlan tci. Construct vlan tci match param based on vlan-id and vlan-pcp values supplied by tc. Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
bda1e22915
commit
ad9af3e09c
@ -160,6 +160,40 @@ static void cxgb4_process_flow_match(struct net_device *dev,
|
||||
fs->mask.tos = mask->tos;
|
||||
}
|
||||
|
||||
if (dissector_uses_key(cls->dissector, FLOW_DISSECTOR_KEY_VLAN)) {
|
||||
struct flow_dissector_key_vlan *key, *mask;
|
||||
u16 vlan_tci, vlan_tci_mask;
|
||||
|
||||
key = skb_flow_dissector_target(cls->dissector,
|
||||
FLOW_DISSECTOR_KEY_VLAN,
|
||||
cls->key);
|
||||
mask = skb_flow_dissector_target(cls->dissector,
|
||||
FLOW_DISSECTOR_KEY_VLAN,
|
||||
cls->mask);
|
||||
vlan_tci = key->vlan_id | (key->vlan_priority <<
|
||||
VLAN_PRIO_SHIFT);
|
||||
vlan_tci_mask = mask->vlan_id | (mask->vlan_priority <<
|
||||
VLAN_PRIO_SHIFT);
|
||||
fs->val.ivlan = cpu_to_be16(vlan_tci);
|
||||
fs->mask.ivlan = cpu_to_be16(vlan_tci_mask);
|
||||
|
||||
/* Chelsio adapters use ivlan_vld bit to match vlan packets
|
||||
* as 802.1Q. Also, when vlan tag is present in packets,
|
||||
* ethtype match is used then to match on ethtype of inner
|
||||
* header ie. the header following the vlan header.
|
||||
* So, set the ivlan_vld based on ethtype info supplied by
|
||||
* TC for vlan packets if its 802.1Q. And then reset the
|
||||
* ethtype value else, hw will try to match the supplied
|
||||
* ethtype value with ethtype of inner header.
|
||||
*/
|
||||
if (fs->val.ethtype == ETH_P_8021Q) {
|
||||
fs->val.ivlan_vld = 1;
|
||||
fs->mask.ivlan_vld = 1;
|
||||
fs->val.ethtype = 0;
|
||||
fs->mask.ethtype = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Match only packets coming from the ingress port where this
|
||||
* filter will be created.
|
||||
*/
|
||||
@ -179,6 +213,7 @@ static int cxgb4_validate_flow_match(struct net_device *dev,
|
||||
BIT(FLOW_DISSECTOR_KEY_IPV4_ADDRS) |
|
||||
BIT(FLOW_DISSECTOR_KEY_IPV6_ADDRS) |
|
||||
BIT(FLOW_DISSECTOR_KEY_PORTS) |
|
||||
BIT(FLOW_DISSECTOR_KEY_VLAN) |
|
||||
BIT(FLOW_DISSECTOR_KEY_IP))) {
|
||||
netdev_warn(dev, "Unsupported key used: 0x%x\n",
|
||||
cls->dissector->used_keys);
|
||||
|
Loading…
Reference in New Issue
Block a user