net/bnxt: support clear on read

Add clear on read stats support for Thor. Currently, the
flow stats are not cleared after they are read from the FW.
This patch adds support for clear on read. Since clear on
read support is added for flow stats in Thor, the flow
accumulation is enabled on Thor as well.

Signed-off-by: Farah Smith <farah.smith@broadcom.com>
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Shahaji Bhosle <sbhosle@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
This commit is contained in:
Farah Smith 2021-11-02 17:52:35 -07:00 committed by Ajit Khaparde
parent a738cbfe0d
commit 06d1a5d056
5 changed files with 41 additions and 11 deletions

View File

@ -1851,7 +1851,8 @@ tf_msg_get_tbl_entry(struct tf *tfp,
uint16_t hcapi_type, uint16_t hcapi_type,
uint16_t size, uint16_t size,
uint8_t *data, uint8_t *data,
uint32_t index) uint32_t index,
bool clear_on_read)
{ {
int rc; int rc;
struct hwrm_tf_tbl_type_get_input req = { 0 }; struct hwrm_tf_tbl_type_get_input req = { 0 };
@ -1860,6 +1861,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
uint8_t fw_session_id; uint8_t fw_session_id;
struct tf_dev_info *dev; struct tf_dev_info *dev;
struct tf_session *tfs; struct tf_session *tfs;
uint32_t flags = 0;
/* Retrieve the session information */ /* Retrieve the session information */
rc = tf_session_get_session_internal(tfp, &tfs); rc = tf_session_get_session_internal(tfp, &tfs);
@ -1889,10 +1891,16 @@ tf_msg_get_tbl_entry(struct tf *tfp,
strerror(-rc)); strerror(-rc));
return rc; return rc;
} }
flags = (dir == TF_DIR_TX ?
HWRM_TF_TBL_TYPE_GET_INPUT_FLAGS_DIR_TX :
HWRM_TF_TBL_TYPE_GET_INPUT_FLAGS_DIR_RX);
if (clear_on_read)
flags |= HWRM_TF_TBL_TYPE_GET_INPUT_FLAGS_CLEAR_ON_READ;
/* Populate the request */ /* Populate the request */
req.fw_session_id = tfp_cpu_to_le_32(fw_session_id); req.fw_session_id = tfp_cpu_to_le_32(fw_session_id);
req.flags = tfp_cpu_to_le_16(dir); req.flags = tfp_cpu_to_le_16(flags);
req.type = tfp_cpu_to_le_32(hcapi_type); req.type = tfp_cpu_to_le_32(hcapi_type);
req.index = tfp_cpu_to_le_32(index); req.index = tfp_cpu_to_le_32(index);
@ -2105,7 +2113,8 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
uint32_t starting_idx, uint32_t starting_idx,
uint16_t num_entries, uint16_t num_entries,
uint16_t entry_sz_in_bytes, uint16_t entry_sz_in_bytes,
uint64_t physical_mem_addr) uint64_t physical_mem_addr,
bool clear_on_read)
{ {
int rc; int rc;
struct tfp_send_msg_parms parms = { 0 }; struct tfp_send_msg_parms parms = { 0 };
@ -2115,6 +2124,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
uint8_t fw_session_id; uint8_t fw_session_id;
struct tf_dev_info *dev; struct tf_dev_info *dev;
struct tf_session *tfs; struct tf_session *tfs;
uint32_t flags = 0;
/* Retrieve the session information */ /* Retrieve the session information */
rc = tf_session_get_session(tfp, &tfs); rc = tf_session_get_session(tfp, &tfs);
@ -2144,10 +2154,16 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
strerror(-rc)); strerror(-rc));
return rc; return rc;
} }
flags = (dir == TF_DIR_TX ?
HWRM_TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_DIR_TX :
HWRM_TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_DIR_RX);
if (clear_on_read)
flags |= HWRM_TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_CLEAR_ON_READ;
/* Populate the request */ /* Populate the request */
req.fw_session_id = tfp_cpu_to_le_32(fw_session_id); req.fw_session_id = tfp_cpu_to_le_32(fw_session_id);
req.flags = tfp_cpu_to_le_16(dir); req.flags = tfp_cpu_to_le_16(flags);
req.type = tfp_cpu_to_le_32(hcapi_type); req.type = tfp_cpu_to_le_32(hcapi_type);
req.start_index = tfp_cpu_to_le_32(starting_idx); req.start_index = tfp_cpu_to_le_32(starting_idx);
req.num_entries = tfp_cpu_to_le_32(num_entries); req.num_entries = tfp_cpu_to_le_32(num_entries);

View File

