qcacmn: add HAL APIs to configure FSE in CMEM

Adding HAL APIs for adding and reading flow search entries(FSEs)
in CMEM.

Change-Id: If8282c8be38a85e2344bb55ffa4e63a7577daa20
CRs-Fixed: 2771198
This commit is contained in:
Manikanta Pubbisetty
2020-09-04 18:43:22 +05:30
committed by snandini
parent 1a4e3a96c7
commit 3433cf4974
4 changed files with 323 additions and 53 deletions

View File

@@ -612,6 +612,14 @@ struct hal_hw_txrx_ops {
uint32_t num_rings, uint32_t num_rings,
uint32_t *remap1, uint32_t *remap1,
uint32_t *remap2); uint32_t *remap2);
uint32_t (*hal_rx_flow_setup_cmem_fse)(
struct hal_soc *soc, uint32_t cmem_ba,
uint32_t table_offset, uint8_t *rx_flow);
uint32_t (*hal_rx_flow_get_cmem_fse_ts)(struct hal_soc *soc,
uint32_t fse_offset);
void (*hal_rx_flow_get_cmem_fse)(struct hal_soc *soc,
uint32_t fse_offset,
uint32_t *fse, qdf_size_t len);
}; };
/** /**

View File

@@ -18,7 +18,82 @@
#include "dp_types.h" #include "dp_types.h"
#include "hal_rx_flow.h" #include "hal_rx_flow.h"
/**
* hal_rx_flow_get_cmem_fse() - Get FSE from CMEM
* @hal_soc_hdl: HAL SOC handle
* @fse_offset: CMEM FSE offset
* @fse: referece where FSE will be copied
* @len: length of FSE
*
* Return: If read is succesfull or not
*/
static void
hal_rx_flow_get_cmem_fse(hal_soc_handle_t hal_soc_hdl, uint32_t fse_offset,
uint32_t *fse, qdf_size_t len)
{
struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
if (hal_soc->ops->hal_rx_flow_get_cmem_fse) {
return hal_soc->ops->hal_rx_flow_get_cmem_fse(
hal_soc, fse_offset, fse, len);
}
}
#if defined(WLAN_SUPPORT_RX_FISA) #if defined(WLAN_SUPPORT_RX_FISA)
static inline void hal_rx_dump_fse(struct rx_flow_search_entry *fse, int index)
{
dp_info("index %d:"
" src_ip_127_96 0x%x"
" src_ip_95_640 0x%x"
" src_ip_63_32 0x%x"
" src_ip_31_0 0x%x"
" dest_ip_127_96 0x%x"
" dest_ip_95_64 0x%x"
" dest_ip_63_32 0x%x"
" dest_ip_31_0 0x%x"
" src_port 0x%x"
" dest_port 0x%x"
" l4_protocol 0x%x"
" valid 0x%x"
" reo_destination_indication 0x%x"
" msdu_drop 0x%x"
" reo_destination_handler 0x%x"
" metadata 0x%x"
" aggregation_count0x%x"
" lro_eligible 0x%x"
" msdu_count 0x%x"
" msdu_byte_count 0x%x"
" timestamp 0x%x"
" cumulative_l4_checksum 0x%x"
" cumulative_ip_length 0x%x"
" tcp_sequence_number 0x%x",
index,
fse->src_ip_127_96,
fse->src_ip_95_64,
fse->src_ip_63_32,
fse->src_ip_31_0,
fse->dest_ip_127_96,
fse->dest_ip_95_64,
fse->dest_ip_63_32,
fse->dest_ip_31_0,
fse->src_port,
fse->dest_port,
fse->l4_protocol,
fse->valid,
fse->reo_destination_indication,
fse->msdu_drop,
fse->reo_destination_handler,
fse->metadata,
fse->aggregation_count,
fse->lro_eligible,
fse->msdu_count,
fse->msdu_byte_count,
fse->timestamp,
fse->cumulative_l4_checksum,
fse->cumulative_ip_length,
fse->tcp_sequence_number);
}
void hal_rx_dump_fse_table(struct hal_rx_fst *fst) void hal_rx_dump_fse_table(struct hal_rx_fst *fst)
{ {
int i = 0; int i = 0;
@@ -27,64 +102,33 @@ void hal_rx_dump_fse_table(struct hal_rx_fst *fst)
dp_info("Number flow table entries %d", fst->add_flow_count); dp_info("Number flow table entries %d", fst->add_flow_count);
for (i = 0; i < fst->max_entries; i++) { for (i = 0; i < fst->max_entries; i++) {
if (fse[i].valid) { if (fse[i].valid)
dp_info("index %d:" hal_rx_dump_fse(&fse[i], i);
" src_ip_127_96 0x%x"
" src_ip_95_640 0x%x"
" src_ip_63_32 0x%x"
" src_ip_31_0 0x%x"
" dest_ip_127_96 0x%x"
" dest_ip_95_64 0x%x"
" dest_ip_63_32 0x%x"
" dest_ip_31_0 0x%x"
" src_port 0x%x"
" dest_port 0x%x"
" l4_protocol 0x%x"
" valid 0x%x"
" reo_destination_indication 0x%x"
" msdu_drop 0x%x"
" reo_destination_handler 0x%x"
" metadata 0x%x"
" aggregation_count0x%x"
" lro_eligible 0x%x"
" msdu_count 0x%x"
" msdu_byte_count 0x%x"
" timestamp 0x%x"
" cumulative_l4_checksum 0x%x"
" cumulative_ip_length 0x%x"
" tcp_sequence_number 0x%x",
i,
fse[i].src_ip_127_96,
fse[i].src_ip_95_64,
fse[i].src_ip_63_32,
fse[i].src_ip_31_0,
fse[i].dest_ip_127_96,
fse[i].dest_ip_95_64,
fse[i].dest_ip_63_32,
fse[i].dest_ip_31_0,
fse[i].src_port,
fse[i].dest_port,
fse[i].l4_protocol,
fse[i].valid,
fse[i].reo_destination_indication,
fse[i].msdu_drop,
fse[i].reo_destination_handler,
fse[i].metadata,
fse[i].aggregation_count,
fse[i].lro_eligible,
fse[i].msdu_count,
fse[i].msdu_byte_count,
fse[i].timestamp,
fse[i].cumulative_l4_checksum,
fse[i].cumulative_ip_length,
fse[i].tcp_sequence_number);
}
} }
} }
void hal_rx_dump_cmem_fse(hal_soc_handle_t hal_soc_hdl, uint32_t fse_offset,
int index)
{
struct rx_flow_search_entry fse = {0};
if (!fse_offset)
return;
hal_rx_flow_get_cmem_fse(hal_soc_hdl, fse_offset, (uint32_t *)&fse,
sizeof(struct rx_flow_search_entry));
if (fse.valid)
hal_rx_dump_fse(&fse, index);
}
#else #else
void hal_rx_dump_fse_table(struct hal_rx_fst *fst) void hal_rx_dump_fse_table(struct hal_rx_fst *fst)
{ {
} }
void hal_rx_dump_cmem_fse(hal_soc_handle_t hal_soc_hdl, uint32_t fse_offset,
int index)
{
}
#endif #endif
/** /**
@@ -112,6 +156,52 @@ hal_rx_flow_setup_fse(hal_soc_handle_t hal_soc_hdl,
} }
qdf_export_symbol(hal_rx_flow_setup_fse); qdf_export_symbol(hal_rx_flow_setup_fse);
/**
* hal_rx_flow_setup_cmem_fse() - Setup a flow search entry in HW CMEM FST
* @hal_soc_hdl: HAL SOC handle
* @cmem_ba: CMEM base address
* @table_offset: offset into the table where the flow is to be setup
* @flow: Flow Parameters
*
* Return: Success/Failure
*/
uint32_t
hal_rx_flow_setup_cmem_fse(hal_soc_handle_t hal_soc_hdl, uint32_t cmem_ba,
uint32_t table_offset, struct hal_rx_flow *flow)
{
struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
if (hal_soc->ops->hal_rx_flow_setup_cmem_fse) {
return hal_soc->ops->hal_rx_flow_setup_cmem_fse(
hal_soc, cmem_ba,
table_offset, (uint8_t *)flow);
}
return 0;
}
qdf_export_symbol(hal_rx_flow_setup_cmem_fse);
/**
* hal_rx_flow_get_cmem_fse_timestamp() - Get timestamp field from CMEM FSE
* @hal_soc_hdl: HAL SOC handle
* @fse_offset: CMEM FSE offset
*
* Return: Timestamp
*/
uint32_t hal_rx_flow_get_cmem_fse_timestamp(hal_soc_handle_t hal_soc_hdl,
uint32_t fse_offset)
{
struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
if (hal_soc->ops->hal_rx_flow_get_cmem_fse_ts) {
return hal_soc->ops->hal_rx_flow_get_cmem_fse_ts(hal_soc,
fse_offset);
}
return 0;
}
qdf_export_symbol(hal_rx_flow_get_cmem_fse_timestamp);
/** /**
* hal_rx_flow_delete_entry() - Delete a flow from the Rx Flow Search Table * hal_rx_flow_delete_entry() - Delete a flow from the Rx Flow Search Table
* @fst: Pointer to the Rx Flow Search Table * @fst: Pointer to the Rx Flow Search Table

View File

@@ -78,6 +78,29 @@ hal_rx_flow_setup_fse(hal_soc_handle_t hal_soc_hdl,
struct hal_rx_fst *fst, uint32_t table_offset, struct hal_rx_fst *fst, uint32_t table_offset,
struct hal_rx_flow *flow); struct hal_rx_flow *flow);
/**
* hal_rx_flow_setup_cmem_fse() - Setup a flow search entry in HW CMEM FST
* @hal_soc_hdl: HAL SOC handle
* @cmem_ba: CMEM base address
* @table_offset: offset into the table where the flow is to be setup
* @flow: Flow Parameters
*
* Return: Success/Failure
*/
uint32_t
hal_rx_flow_setup_cmem_fse(hal_soc_handle_t hal_soc_hdl, uint32_t cmem_ba,
uint32_t table_offset, struct hal_rx_flow *flow);
/**
* hal_rx_flow_get_cmem_fse_timestamp() - Get timestamp field from CMEM FSE
* @hal_soc_hdl: HAL SOC handle
* @fse_offset: CMEM FSE offset
*
* Return: Timestamp
*/
uint32_t hal_rx_flow_get_cmem_fse_timestamp(hal_soc_handle_t hal_soc_hdl,
uint32_t fse_offset);
/** /**
* hal_rx_flow_delete_entry() - Delete a flow from the Rx Flow Search Table * hal_rx_flow_delete_entry() - Delete a flow from the Rx Flow Search Table
* @fst: Pointer to the Rx Flow Search Table * @fst: Pointer to the Rx Flow Search Table
@@ -174,4 +197,15 @@ uint32_t
hal_flow_toeplitz_hash(void *hal_fst, struct hal_rx_flow *flow); hal_flow_toeplitz_hash(void *hal_fst, struct hal_rx_flow *flow);
void hal_rx_dump_fse_table(struct hal_rx_fst *fst); void hal_rx_dump_fse_table(struct hal_rx_fst *fst);
/**
* hal_rx_dump_cmem_fse() - Dump flow search table entry which is in CMEM
* @hal_soc_hdl: HAL SOC handle
* @fse_offset: Offset in to the CMEM where FSE is located
* @index: FSE index
*
* Return: None
*/
void hal_rx_dump_cmem_fse(hal_soc_handle_t hal_soc_hdl, uint32_t fse_offset,
int index);
#endif /* HAL_RX_FLOW_H */ #endif /* HAL_RX_FLOW_H */

