]> git.baikalelectronics.ru Git - kernel.git/commit
net/mlx5e: Add parsing of TC pedit actions to HW format
authorOr Gerlitz <ogerlitz@mellanox.com>
Sun, 22 Jan 2017 18:46:42 +0000 (20:46 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Tue, 28 Mar 2017 12:34:07 +0000 (15:34 +0300)
commit0a1fcdab07068389f97bd2f39b3f17a0fdbbcbfc
tree52b96de4a89979b53e90daf672dd21081fdc1c78
parent7d249d3992961c9c4f1852b4002fbc31e3fba01f
net/mlx5e: Add parsing of TC pedit actions to HW format

Parse/translate a set of TC pedit actions to be formed in the HW API format.

User-space provides set of keys where each one of them is made of: command (add or
set), header-type, byte offset within that header along with a 32 bit mask and value.

The mask dictates what bits in the 32 bit word that starts on the offset we should
be dealing with, but under negative polarity (unset bits are to be modified).

We do a 1st pass over the set of keys while using the header-type and offset to
fill the masks and the values into a data-structure containting all the
supported network headers.

We then do a 2nd pass over the set of fields to re-write supported by the HW,
where for each such candidate field, we use the masks filled on the 1st pass to
realize if we should offloading re-write it.

In case offloading is required, we fill a HW descriptor with the following:

(1) the header field to modify
(2) the bit offset within the field from where to modify (set command only)
(3) the value to set/add
(4) the length in bits 1...32 to modify (set command only)

Note that it's possible for a given pedit mask to dictate modifying the
same header field multiple times or to modify multiple header fields.
Currently such combinations are not supported for offloading, hence, for set
commands, the offset within the field is always zero, and the length to modify
is the field size.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Amir Vadai <amir@vadai.me>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c