@ -652,7 +652,8 @@ int tf_msg_get_tbl_entry(struct tf *tfp,
uint16_t hcapi_type, uint16_t hcapi_type,
uint16_t size, uint16_t size,
uint8_t *data, uint8_t *data,
uint32_t index); uint32_t index,
bool clear_on_read);
/* HWRM Tunneled messages */ /* HWRM Tunneled messages */
@ -704,7 +705,8 @@ int tf_msg_bulk_get_tbl_entry(struct tf *tfp,
uint32_t starting_idx, uint32_t starting_idx,
uint16_t num_entries, uint16_t num_entries,
uint16_t entry_sz_in_bytes, uint16_t entry_sz_in_bytes,
uint64_t physical_mem_addr); uint64_t physical_mem_addr,
bool clear_on_read);
/** /**
* Sends Set message of a IF Table Type element to the firmware. * Sends Set message of a IF Table Type element to the firmware.

View File

@ -441,7 +441,8 @@ tf_tbl_get(struct tf *tfp,
hcapi_type, hcapi_type,
parms->data_sz_in_bytes, parms->data_sz_in_bytes,
parms->data, parms->data,
parms->idx); parms->idx,
false);
if (rc) { if (rc) {
TFP_DRV_LOG(ERR, TFP_DRV_LOG(ERR,
"%s, Get failed, type:%s, rc:%s\n", "%s, Get failed, type:%s, rc:%s\n",
@ -526,7 +527,8 @@ tf_tbl_bulk_get(struct tf *tfp,
parms->starting_idx, parms->starting_idx,
parms->num_entries, parms->num_entries,
parms->entry_sz_in_bytes, parms->entry_sz_in_bytes,
parms->physical_mem_addr); parms->physical_mem_addr,
false);
if (rc) { if (rc) {
TFP_DRV_LOG(ERR, TFP_DRV_LOG(ERR,
"%s, Bulk get failed, type:%s, rc:%s\n", "%s, Bulk get failed, type:%s, rc:%s\n",

View File

@ -539,6 +539,7 @@ tf_tbl_sram_get(struct tf *tfp,
struct tf_tbl_sram_get_info_parms iparms = { 0 }; struct tf_tbl_sram_get_info_parms iparms = { 0 };
struct tf_sram_mgr_is_allocated_parms aparms = { 0 }; struct tf_sram_mgr_is_allocated_parms aparms = { 0 };
void *sram_handle = NULL; void *sram_handle = NULL;
bool clear_on_read = false;
TF_CHECK_PARMS3(tfp, parms, parms->data); TF_CHECK_PARMS3(tfp, parms, parms->data);
@ -608,6 +609,8 @@ tf_tbl_sram_get(struct tf *tfp,
strerror(-rc)); strerror(-rc));
return rc; return rc;
} }
if (parms->type == TF_TBL_TYPE_ACT_STATS_64)
clear_on_read = true;
/* Get the entry */ /* Get the entry */
rc = tf_msg_get_tbl_entry(tfp, rc = tf_msg_get_tbl_entry(tfp,
@ -615,7 +618,8 @@ tf_tbl_sram_get(struct tf *tfp,
hcapi_type, hcapi_type,
parms->data_sz_in_bytes, parms->data_sz_in_bytes,
parms->data, parms->data,
parms->idx); parms->idx,
clear_on_read);
if (rc) { if (rc) {
TFP_DRV_LOG(ERR, TFP_DRV_LOG(ERR,
"%s, Get failed, type:%s, rc:%s\n", "%s, Get failed, type:%s, rc:%s\n",
@ -643,6 +647,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
struct tf_sram_mgr_is_allocated_parms aparms = { 0 }; struct tf_sram_mgr_is_allocated_parms aparms = { 0 };
bool allocated = false; bool allocated = false;
void *sram_handle = NULL; void *sram_handle = NULL;
bool clear_on_read = false;
TF_CHECK_PARMS2(tfp, parms); TF_CHECK_PARMS2(tfp, parms);
@ -728,6 +733,9 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
return rc; return rc;
} }
if (parms->type == TF_TBL_TYPE_ACT_STATS_64)
clear_on_read = true;
/* Get the entries */ /* Get the entries */
rc = tf_msg_bulk_get_tbl_entry(tfp, rc = tf_msg_bulk_get_tbl_entry(tfp,
parms->dir, parms->dir,
@ -735,7 +743,8 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
parms->starting_idx, parms->starting_idx,
parms->num_entries, parms->num_entries,
parms->entry_sz_in_bytes, parms->entry_sz_in_bytes,
parms->physical_mem_addr); parms->physical_mem_addr,
clear_on_read);
if (rc) { if (rc) {
TFP_DRV_LOG(ERR, TFP_DRV_LOG(ERR,
"%s, Bulk get failed, type:%s, rc:%s\n", "%s, Bulk get failed, type:%s, rc:%s\n",

View File

@ -1483,7 +1483,8 @@ bnxt_ulp_port_init(struct bnxt *bp)
goto jump_to_error; goto jump_to_error;
} }
if (devid != BNXT_ULP_DEVICE_ID_THOR && BNXT_ACCUM_STATS_EN(bp)) /* set the accumulation of the stats */
if (BNXT_ACCUM_STATS_EN(bp))
bp->ulp_ctx->cfg_data->accum_stats = true; bp->ulp_ctx->cfg_data->accum_stats = true;
BNXT_TF_DBG(DEBUG, "BNXT Port:%d ULP port init, accum_stats:%d\n", BNXT_TF_DBG(DEBUG, "BNXT Port:%d ULP port init, accum_stats:%d\n",