View File

@@ -1607,6 +1607,139 @@ hal_rx_flow_setup_fse_6750(uint8_t *rx_fst, uint32_t table_offset,
return fse; return fse;
} }
/*
* hal_rx_flow_setup_cmem_fse_6750() - Setup a flow search entry in HW CMEM FST
* @hal_soc: hal_soc reference
* @cmem_ba: CMEM base address
* @table_offset: offset into the table where the flow is to be setup
* @flow: Flow Parameters
*
* Return: Success/Failure
*/
static uint32_t
hal_rx_flow_setup_cmem_fse_6750(struct hal_soc *hal_soc, uint32_t cmem_ba,
uint32_t table_offset, uint8_t *rx_flow)
{
struct hal_rx_flow *flow = (struct hal_rx_flow *)rx_flow;
uint32_t fse_offset;
uint32_t value;
fse_offset = cmem_ba + (table_offset * HAL_RX_FST_ENTRY_SIZE);
/* Reset the Valid bit */
HAL_CMEM_WRITE(hal_soc, fse_offset + HAL_OFFSET(RX_FLOW_SEARCH_ENTRY_9,
VALID), 0);
value = HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY_0, SRC_IP_127_96,
(flow->tuple_info.src_ip_127_96));
HAL_CMEM_WRITE(hal_soc, fse_offset + HAL_OFFSET(RX_FLOW_SEARCH_ENTRY_0,
SRC_IP_127_96), value);
value = HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY_1, SRC_IP_95_64,
(flow->tuple_info.src_ip_95_64));
HAL_CMEM_WRITE(hal_soc, fse_offset + HAL_OFFSET(RX_FLOW_SEARCH_ENTRY_1,
SRC_IP_95_64), value);
value = HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY_2, SRC_IP_63_32,
(flow->tuple_info.src_ip_63_32));
HAL_CMEM_WRITE(hal_soc, fse_offset + HAL_OFFSET(RX_FLOW_SEARCH_ENTRY_2,
SRC_IP_63_32), value);
value = HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY_3, SRC_IP_31_0,
(flow->tuple_info.src_ip_31_0));
HAL_CMEM_WRITE(hal_soc, fse_offset + HAL_OFFSET(RX_FLOW_SEARCH_ENTRY_3,
SRC_IP_31_0), value);
value = HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY_4, DEST_IP_127_96,
(flow->tuple_info.dest_ip_127_96));
HAL_CMEM_WRITE(hal_soc, fse_offset + HAL_OFFSET(RX_FLOW_SEARCH_ENTRY_4,
DEST_IP_127_96), value);
value = HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY_5, DEST_IP_95_64,
(flow->tuple_info.dest_ip_95_64));
HAL_CMEM_WRITE(hal_soc, fse_offset + HAL_OFFSET(RX_FLOW_SEARCH_ENTRY_5,
DEST_IP_95_64), value);
value = HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY_6, DEST_IP_63_32,
(flow->tuple_info.dest_ip_63_32));
HAL_CMEM_WRITE(hal_soc, fse_offset + HAL_OFFSET(RX_FLOW_SEARCH_ENTRY_6,
DEST_IP_63_32), value);
value = HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY_7, DEST_IP_31_0,
(flow->tuple_info.dest_ip_31_0));
HAL_CMEM_WRITE(hal_soc, fse_offset + HAL_OFFSET(RX_FLOW_SEARCH_ENTRY_7,
DEST_IP_31_0), value);
value = 0 | HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY_8, DEST_PORT,
(flow->tuple_info.dest_port));
value |= HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY_8, SRC_PORT,
(flow->tuple_info.src_port));
HAL_CMEM_WRITE(hal_soc, fse_offset + HAL_OFFSET(RX_FLOW_SEARCH_ENTRY_8,
SRC_PORT), value);
value = HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY_10, METADATA,
(flow->fse_metadata));
HAL_CMEM_WRITE(hal_soc, fse_offset + HAL_OFFSET(RX_FLOW_SEARCH_ENTRY_10,
METADATA), value);
/* Reset all the other fields in FSE */
HAL_CMEM_WRITE(hal_soc, fse_offset + HAL_OFFSET(RX_FLOW_SEARCH_ENTRY_11,
MSDU_COUNT), 0);
HAL_CMEM_WRITE(hal_soc, fse_offset + HAL_OFFSET(RX_FLOW_SEARCH_ENTRY_12,
MSDU_BYTE_COUNT), 0);
HAL_CMEM_WRITE(hal_soc, fse_offset + HAL_OFFSET(RX_FLOW_SEARCH_ENTRY_13,
TIMESTAMP), 0);
value = 0 | HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY_9, L4_PROTOCOL,
flow->tuple_info.l4_protocol);
value |= HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY_9, REO_DESTINATION_HANDLER,
flow->reo_destination_handler);
value |= HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY_9,
REO_DESTINATION_INDICATION,
flow->reo_destination_indication);
value |= HAL_SET_FLD_SM(RX_FLOW_SEARCH_ENTRY_9, VALID, 1);
HAL_CMEM_WRITE(hal_soc, fse_offset + HAL_OFFSET(RX_FLOW_SEARCH_ENTRY_9,
L4_PROTOCOL), value);
return fse_offset;
}
/**
* hal_rx_flow_get_cmem_fse_ts_6750() - Get timestamp field from CMEM FSE
* @hal_soc: hal_soc reference
* @fse_offset: CMEM FSE offset
*
* Return: Timestamp
*/
static uint32_t hal_rx_flow_get_cmem_fse_ts_6750(struct hal_soc *hal_soc,
uint32_t fse_offset)
{
return HAL_CMEM_READ(hal_soc, fse_offset +
HAL_OFFSET(RX_FLOW_SEARCH_ENTRY_13, TIMESTAMP));
}
/**
* hal_rx_flow_get_cmem_fse_6750() - Get FSE from CMEM
* @hal_soc: hal_soc reference
* @fse_offset: CMEM FSE offset
* @fse: referece where FSE will be copied
* @len: length of FSE
*
* Return: If read is succesfull or not
*/
static void
hal_rx_flow_get_cmem_fse_6750(struct hal_soc *hal_soc, uint32_t fse_offset,
uint32_t *fse, qdf_size_t len)
{
int i;
if (len != HAL_RX_FST_ENTRY_SIZE)
return;
for (i = 0; i < NUM_OF_DWORDS_RX_FLOW_SEARCH_ENTRY; i++)
fse[i] = HAL_CMEM_READ(hal_soc, fse_offset + i * 4);
}
static static
void hal_compute_reo_remap_ix2_ix3_6750(uint32_t *ring, uint32_t num_rings, void hal_compute_reo_remap_ix2_ix3_6750(uint32_t *ring, uint32_t num_rings,
uint32_t *remap1, uint32_t *remap2) uint32_t *remap1, uint32_t *remap2)
@@ -1770,7 +1903,12 @@ struct hal_hw_txrx_ops qca6750_hal_hw_txrx_ops = {
hal_rx_mpdu_start_offset_get_generic, hal_rx_mpdu_start_offset_get_generic,
hal_rx_mpdu_end_offset_get_generic, hal_rx_mpdu_end_offset_get_generic,
hal_rx_flow_setup_fse_6750, hal_rx_flow_setup_fse_6750,
hal_compute_reo_remap_ix2_ix3_6750 hal_compute_reo_remap_ix2_ix3_6750,
/* CMEM FSE */
hal_rx_flow_setup_cmem_fse_6750,
hal_rx_flow_get_cmem_fse_ts_6750,
hal_rx_flow_get_cmem_fse_6750,
}; };
struct hal_hw_srng_config hw_srng_table_6750[] = { struct hal_hw_srng_config hw_srng_table_6750[] = {