Add support for configure CBS through TC

Issue: New feature requirement to have
CBS configuration through TC

Fix: added support for same.

sudo tc qdisc add dev eth4 parent root handle 6666 mqprio \
        num_tc 3 \
        map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
        queues 1@0 1@1 2@2 \
        hw 0
sudo tc qdisc replace dev eth4 parent 6666:3 cbs \
        idleslope 2000000 sendslope -8000000 hicredit 3000 locredit -1200 \
        offload 1

Bug  200776994

Change-Id: Id83b967bcbbb18201f2757987ab1cefe63b4ad8d
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2649428
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Rakesh Goyal
2022-01-04 15:32:08 +05:30
committed by Revanth Kumar Uppala
parent ad01764abb
commit dbf00db6bb
3 changed files with 109 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -73,6 +73,13 @@
#include <net/udp.h>
#endif /* ETHER_NVGRO */
/**
* @brief Constant for CBS value calculate
*/
#define ETH_1K 1000
#define MULTIPLIER_32 32
#define MULTIPLIER_8 8
#define MULTIPLIER_4 4
/**
* @brief Max number of Ethernet IRQs supported in HW
*/
@@ -758,6 +765,24 @@ void ether_set_rx_mode(struct net_device *dev);
*/
int ether_tc_setup_taprio(struct ether_priv_data *pdata,
struct tc_taprio_qopt_offload *qopt);
/**
* @brief Function to configure credit base shapper
*
* Algorithm: This function is used to handle the hardware CBS
* settings.
*
* @param[in] pdata: Pointer to private data structure.
* @param[in] qopt: Pointer to qdisc taprio offload data.
*
* @note MAC interface should be up.
*
* @retval 0 on success
* @retval "negative value" on Failure
*/
int ether_tc_setup_cbs(struct ether_priv_data *pdata,
struct tc_cbs_qopt_offload *qopt);
#endif
#ifdef ETHER_NVGRO
void ether_nvgro_purge_timer(struct timer_list *t);