sfc: support offloading TC VLAN push/pop actions to the MAE
Subsystems (3)
PATCH v3 1/1 sfc: support offloading TC VLAN push/pop actions to the MAE
From: Edward Cree <[email protected]>
EF100 can pop and/or push up to two VLAN tags.
---
Changed in v3:
* used VLAN_VID_MASK and VLAN_PRIO_SHIFT instead of raw constants (Simon)
* stopped checkpatch complaining about long lines (Simon, Martin)
Changed in v2: reworked act->vlan_push/pop to be counts rather than bitmasks,
and simplified the corresponding efx_tc_action_order handling.
drivers/net/ethernet/sfc/mae.c | 16 +++++++++++++ drivers/net/ethernet/sfc/mcdi.h | 5 ++++ drivers/net/ethernet/sfc/tc.c | 42 +++++++++++++++++++++++++++++++++ drivers/net/ethernet/sfc/tc.h | 4 ++++ 4 files changed, 67 insertions(+)
drivers/net/ethernet/sfc/mae.c +16 -0
@@ -682,6 +682,10 @@ int efx_mae_alloc_action_set(struct efx_nic *efx, struct efx_tc_action_set *act)size_t outlen;int rc; +MCDI_POPULATE_DWORD_2 (inbuf,MAE_ACTION_SET_ALLOC_IN_FLAGS , +MAE_ACTION_SET_ALLOC_IN_VLAN_PUSH , act->vlan_push, +MAE_ACTION_SET_ALLOC_IN_VLAN_POP , act->vlan_pop); +MCDI_SET_DWORD (inbuf,MAE_ACTION_SET_ALLOC_IN_SRC_MAC_ID ,MC_CMD_MAE_MAC_ADDR_ALLOC_OUT_MAC_ID_NULL ); MCDI_SET_DWORD(inbuf, MAE_ACTION_SET_ALLOC_IN_DST_MAC_ID,
@@ -694,6 +698,18 @@ int efx_mae_alloc_action_set(struct efx_nic *efx, struct efx_tc_action_set *act) MC_CMD_MAE_COUNTER_ALLOC_OUT_COUNTER_ID_NULL);MCDI_SET_DWORD (inbuf,MAE_ACTION_SET_ALLOC_IN_COUNTER_LIST_ID ,MC_CMD_MAE_COUNTER_LIST_ALLOC_OUT_COUNTER_LIST_ID_NULL ); +if (act->vlan_push) { +MCDI_SET_WORD_BE (inbuf,MAE_ACTION_SET_ALLOC_IN_VLAN0_TCI_BE , + act->vlan_tci[0 ]); +MCDI_SET_WORD_BE (inbuf,MAE_ACTION_SET_ALLOC_IN_VLAN0_PROTO_BE , + act->vlan_proto[0 ]); + } +if (act->vlan_push >=2 ) { +MCDI_SET_WORD_BE (inbuf,MAE_ACTION_SET_ALLOC_IN_VLAN1_TCI_BE , + act->vlan_tci[1 ]); +MCDI_SET_WORD_BE (inbuf,MAE_ACTION_SET_ALLOC_IN_VLAN1_PROTO_BE , + act->vlan_proto[1 ]); + }MCDI_SET_DWORD (inbuf,MAE_ACTION_SET_ALLOC_IN_ENCAP_HEADER_ID ,MC_CMD_MAE_ENCAP_HEADER_ALLOC_OUT_ENCAP_HEADER_ID_NULL );if (act->deliver)
drivers/net/ethernet/sfc/mcdi.h +5 -0
@@ -233,6 +233,11 @@ void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev); ((void)BUILD_BUG_ON_ZERO(_field ## _LEN != 2), \ le16_to_cpu(*(__force const __le16 *)MCDI_STRUCT_PTR(_buf, _field))) /* Write a 16-bit field defined in the protocol as being big-endian. */ +#define MCDI_SET_WORD_BE (_buf, _field, _value) do { \ + BUILD_BUG_ON(MC_CMD_ ## _field ## _LEN != 2); \ + BUILD_BUG_ON(MC_CMD_ ## _field ## _OFST & 1); \ + *(__force __be16 *)MCDI_PTR(_buf, _field) = (_value); \ + } while (0)#define MCDI_STRUCT_SET_WORD_BE (_buf, _field, _value) do { \ BUILD_BUG_ON(_field ## _LEN != 2); \ BUILD_BUG_ON(_field ## _OFST & 1); \
drivers/net/ethernet/sfc/tc.c +42 -0
66 lines not on this page · raw message
drivers/net/ethernet/sfc/tc.h +4 -0
@@ -19,7 +19,11 @@#define IS_ALL_ONES (v) (!(typeof (v))~(v))struct efx_tc_action_set { +u16 vlan_push:2 ; +u16 vlan_pop:2 ;u16 deliver:1 ; +__be16 vlan_tci[2 ];/* TCIs for vlan_push */ +__be16 vlan_proto[2 ];/* Ethertypes for vlan_push */ struct efx_tc_counter_index *count;u32 dest_mport;u32 fw_id;/* index of this entry in firmware actions table */
Quoted 5 lines · On Thu, Mar 09, 2023 at 11:59:04AM +0000, [email protected] wrote:
From: Edward Cree <[email protected]>
EF100 can pop and/or push up to two VLAN tags.
Signed-off-by Edward Cree <[email protected]>
Quoted 4 lines
---
Changed in v3:
* usedVLAN_VID_MASKandVLAN_PRIO_SHIFTinstead of raw constants (Simon)
* stopped checkpatch complaining about long lines (Simon, Martin)
Thanks.
...
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 5 lines · On Thu, 9 Mar 2023 11:59:04 +0000 you wrote:
From: Edward Cree <[email protected]>
EF100 can pop and/or push up to two VLAN tags.
Signed-off-by Edward Cree <[email protected]>
Quoted 8 lines
---
Changed in v3:
* usedVLAN_VID_MASKandVLAN_PRIO_SHIFTinstead of raw constants (Simon)
* stopped checkpatch complaining about long lines (Simon, Martin)
Changed in v2: reworked act->vlan_push/pop to be counts rather than bitmasks,
and simplified the correspondingefx_tc_action_orderhandling.[...]
Here is the summary with links:
- [v3,net-next] sfc: support offloading TC VLAN push/pop actions to the MAE
https://git.kernel.org/netdev/net-next/c/05ccd8d8a15e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html