diff options
author | Petr Machata <petrm@mellanox.com> | 2020-03-19 15:47:22 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-03-19 21:09:20 -0700 |
commit | 4d745f8cf5ad8ac4e199a11ea2ed826299c77ca3 (patch) | |
tree | 1304658c6c7a1b8dc97634e926935188fae8c07f /drivers/net/ethernet/mellanox/mlxsw | |
parent | net: tc_skbedit: Make the skbedit priority offloadable (diff) | |
download | wireguard-linux-4d745f8cf5ad8ac4e199a11ea2ed826299c77ca3.tar.xz wireguard-linux-4d745f8cf5ad8ac4e199a11ea2ed826299c77ca3.zip |
mlxsw: core: Add QOS_ACTION
The QOS_ACTION is used for manipulating the QoS attributes of a packet.
Add the corresponding defines and helpers, in particular for the
switch_priority override.
Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c index 1f2e6db743e1..fbb76377adf8 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c @@ -1238,6 +1238,41 @@ err_append_allocated_mirror: } EXPORT_SYMBOL(mlxsw_afa_block_append_mirror); +/* QoS Action + * ---------- + * The QOS_ACTION is used for manipulating the QoS attributes of a packet. It + * can be used to change the DCSP, ECN, Color and Switch Priority of the packet. + * Note that PCP field can be changed using the VLAN action. + */ + +#define MLXSW_AFA_QOS_CODE 0x06 +#define MLXSW_AFA_QOS_SIZE 1 + +enum mlxsw_afa_qos_cmd { + /* Do nothing */ + MLXSW_AFA_QOS_CMD_NOP, + /* Set a field */ + MLXSW_AFA_QOS_CMD_SET, +}; + +/* afa_qos_switch_prio_cmd + * Switch Priority command as per mlxsw_afa_qos_cmd. + */ +MLXSW_ITEM32(afa, qos, switch_prio_cmd, 0x08, 14, 2); + +/* afa_qos_switch_prio + * Switch Priority. + */ +MLXSW_ITEM32(afa, qos, switch_prio, 0x08, 0, 4); + +static inline void +mlxsw_afa_qos_switch_prio_pack(char *payload, + enum mlxsw_afa_qos_cmd prio_cmd, u8 prio) +{ + mlxsw_afa_qos_switch_prio_cmd_set(payload, prio_cmd); + mlxsw_afa_qos_switch_prio_set(payload, prio); +} + /* Forwarding Action * ----------------- * Forwarding Action can be used to implement Policy Based Switching (PBS) |