Browse Source

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
Vijay Raj 2 years ago
parent
commit
794da8760c

+ 4 - 4
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);

+ 11 - 0
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

+ 18 - 1
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,
+								  &param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
 QDF_STATUS wmi_extract_multi_vdev_restart_resp_event(
 	struct wmi_unified *wmi_handle,
 	void *evt_buf,

+ 95 - 1
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);
 }