qcacmn: Add a new feature to support tagging of IPv4/v6 flows

Tags are programmed using wlanconfig commands. Rx IPv4/v6
TCP/UDP packets matching a 5-tuple are tagged using HawkeyeV2 hardware.
Tags are populated in the skb->cb in the REO/exception/monitor data
path and sent to upper stack

CRs-Fixed: 2502311
Change-Id: I7c999e75fab43b6ecb6f9d9fd4b0351f0b9cfda8
这个提交包含在:
Sumeet Rao
2019-07-05 02:11:19 -07:00
提交者 nshrivas
父节点 eda56478de
当前提交 c4fa4df717
修改 19 个文件,包含 2533 行新增24 行删除

查看文件

@@ -901,6 +901,7 @@ void dp_rx_update_rx_err_protocol_tag_stats(struct dp_pdev *pdev,
{
}
#endif /* WLAN_SUPPORT_RX_TAG_STATISTICS */
/**
* dp_rx_update_protocol_tag() - Reads CCE metadata from the RX MSDU end TLV
* and set the corresponding tag in QDF packet
@@ -977,7 +978,7 @@ dp_rx_update_protocol_tag(struct dp_soc *soc, struct dp_vdev *vdev,
protocol_tag = pdev->rx_proto_tag_map[cce_metadata].tag;
qdf_nbuf_set_rx_protocol_tag(nbuf, protocol_tag);
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW,
"Seq:%u decap:%u CCE Match:%d ProtoID:%u Tag:%u US:%d",
"Seq:%u dcap:%u CCE Match:%u ProtoID:%u Tag:%u stats:%u",
hal_rx_get_rx_sequence(rx_tlv_hdr),
vdev->rx_decap_type, cce_match, cce_metadata,
protocol_tag, is_update_stats);
@@ -1007,23 +1008,122 @@ dp_rx_update_protocol_tag(struct dp_soc *soc, struct dp_vdev *vdev,
#endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */
/**
* dp_rx_mon_update_protocol_tag() - Performs necessary checks for monitor mode
* and then tags appropriate packets
* dp_rx_update_rx_flow_tag_stats() - Update stats for given flow index
* @pdev: TXRX pdev context for which stats should be incremented
* @flow_index: flow index for which the stats should be incremented
*
* Return: void
*/
#ifdef WLAN_SUPPORT_RX_FLOW_TAG
QDF_STATUS dp_rx_flow_update_fse_stats(struct dp_pdev *pdev, uint32_t flow_id);
static inline void dp_rx_update_rx_flow_tag_stats(struct dp_pdev *pdev,
uint32_t flow_index)
{
dp_rx_flow_update_fse_stats(pdev, flow_index);
}
#else
static inline void dp_rx_update_rx_flow_tag_stats(struct dp_pdev *pdev,
uint32_t flow_index)
{
}
#endif /* WLAN_SUPPORT_RX_FLOW_TAG */
/**
* dp_rx_update_flow_tag() - Reads FSE metadata from the RX MSDU end TLV
* and set the corresponding tag in QDF packet
* @soc: core txrx main context
* @vdev: vdev on which the packet is received
* @nbuf: QDF pkt buffer on which the protocol tag should be set
* @rx_tlv_hdr: base address where the RX TLVs starts
* @is_update_stats: flag to indicate whether to update stats or not
*
* Return: void
*/
#ifdef WLAN_SUPPORT_RX_FLOW_TAG
static inline void
dp_rx_update_flow_tag(struct dp_soc *soc, struct dp_vdev *vdev,
qdf_nbuf_t nbuf, uint8_t *rx_tlv_hdr, bool update_stats)
{
bool flow_idx_invalid, flow_idx_timeout;
uint32_t flow_idx, fse_metadata;
struct dp_pdev *pdev;
if (qdf_unlikely(!vdev))
return;
pdev = vdev->pdev;
if (qdf_likely(!wlan_cfg_is_rx_flow_tag_enabled(soc->wlan_cfg_ctx)))
return;
/**
* In case of raw frames, rx_msdu_end tlv may be stale or invalid.
* Do not tag such frames in normal REO path.
* Default decap_type is set to ethernet for monitor vdev currently,
* therefore, we will not check decap_type for monitor mode.
* We will call this only for eth frames from dp_rx_mon_dest.c.
*/
if (qdf_likely((vdev->rx_decap_type != htt_cmn_pkt_type_ethernet)))
return;
flow_idx_invalid = hal_rx_msdu_flow_idx_invalid(rx_tlv_hdr);
hal_rx_msdu_get_flow_params(rx_tlv_hdr, &flow_idx_invalid,
&flow_idx_timeout, &flow_idx);
if (qdf_unlikely(flow_idx_invalid))
return;
if (qdf_unlikely(flow_idx_timeout))
return;
/**
* Limit FSE metadata to 16 bit as we have allocated only
* 16 bits for flow_tag field in skb->cb
*/
fse_metadata = hal_rx_msdu_fse_metadata_get(rx_tlv_hdr) & 0xFFFF;
/* update the skb->cb with the user-specified tag/metadata */
qdf_nbuf_set_rx_flow_tag(nbuf, fse_metadata);
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW,
"Seq:%u dcap:%u invalid:%u timeout:%u flow:%u tag:%u stat:%u",
hal_rx_get_rx_sequence(rx_tlv_hdr),
vdev->rx_decap_type, flow_idx_invalid, flow_idx_timeout,
flow_idx, fse_metadata, update_stats);
if (qdf_likely(update_stats))
dp_rx_update_rx_flow_tag_stats(pdev, flow_idx);
}
#else
static inline void
dp_rx_update_flow_tag(struct dp_soc *soc, struct dp_vdev *vdev,
qdf_nbuf_t nbuf, uint8_t *rx_tlv_hdr, bool update_stats)
{
}
#endif /* WLAN_SUPPORT_RX_FLOW_TAG */
/**
* dp_rx_mon_update_protocol_flow_tag() - Performs necessary checks for monitor
* mode and then tags appropriate packets
* @soc: core txrx main context
* @vdev: pdev on which packet is received
* @msdu: QDF packet buffer on which the protocol tag should be set
* @rx_desc: base address where the RX TLVs start
* Return: void
*/
#ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG
#if defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) ||\
defined(WLAN_SUPPORT_RX_FLOW_TAG)
static inline
void dp_rx_mon_update_protocol_tag(struct dp_soc *soc, struct dp_pdev *dp_pdev,
qdf_nbuf_t msdu, void *rx_desc)
void dp_rx_mon_update_protocol_flow_tag(struct dp_soc *soc,
struct dp_pdev *dp_pdev,
qdf_nbuf_t msdu, void *rx_desc)
{
uint32_t msdu_ppdu_id = 0;
struct mon_rx_status *mon_recv_status;
if (qdf_likely(!dp_pdev->is_rx_protocol_tagging_enabled))
bool is_mon_protocol_flow_tag_enabled =
wlan_cfg_is_rx_mon_protocol_flow_tag_enabled(soc->wlan_cfg_ctx);
if (qdf_likely(!is_mon_protocol_flow_tag_enabled))
return;
if (qdf_likely(!dp_pdev->monitor_vdev))
@@ -1043,29 +1143,35 @@ void dp_rx_mon_update_protocol_tag(struct dp_soc *soc, struct dp_pdev *dp_pdev,
return;
}
/*
* Update the protocol tag in SKB for packets received on BSS.
* Do not update tag stats since it would double actual received count
*/
mon_recv_status = &dp_pdev->ppdu_info.rx_status;
if (mon_recv_status->frame_control_info_valid &&
((mon_recv_status->frame_control & IEEE80211_FC0_TYPE_MASK) ==
IEEE80211_FC0_TYPE_DATA)) {
/*
* Update the protocol tag in SKB for packets received on BSS.
* Do not update tag stats since it would double actual
* received count.
*/
dp_rx_update_protocol_tag(soc,
dp_pdev->monitor_vdev,
msdu, rx_desc,
MAX_REO_DEST_RINGS,
false, false);
/* Update the flow tag in SKB based on FSE metadata */
dp_rx_update_flow_tag(soc, dp_pdev->monitor_vdev,
msdu, rx_desc, false);
}
}
#else
static inline
void dp_rx_mon_update_protocol_tag(struct dp_soc *soc, struct dp_pdev *dp_pdev,
qdf_nbuf_t msdu, void *rx_desc)
void dp_rx_mon_update_protocol_flow_tag(struct dp_soc *soc,
struct dp_pdev *dp_pdev,
qdf_nbuf_t msdu, void *rx_desc)
{
/* Stub API */
}
#endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */
#endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG || WLAN_SUPPORT_RX_FLOW_TAG */
/*
* dp_rx_buffers_replenish() - replenish rxdma ring with rx nbufs
* called during dp rx initialization