f68f71f3 | 04-Oct-2024 |
Daniel Machon <daniel.machon@microchip.com> |
net: sparx5: add *sparx5 argument to a few functions
The *sparx5 context pointer is required in functions that need to access platform constants (which will be added in a subsequent patch). Prepare
net: sparx5: add *sparx5 argument to a few functions
The *sparx5 context pointer is required in functions that need to access platform constants (which will be added in a subsequent patch). Prepare for this by updating the prototype and use of such functions.
Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
show more ...
|
7a03df01 | 04-Oct-2024 |
Daniel Machon <daniel.machon@microchip.com> |
net: sparx5: modify SPX5_PORTS_ALL macro
In preparation for lan969x, we need to define the SPX5_PORTS_ALL macro as 70 (65 front ports + 5 internal ports). This is required as the SPX5_PORT_CPU will
net: sparx5: modify SPX5_PORTS_ALL macro
In preparation for lan969x, we need to define the SPX5_PORTS_ALL macro as 70 (65 front ports + 5 internal ports). This is required as the SPX5_PORT_CPU will be redefined as an offset to the number of front ports, in a subsequent patch.
Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
show more ...
|
5ba3f846 | 04-Oct-2024 |
Daniel Machon <daniel.machon@microchip.com> |
net: sparx5: add indirection layer to register macros
The register macros are used to read and write to the switch registers. The registers are largely the same on Sparx5 and lan969x, however in som
net: sparx5: add indirection layer to register macros
The register macros are used to read and write to the switch registers. The registers are largely the same on Sparx5 and lan969x, however in some cases they differ. The differences can be one or more of the following: target size, register address, register count, group address, group count, group size, field position, field size.
In order to handle these differences, we introduce a new indirection layer, that defines and maps them to corresponding values, based on the platform. As the register macro arguments can now be non-constants, we also add non-constant variants of FIELD_GET and FIELD_PREP.
Since the indirection layer contributes to longer macros, we have changed the formatting of them slightly, to adhere to a 80 character limit, and added a comment if a macro is platform-specific.
With these additions, we can reuse all the existing macros for lan969x.
Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com> Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
show more ...
|
51152312 | 02-Sep-2024 |
Daniel Machon <daniel.machon@microchip.com> |
net: sparx5: ditch sparx5_fdma_rx/tx_reload() functions
These direction specific functions can be ditched in favor of a single function: sparx5_fdma_reload(), which retrieves the channel id from the
net: sparx5: ditch sparx5_fdma_rx/tx_reload() functions
These direction specific functions can be ditched in favor of a single function: sparx5_fdma_reload(), which retrieves the channel id from the fdma struct instead.
Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com> Reviewed-by: Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
55e84c3c | 02-Sep-2024 |
Daniel Machon <daniel.machon@microchip.com> |
net: sparx5: use contiguous memory for tx buffers
Currently, the driver uses a linked list for storing the tx buffer addresses. This requires a good amount of extra bookkeeping code. Ditch the linke
net: sparx5: use contiguous memory for tx buffers
Currently, the driver uses a linked list for storing the tx buffer addresses. This requires a good amount of extra bookkeeping code. Ditch the linked list in favor of tx buffers being in the same contiguous memory space as the DCB's and the DB's. The FDMA library has a helper for this - so use that.
The tx buffer addresses are now retrieved as an offset into the FDMA memory space.
Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com> Reviewed-by: Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
bb7a60da | 02-Sep-2024 |
Daniel Machon <daniel.machon@microchip.com> |
net: sparx5: use library helper for freeing tx buffers
The library has the helper fdma_free_phys() for freeing physical FDMA memory. Use it in the exit path.
Signed-off-by: Daniel Machon <daniel.ma
net: sparx5: use library helper for freeing tx buffers
The library has the helper fdma_free_phys() for freeing physical FDMA memory. Use it in the exit path.
Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com> Reviewed-by: Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
f4aa7e36 | 02-Sep-2024 |
Daniel Machon <daniel.machon@microchip.com> |
net: sparx5: use FDMA library for adding DCB's in the tx path
Use the fdma_dcb_add() function to add DCB's in the tx path. This gets rid of the open-coding of nextptr and dataptr handling and leaves
net: sparx5: use FDMA library for adding DCB's in the tx path
Use the fdma_dcb_add() function to add DCB's in the tx path. This gets rid of the open-coding of nextptr and dataptr handling and leaves it to the library.
Also, make sure the fdma indexes are advanced using: fdma_dcb_advance(), so that the correct nextptr and dataptr offsets are retrieved.
Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com> Reviewed-by: Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
0a5c4408 | 02-Sep-2024 |
Daniel Machon <daniel.machon@microchip.com> |
net: sparx5: use the FDMA library for allocation of tx buffers
Use the two functions: fdma_alloc_phys() and fdma_dcb_init() for tx buffer allocation and use the new buffers throughout.
In order to
net: sparx5: use the FDMA library for allocation of tx buffers
Use the two functions: fdma_alloc_phys() and fdma_dcb_init() for tx buffer allocation and use the new buffers throughout.
In order to replace the old buffers with the new ones, we have to do the following refactoring:
- use fdma_alloc_phys() and fdma_dcb_init()
- replace the variables: tx->dma, tx->first_entry and tx->curr_entry with the equivalents from the FDMA struct.
- replace uses of sparx5_db_hw and sparx5_tx_dcb_hw with fdma_db and fdma_dcb.
- add sparx5_fdma_tx_dataptr_cb callback for obtaining the dataptr.
- Initialize FDMA struct values.
Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com> Reviewed-by: Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
4ff58c39 | 02-Sep-2024 |
Daniel Machon <daniel.machon@microchip.com> |
net: sparx5: use a few FDMA helpers in the rx path
The library provides helpers for a number of DCB and DB operations. Use these in the rx path.
Signed-off-by: Daniel Machon <daniel.machon@microchi
net: sparx5: use a few FDMA helpers in the rx path
The library provides helpers for a number of DCB and DB operations. Use these in the rx path.
Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com> Reviewed-by: Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
6647f2fd | 02-Sep-2024 |
Daniel Machon <daniel.machon@microchip.com> |
net: sparx5: use library helper for freeing rx buffers
The library has the helper fdma_free_phys() for freeing physical FDMA memory. Use it in the exit path.
Signed-off-by: Daniel Machon <daniel.ma
net: sparx5: use library helper for freeing rx buffers
The library has the helper fdma_free_phys() for freeing physical FDMA memory. Use it in the exit path.
Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com> Reviewed-by: Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
17b95210 | 02-Sep-2024 |
Daniel Machon <daniel.machon@microchip.com> |
net: sparx5: use FDMA library for adding DCB's in the rx path
Use the fdma_dcb_add() function to add DCB's in the rx path. This gets rid of the open-coding of nextptr and dataptr handling and leaves
net: sparx5: use FDMA library for adding DCB's in the rx path
Use the fdma_dcb_add() function to add DCB's in the rx path. This gets rid of the open-coding of nextptr and dataptr handling and leaves it to the library.
Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com> Reviewed-by: Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
8fec1cea | 02-Sep-2024 |
Daniel Machon <daniel.machon@microchip.com> |
net: sparx5: use the FDMA library for allocation of rx buffers
Use the two functions: fdma_alloc_phys() and fdma_dcb_init() for rx buffer allocation and use the new buffers throughout.
In order to
net: sparx5: use the FDMA library for allocation of rx buffers
Use the two functions: fdma_alloc_phys() and fdma_dcb_init() for rx buffer allocation and use the new buffers throughout.
In order to replace the old buffers with the new ones, we have to do the following refactoring:
- use fdma_alloc_phys() and fdma_dcb_init()
- replace the variables: rx->dma, rx->dcb_entries and rx->last_entry with the equivalents from the FDMA struct.
- replace uses of sparx5_db_hw and sparx5_rx_dcb_hw with fdma_db and fdma_dcb.
- add sparx5_fdma_rx_dataptr_cb callback for obtaining the dataptr.
- Initialize FDMA struct values.
Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com> Reviewed-by: Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
e8218f7a | 02-Sep-2024 |
Daniel Machon <daniel.machon@microchip.com> |
net: sparx5: replace a few variables with new equivalent ones
Replace the old rx and tx variables: channel_id, FDMA_DCB_MAX, FDMA_RX_DCB_MAX_DBS, FDMA_TX_DCB_MAX_DBS, dcb_index and db_index with the
net: sparx5: replace a few variables with new equivalent ones
Replace the old rx and tx variables: channel_id, FDMA_DCB_MAX, FDMA_RX_DCB_MAX_DBS, FDMA_TX_DCB_MAX_DBS, dcb_index and db_index with the equivalents from the FDMA rx and tx structs. These variables are not entangled in any buffer allocation and can therefore be replaced in advance.
Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com> Reviewed-by: Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
947a72f4 | 02-Sep-2024 |
Daniel Machon <daniel.machon@microchip.com> |
net: sparx5: use FDMA library symbols
Include and use the new FDMA header, which now provides the required masks and bit offsets for operating on the DCB's and DB's.
Signed-off-by: Daniel Machon <d
net: sparx5: use FDMA library symbols
Include and use the new FDMA header, which now provides the required masks and bit offsets for operating on the DCB's and DB's.
Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com> Reviewed-by: Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
8ef631e9 | 24-Apr-2024 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
net: sparx5: flower: check for unsupported control flags
Use flow_rule_is_supp_control_flags() to reject filters with unsupported control flags.
In case any unsupported control flags are masked, fl
net: sparx5: flower: check for unsupported control flags
Use flow_rule_is_supp_control_flags() to reject filters with unsupported control flags.
In case any unsupported control flags are masked, flow_rule_is_supp_control_flags() sets a NL extended error message, and we return -EOPNOTSUPP.
Only compile-tested.
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Daniel Machon <daniel.machon@microchip.com> Tested-by: Daniel Machon <daniel.machon@microchip.com> Link: https://lore.kernel.org/r/20240424121632.459022-5-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
b92eb1ac | 24-Apr-2024 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
net: sparx5: flower: remove goto in sparx5_tc_flower_handler_control_usage()
Remove goto, as it's only used once, and the error message is specific to that context.
Only compile tested.
Signed-off
net: sparx5: flower: remove goto in sparx5_tc_flower_handler_control_usage()
Remove goto, as it's only used once, and the error message is specific to that context.
Only compile tested.
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Daniel Machon <daniel.machon@microchip.com> Tested-by: Daniel Machon <daniel.machon@microchip.com> Link: https://lore.kernel.org/r/20240424121632.459022-4-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
8cd1b6c0 | 24-Apr-2024 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
net: sparx5: flower: add extack to sparx5_tc_flower_handler_control_usage()
Define extack locally, to reduce line lengths and aid future users.
Only compile tested.
Signed-off-by: Asbjørn Sloth Tø
net: sparx5: flower: add extack to sparx5_tc_flower_handler_control_usage()
Define extack locally, to reduce line lengths and aid future users.
Only compile tested.
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Daniel Machon <daniel.machon@microchip.com> Tested-by: Daniel Machon <daniel.machon@microchip.com> Link: https://lore.kernel.org/r/20240424121632.459022-3-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
bcf303c6 | 24-Apr-2024 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
net: sparx5: flower: only do lookup if fragment flags are set
The fragment lookup should only be performed, when at least one of the fragment flags are set.
This change was deliberately not include
net: sparx5: flower: only do lookup if fragment flags are set
The fragment lookup should only be performed, when at least one of the fragment flags are set.
This change was deliberately not included in commit 68aba00483c7 ("net: sparx5: flower: fix fragment flags handling") as it's only needed for future proffing the code, since "mask" is currently only set in conjunction with the fragment flags. (The 3rd flag FLOW_DIS_ENCAPSULATION is only used with "key")
Only compile tested.
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Daniel Machon <daniel.machon@microchip.com> Tested-by: Daniel Machon <daniel.machon@microchip.com> Link: https://lore.kernel.org/r/20240424121632.459022-2-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|