qcacmn: Code movement to enable multipass support without WDS

Currently the code to support Multipass on SAP is
present along with the code to support WDS. Hence with
the code in its current state, we will not be able to
enable Multipass support without enabling WDS.

Move the multipass support code out of the WDS support
code, to be able to enable Multipass for chipsets which
do not use WDS.

Change-Id: Id17035f1ada9bde56ca2c61fd4688fa3454b0b11
CRs-Fixed: 3479991
This commit is contained in:
Rakesh Pillai
2023-04-13 02:02:52 -07:00
committed by Madan Koyyalamudi
parent 0e1360e358
commit cdab8dab71
7 changed files with 407 additions and 397 deletions

View File

@@ -12655,3 +12655,95 @@ void dp_destroy_direct_link_refill_ring(struct cdp_soc_t *soc_hdl,
dp_srng_free(soc, &pdev->rx_refill_buf_ring4);
}
#endif
#ifdef QCA_MULTIPASS_SUPPORT
QDF_STATUS dp_set_vlan_groupkey(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
uint16_t vlan_id, uint16_t group_key)
{
struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
struct dp_vdev *vdev = dp_vdev_get_ref_by_id(soc, vdev_id,
DP_MOD_ID_TX_MULTIPASS);
QDF_STATUS status;
if (!vdev || !vdev->multipass_en) {
status = QDF_STATUS_E_INVAL;
goto fail;
}
if (!vdev->iv_vlan_map) {
uint16_t vlan_map_size = (sizeof(uint16_t)) * DP_MAX_VLAN_IDS;
vdev->iv_vlan_map = (uint16_t *)qdf_mem_malloc(vlan_map_size);
if (!vdev->iv_vlan_map) {
QDF_TRACE_ERROR(QDF_MODULE_ID_DP, "iv_vlan_map");
status = QDF_STATUS_E_NOMEM;
goto fail;
}
/*
* 0 is invalid group key.
* Initilalize array with invalid group keys.
*/
qdf_mem_zero(vdev->iv_vlan_map, vlan_map_size);
}
if (vlan_id >= DP_MAX_VLAN_IDS) {
status = QDF_STATUS_E_INVAL;
goto fail;
}
vdev->iv_vlan_map[vlan_id] = group_key;
status = QDF_STATUS_SUCCESS;
fail:
if (vdev)
dp_vdev_unref_delete(soc, vdev, DP_MOD_ID_TX_MULTIPASS);
return status;
}
void dp_tx_remove_vlan_tag(struct dp_vdev *vdev, qdf_nbuf_t nbuf)
{
struct vlan_ethhdr veth_hdr;
struct vlan_ethhdr *veh = (struct vlan_ethhdr *)nbuf->data;
/*
* Extract VLAN header of 4 bytes:
* Frame Format : {dst_addr[6], src_addr[6], 802.1Q header[4],
* EtherType[2], Payload}
* Before Removal : xx xx xx xx xx xx xx xx xx xx xx xx 81 00 00 02
* 08 00 45 00 00...
* After Removal : xx xx xx xx xx xx xx xx xx xx xx xx 08 00 45 00
* 00...
*/
qdf_mem_copy(&veth_hdr, veh, sizeof(veth_hdr));
qdf_nbuf_pull_head(nbuf, ETHERTYPE_VLAN_LEN);
veh = (struct vlan_ethhdr *)nbuf->data;
qdf_mem_copy(veh, &veth_hdr, 2 * QDF_MAC_ADDR_SIZE);
}
void dp_tx_vdev_multipass_deinit(struct dp_vdev *vdev)
{
struct dp_txrx_peer *txrx_peer = NULL;
qdf_spin_lock_bh(&vdev->mpass_peer_mutex);
TAILQ_FOREACH(txrx_peer, &vdev->mpass_peer_list, mpass_peer_list_elem)
qdf_err("Peers present in mpass list : %d", txrx_peer->peer_id);
qdf_spin_unlock_bh(&vdev->mpass_peer_mutex);
if (vdev->iv_vlan_map) {
qdf_mem_free(vdev->iv_vlan_map);
vdev->iv_vlan_map = NULL;
}
qdf_spinlock_destroy(&vdev->mpass_peer_mutex);
}
void dp_peer_multipass_list_init(struct dp_vdev *vdev)
{
/*
* vdev->iv_vlan_map is allocated when the first configuration command
* is issued to avoid unnecessary allocation for regular mode VAP.
*/
TAILQ_INIT(&vdev->mpass_peer_list);
qdf_spinlock_create(&vdev->mpass_peer_mutex);
}
#endif /* QCA_MULTIPASS_SUPPORT */