| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | From 551cd6add98fb3bde24ee8e4ffa76aec9fd9d40c Mon Sep 17 00:00:00 2001 |
| 2 | From: Bogdan Purcareata <bogdan.purcareata@nxp.com> |
| 3 | Date: Mon, 2 Oct 2017 14:45:56 +0000 |
| 4 | Subject: [PATCH] dpaa2-eth: Add API for ceetm_id + tc in set congestion |
| 5 | |
| 6 | Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com> |
| 7 | --- |
| 8 | drivers/net/ethernet/freescale/dpaa2/dpni.c | 15 ++++++++++++--- |
| 9 | drivers/net/ethernet/freescale/dpaa2/dpni.h | 6 ++++++ |
| 10 | 2 files changed, 18 insertions(+), 3 deletions(-) |
| 11 | |
| 12 | --- a/drivers/net/ethernet/freescale/dpaa2/dpni.c |
| 13 | +++ b/drivers/net/ethernet/freescale/dpaa2/dpni.c |
| 14 | @@ -1448,7 +1448,10 @@ int dpni_set_rx_tc_dist(struct fsl_mc_io |
| 15 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
| 16 | * @token: Token of DPNI object |
| 17 | * @qtype: Type of queue - Rx, Tx and Tx confirm types are supported |
| 18 | - * @tc_id: Traffic class selection (0-7) |
| 19 | + * @tc_id: bits 7-4 contain ceetm channel index (valid only for TX); |
| 20 | + * bits 3-0 contain traffic class. |
| 21 | + * Use macro DPNI_BUILD_CH_TC() to build correct value for |
| 22 | + * tc_id parameter |
| 23 | * @cfg: Congestion notification configuration |
| 24 | * |
| 25 | * Return: '0' on Success; error code otherwise. |
| 26 | @@ -1674,7 +1677,10 @@ int dpni_reset_statistics(struct fsl_mc_ |
| 27 | * @cg_point: Congestion point |
| 28 | * @q_type: Queue type on which the taildrop is configured. |
| 29 | * Only Rx queues are supported for now |
| 30 | - * @tc: Traffic class to apply this taildrop to |
| 31 | + * @tc: bits 7-4 contain ceetm channel index (valid only for TX); |
| 32 | + * bits 3-0 contain traffic class. |
| 33 | + * Use macro DPNI_BUILD_CH_TC() to build correct value for |
| 34 | + * tc parameter. |
| 35 | * @q_index: Index of the queue if the DPNI supports multiple queues for |
| 36 | * traffic distribution. Ignored if CONGESTION_POINT is not 0. |
| 37 | * @taildrop: Taildrop structure |
| 38 | @@ -1718,7 +1724,10 @@ int dpni_set_taildrop(struct fsl_mc_io * |
| 39 | * @cg_point: Congestion point |
| 40 | * @q_type: Queue type on which the taildrop is configured. |
| 41 | * Only Rx queues are supported for now |
| 42 | - * @tc: Traffic class to apply this taildrop to |
| 43 | + * @tc: bits 7-4 contain ceetm channel index (valid only for TX); |
| 44 | + * bits 3-0 contain traffic class. |
| 45 | + * Use macro DPNI_BUILD_CH_TC() to build correct value for |
| 46 | + * tc parameter. |
| 47 | * @q_index: Index of the queue if the DPNI supports multiple queues for |
| 48 | * traffic distribution. Ignored if CONGESTION_POINT is not 0. |
| 49 | * @taildrop: Taildrop structure |
| 50 | --- a/drivers/net/ethernet/freescale/dpaa2/dpni.h |
| 51 | +++ b/drivers/net/ethernet/freescale/dpaa2/dpni.h |
| 52 | @@ -996,6 +996,12 @@ struct dpni_congestion_notification_cfg |
| 53 | u16 notification_mode; |
| 54 | }; |
| 55 | |
| 56 | +/** Compose TC parameter for function dpni_set_congestion_notification() |
| 57 | + * and dpni_get_congestion_notification(). |
| 58 | + */ |
| 59 | +#define DPNI_BUILD_CH_TC(ceetm_ch_idx, tc) \ |
| 60 | + ((((ceetm_ch_idx) & 0x0F) << 4) | ((tc) & 0x0F)) |
| 61 | + |
| 62 | int dpni_set_congestion_notification( |
| 63 | struct fsl_mc_io *mc_io, |
| 64 | u32 cmd_flags, |