From 794da8760cd7fa5d3239bbb151af86bd359bde86 Mon Sep 17 00:00:00 2001 From: Vijay Raj Date: Mon, 3 Apr 2023 22:34:43 -0700 Subject: [PATCH] qcacmn: Add WMI_PEER_CONFIG_VLAN_CMDID support for vlan config Add WMI_PEER_CONFIG_VLAN_CMDID support for to vlan configuration to FW. Change-Id: I2f6d15448bb9b2568bdafa21a2c9bca94a915622 CRs-Fixed: 3478611 --- wmi/inc/wmi_unified_priv.h | 8 +-- wmi/inc/wmi_unified_vdev_api.h | 11 ++++ wmi/src/wmi_unified_vdev_api.c | 19 ++++++- wmi/src/wmi_unified_vdev_tlv.c | 96 +++++++++++++++++++++++++++++++++- 4 files changed, 128 insertions(+), 6 deletions(-) diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 136c1e3555..71292e864b 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -1396,6 +1396,10 @@ QDF_STATUS (*send_peer_update_wds_entry_cmd)(wmi_unified_t wmi_handle, struct peer_update_wds_entry_params *param); #endif +QDF_STATUS (*send_peer_vlan_config_cmd)(wmi_unified_t wmi, + uint8_t peer_addr[QDF_MAC_ADDR_SIZE], + struct peer_vlan_config_param *param); + #ifdef WMI_AP_SUPPORT QDF_STATUS (*send_set_ctl_table_cmd)(wmi_unified_t wmi_handle, @@ -1502,10 +1506,6 @@ QDF_STATUS (*set_rx_pkt_type_routing_tag_cmd)( wmi_unified_t wmi_hdl, struct wmi_rx_pkt_protocol_routing_info *param); #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */ -QDF_STATUS (*send_peer_vlan_config_cmd)(wmi_unified_t wmi, - uint8_t peer_addr[QDF_MAC_ADDR_SIZE], - struct peer_vlan_config_param *param); - #ifdef WLAN_SUPPORT_FILS QDF_STATUS (*extract_swfda_vdev_id)(wmi_unified_t wmi_handle, void *evt_buf, uint32_t *vdev_id); diff --git a/wmi/inc/wmi_unified_vdev_api.h b/wmi/inc/wmi_unified_vdev_api.h index d163323f87..753b36f197 100644 --- a/wmi/inc/wmi_unified_vdev_api.h +++ b/wmi/inc/wmi_unified_vdev_api.h @@ -125,6 +125,17 @@ QDF_STATUS wmi_extract_vdev_stopped_param(struct wmi_unified *wmi_handle, void *evt_buf, uint32_t *vdev_id); +/** + * wmi_send_peer_vlan_config() - send peer vlan configuration + * @wmi_handle: wmi handle + * @mac_addr: mac address of the peer + * @param: vlan parameter + */ +QDF_STATUS +wmi_send_peer_vlan_config(struct wmi_unified *wmi_handle, + uint8_t *mac_addr, + struct peer_vlan_config_param param); + /** * wmi_extract_vdev_delete_resp() - extract vdev delete response * @wmi_handle: wmi handle diff --git a/wmi/src/wmi_unified_vdev_api.c b/wmi/src/wmi_unified_vdev_api.c index 0668cb461f..b772901bfb 100644 --- a/wmi/src/wmi_unified_vdev_api.c +++ b/wmi/src/wmi_unified_vdev_api.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -184,6 +184,23 @@ QDF_STATUS wmi_unified_vdev_set_neighbour_rx_cmd_send( qdf_export_symbol(wmi_unified_vdev_set_neighbour_rx_cmd_send); +QDF_STATUS +wmi_send_peer_vlan_config(struct wmi_unified *wmi_handle, + uint8_t *macaddr, + struct peer_vlan_config_param param) +{ + char peer_mac[QDF_MAC_ADDR_SIZE]; + + qdf_mem_copy(peer_mac, macaddr, QDF_MAC_ADDR_SIZE); + + if (wmi_handle->ops->send_peer_vlan_config_cmd) + return wmi_handle->ops->send_peer_vlan_config_cmd(wmi_handle, + peer_mac, + ¶m); + + return QDF_STATUS_E_FAILURE; +} + QDF_STATUS wmi_extract_multi_vdev_restart_resp_event( struct wmi_unified *wmi_handle, void *evt_buf, diff --git a/wmi/src/wmi_unified_vdev_tlv.c b/wmi/src/wmi_unified_vdev_tlv.c index 41be44ec6b..40b9305adf 100644 --- a/wmi/src/wmi_unified_vdev_tlv.c +++ b/wmi/src/wmi_unified_vdev_tlv.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -475,6 +475,99 @@ static inline void wmi_vdev_attach_sr_cmds_tlv(struct wmi_ops *wmi_ops) } #endif +static void +set_peer_tx_vlan_config(wmi_peer_config_vlan_cmd_fixed_param *cmd, + struct peer_vlan_config_param *cfg) +{ + WMI_VLAN_TX_SET(cmd->peer_vlan_config_mask, cfg->tx_cmd); + + /* Setting insert_or_strip bit for Tx */ + WMI_TX_INSERT_OR_STRIP_SET(cmd->peer_vlan_config_mask, + cfg->tx_strip_insert); + + if (cfg->tx_strip_insert_inner && cfg->tx_strip_insert) { + /* Setting the strip_insert_vlan_inner bit fo Tx */ + WMI_TX_STRIP_INSERT_VLAN_INNER_SET(cmd->peer_vlan_config_mask, + cfg->tx_strip_insert_inner); + /* If Insert inner tag bit is set, then fill inner_tci */ + WMI_TX_INSERT_VLAN_INNER_TCI_SET(cmd->insert_vlan_tci, + cfg->insert_vlan_inner_tci); + } + + if (cfg->tx_strip_insert_outer && cfg->tx_strip_insert) { + /* Setting the strip_insert_vlan_outer bit for Tx */ + WMI_TX_STRIP_INSERT_VLAN_OUTER_SET(cmd->peer_vlan_config_mask, + cfg->tx_strip_insert_outer); + /* If Insert outer tag bit is set, then fill outer_tci */ + WMI_TX_INSERT_VLAN_OUTER_TCI_SET(cmd->insert_vlan_tci, + cfg->insert_vlan_outer_tci); + } +} + +static void +wmi_set_peer_vlan_config(wmi_peer_config_vlan_cmd_fixed_param *cmd, + struct peer_vlan_config_param *param) +{ + /* Tx command - Check if cmd is Tx then configure Tx cmd */ + if (param->tx_cmd) + set_peer_tx_vlan_config(cmd, param); + + /* Rx command - Check if cmd is Rx then configure Rx cmd */ + if (param->rx_cmd) { + WMI_VLAN_RX_SET(cmd->peer_vlan_config_mask, param->rx_cmd); + + /* Setting the strip_vlan_c_tag_decap bit in RX */ + WMI_RX_STRIP_VLAN_C_TAG_SET(cmd->peer_vlan_config_mask, + param->rx_strip_c_tag); + + /* Setting the strip_vlan_s_tag_decap bit in RX */ + WMI_RX_STRIP_VLAN_S_TAG_SET(cmd->peer_vlan_config_mask, + param->rx_strip_s_tag); + + /* Setting the insert_vlan_c_tag_decap bit in RX */ + WMI_RX_INSERT_VLAN_C_TAG_SET(cmd->peer_vlan_config_mask, + param->rx_insert_c_tag); + + /* Setting the insert_vlan_s_tag_decap bit in RX */ + WMI_RX_INSERT_VLAN_S_TAG_SET(cmd->peer_vlan_config_mask, + param->rx_insert_s_tag); + } +} + +static QDF_STATUS +send_peer_vlan_config_cmd_tlv(wmi_unified_t wmi, + uint8_t peer_addr[QDF_MAC_ADDR_SIZE], + struct peer_vlan_config_param *param) +{ + wmi_peer_config_vlan_cmd_fixed_param *cmd; + wmi_buf_t buf; + uint32_t len = sizeof(*cmd); + + buf = wmi_buf_alloc(wmi, len); + if (!buf) + return QDF_STATUS_E_NOMEM; + + cmd = (wmi_peer_config_vlan_cmd_fixed_param *)wmi_buf_data(buf); + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_peer_config_vlan_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN + (wmi_peer_config_vlan_cmd_fixed_param)); + WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); + + /* vdev id */ + cmd->vdev_id = param->vdev_id; + + wmi_set_peer_vlan_config(cmd, param); + + if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_CONFIG_VLAN_CMDID)) { + wmi_err("Failed to send peer hw vlan acceleration command"); + wmi_buf_free(buf); + return QDF_STATUS_E_FAILURE; + } + + return QDF_STATUS_SUCCESS; +} + void wmi_vdev_attach_tlv(struct wmi_unified *wmi_handle) { struct wmi_ops *wmi_ops; @@ -506,5 +599,6 @@ void wmi_vdev_attach_tlv(struct wmi_unified *wmi_handle) wmi_ops->send_vdev_config_ratemask_cmd = send_vdev_config_ratemask_cmd_tlv; wmi_ops->send_peer_filter_set_tx_cmd = send_peer_filter_set_tx_cmd_tlv; + wmi_ops->send_peer_vlan_config_cmd = send_peer_vlan_config_cmd_tlv; wmi_vdev_attach_sr_cmds_tlv(wmi_ops); }