From patchwork Thu May 22 17:22:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?David_Rapa=C5=88?= X-Patchwork-Id: 891894 Received: from AM0PR02CU008.outbound.protection.outlook.com (mail-westeuropeazolkn19013086.outbound.protection.outlook.com [52.103.33.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A169318FDAF for ; Thu, 22 May 2025 17:22:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.103.33.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747934540; cv=fail; b=kYf9+UaSJAymSjMh6rreDUDI/tDTVNfvCiISSJ+wstt9Lk0c22s9yC56hgrDkaFXWd+4t6YX3YV0uSYuNeUshel0o797h8+zw7Wyr9kMKW9RHf3Ex9OuEs39qNpAvEB8IH0DJpaX2kQedd3k9GijuCMkyO87n47AtkP7YHsXid0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747934540; c=relaxed/simple; bh=T8WSp6IYDqH0HtJ4F+z9k6Mab26dqOPTOjqXn2fJ3UE=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=iIX3X5UCMKQd+HQG2HRLeN8D4mk0ZGEHsQeGayrSB69IS15YwWb688dX8vPQZ592HB8kQM7oplXhocblK1kCTo8tW2S2WbsSoH2j7NClM9CZr+IbXkbbtCZt2lZgrxRnzZ9LVu5r+cwb8MZ6RBdOGHwz5v7vLcnf6sCCw1SR8u8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rapan.cz; spf=pass smtp.mailfrom=rapan.cz; arc=fail smtp.client-ip=52.103.33.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rapan.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rapan.cz ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IKPmpVLBCPXVFJnCQKoirG6jGZM2z8zsOoA1SePJtlk/zmCJ8lWTPUUiaHMlTVuqGm1ItE+iPelvH2cqyW1Ga9kfdSR6IeyxZbD+zu7WE4pdO50w2zmk/J2vo7RfCTu25jPHH7uAQRdLrkDZ0RIXkjBn9IKpuUl5MsJ3n/2ARhpykdv7viw8yVEoa0Watuj2O+O4xVoyqjNFpnjMLl6G2H6Notle0+jOZRKAsKvIX8NwvZwSqZ+PT+3ArnQzNZ5MuTE/8IX+yTFrBptSUzNFh9FqvhRLJW+J1xRco3WesknldFTOI4c/FA+5ZSqmDsg1lZVicaxadfSebtzcjFwJYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SK1/K6ke2CEQvsCvAYcqSuQ4JCsnLN/zqUf5AK04VgQ=; b=gjyUFsX7oCOsA7k9i8gfOwT2eeYdvR1aWn+LbD6BrgRfqxhwr9GnpOD+bx2ijeewjab65KQUAPawgmcSS5DZdG+bCWlJUeTo4l+wo9NaV/KNFXRKU2qDe52N2eoJpzXz9H1GLu643SCCbpvuP0O1PM4EOcNGOfeqlKRkvtPLN498vJPqDCpnP55W+0iiZgR85Ugm6TdTAk6rLWMfD5hdgHyIiSAGl45hvPXb4dGfKeP/FaK1DC5m0LUMUzsGMOpC1waU8ZWe2tgPvJM3jqFLHXfCizutbRAV/1PJgcUzWBGy60VKs1IQlQ2L5OeL3GAJcsYbnbrGyXimKK4+x5hxaw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from DB6PR08MB2693.eurprd08.prod.outlook.com (2603:10a6:6:1c::13) by AS8PR08MB6375.eurprd08.prod.outlook.com (2603:10a6:20b:31b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8769.21; Thu, 22 May 2025 17:22:15 +0000 Received: from DB6PR08MB2693.eurprd08.prod.outlook.com ([fe80::e6db:6f9a:2c0b:acb7]) by DB6PR08MB2693.eurprd08.prod.outlook.com ([fe80::e6db:6f9a:2c0b:acb7%5]) with mapi id 15.20.8722.031; Thu, 22 May 2025 17:22:15 +0000 From: =?iso-8859-2?q?David_Rapa=F2?= To: "ath11k@lists.infradead.org" CC: "linux-wireless@vger.kernel.org" , "jjohnson@kernel.org" , "johannes@sipsolutions.net" Subject: [PATCH v3] ath11k: add support for dynamic vlan (ap/vlan) Thread-Topic: [PATCH v3] ath11k: add support for dynamic vlan (ap/vlan) Thread-Index: AQHbyz2oCV7D9915PEOOd4HN1DIKgQ== Date: Thu, 22 May 2025 17:22:14 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DB6PR08MB2693:EE_|AS8PR08MB6375:EE_ x-ms-office365-filtering-correlation-id: a756b2ae-d894-4503-44ae-08dd99553239 x-microsoft-antispam: BCL:0; ARA:14566002|41001999006|19110799006|15080799009|7092599006|8062599006|15030799003|8060799009|461199028|7072599006|440099028|3412199025|19111999003|12091999003|102099032; x-microsoft-antispam-message-info: =?iso-8859-2?q?f1bGxHoahudy8pOK3XXHbR+FjV?= =?iso-8859-2?q?o18gyploeH3HHUpJwHewaQqIrMjUDxnoKa6i0YeIx2dYojD+5/dOiJy7EgKp?= =?iso-8859-2?q?5Ky98VtiHI+UtdYYLerlHFxPZlhhxwIBICw+yWmfhs2xPfpasyxQAKXGTAGd?= =?iso-8859-2?q?6HRE066/i+OxOugqdT22Y5QqhOvpi9Wq8Kp+c+qp2arNFXIvdeqxDaap4OTO?= =?iso-8859-2?q?6m0VTSIC0Pd1q3/FpTvktOnbe3NmtlMT+/FdJ6bnaH9gR/Z1ATIk9ZIgLpbi?= =?iso-8859-2?q?CsJFC3/Ut5siPmgZjVuzYGLHmeBLvJCPvLL1n2ZVF13DeK8nS58k/9ClKpSa?= =?iso-8859-2?q?V1Lt/5wYo/w7h72Mw1fLt1buGhbpjwfymn8ZWE3cGfHeeHBNyXQSm9kAXEE2?= =?iso-8859-2?q?DQflnBdhDEl9+5bWfvm5qVkNP/1RsbJ1c8w+qdABbcnsiHxGd9ycTQ0Da/DD?= =?iso-8859-2?q?AiKB5kctTDWrJLiZ1TwGdwYmhJGiI0U08D3wOiYO3oWW4EJAPboVNpYSMJ+q?= =?iso-8859-2?q?Kg/NJzsY/E1bl2jU8qTmbljb+KHJq24MnFelZlZHLWaDHntG2tbJ5pA251xU?= =?iso-8859-2?q?0ehnKceO+LJclVM88Md0x8RIzNq+NoiJEP/zYJDn+35RVijUjMK4dqm/aBQr?= =?iso-8859-2?q?VUyMWu0EkjOE2QgxrvHLcsiQbLs+mdxHPRafI41a+A8hAjIc7INqu2L/Z89l?= =?iso-8859-2?q?vvbBUc927UGMV1nB801O9Xc9lENucNVdl8cwIwKSn9VMXuesy3MGo3ySmoXh?= =?iso-8859-2?q?lKlGnAPHL8PMmuHwcOdmwcBkeXH/QF+vN3iRoCoXt98xbjxuwWtCfLt8quZX?= =?iso-8859-2?q?HgYq3dsKyM+bT7LCoLC37lKv9cI+EhTRWA2k9TzD86NbFoBJ1K4NT9/wPVfQ?= =?iso-8859-2?q?sd5qbHe05vJ0cgcaRm0Gt0DtNujD4xJJbo23AH2ZMtFg5+MYa+sVUAFlexcR?= =?iso-8859-2?q?VPBr8qF/dONEGcMJFhVMOydnf4iAjWnc65lPAuObtqQwJKmEWmXH07//xCmP?= =?iso-8859-2?q?Oy7trC6rDWTp5ay8+Cdc6T5LoIs2YjnqG6qW4bfs7hgT/8/dUhrgUgmg64BY?= =?iso-8859-2?q?iF6Y298j3UxBgVaPNhFW26Ix+ME/RO0koPzVJlsNXaGf1lOXloWXDu8ylkIY?= =?iso-8859-2?q?1oU6dBAtlRpeoTdhmOCy5S7JGpnyzDkTrgM3ysb6lHJl1efdyjxNusdGhndk?= =?iso-8859-2?q?cxeHJJhmg+barp+ISr8sLjI1derzjtrRQzUtXsWfjGPjQHVzdwiRQrvGJSpl?= =?iso-8859-2?q?4QM2WefP3vhnV40LNDHeAG+dRZYqxtHZVTeZXEg0K3oC/qjLZjRjaJcBx/KR?= =?iso-8859-2?q?Z40cyBbOrmakY0Lg=3D=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-2?q?KhxR4wUuYG8+y26nc671RjF?= =?iso-8859-2?q?TpL+oQ1l1h3IzkvYcuuZmJx52uecnLECtumWhSyEx5J8ZvWPWVLByE361gT6?= =?iso-8859-2?q?WQ9zMccgs4Td17niw+NzRFpkKutNqKXMGK/EsY5cmPuiCfcFRrCFk/gDZa9h?= =?iso-8859-2?q?En+zM2EfzSORwgLiV+9bJB2eIHwQci86NgZSXPDOqd6UDAH4IGnaDbtrb1X3?= =?iso-8859-2?q?dNXSFP2qf9KMSFp8YrOrsXluyvo2afIexawMckMG1ik2FCHP3qLC8O5ckdOd?= =?iso-8859-2?q?N1mEL186aMjh+ZfuMckbEtBL+DrkMHlWWuwjoklaymF/pXIRUZSxxZgBW2wd?= =?iso-8859-2?q?1tCiPGzLngKTFwrbpEAx7wL+mvAoiW4+0jFue3OKZ8Vhan3U0clvAFGsY/DE?= =?iso-8859-2?q?XRsKuCT9CGouHm1d7C9SIPw08oDr7d+8yUaiytyi3AMwAKIDb2iIL2w2PV8o?= =?iso-8859-2?q?O4xvlXCYy6Z224f5YrH5qLVrPAXSATsF95cWgP8rhk+3l/hmfKwMwNCEuZLP?= =?iso-8859-2?q?KYkLhpJfASCK2DDwVOLFJBWGHXBQth1Gtx4wc0D+IuJ64KWDZCkaRRDCpzP5?= =?iso-8859-2?q?CiVbrF2ZodXo1sfLQ8zH2n34956kZ4euhznr3kSXYweLucSqp2fmEa0joYfJ?= =?iso-8859-2?q?LZqNv5Xt7oO/f5OQcC6qJvcGWyierRodcBMgqCVuw13KnkIFoTysS7C8uLfP?= =?iso-8859-2?q?NgxHxzmPsdrHBw7GbBDZz2Dl8mJpYY2NUsVDs79d/XorA7mEzht4+pTQh2Qk?= =?iso-8859-2?q?icN6viGd+xwZzItpga9/fyaIHRO6+ayZO8gLK0gla9jaVNpY7v7OJPAnBjdO?= =?iso-8859-2?q?K10insdfTFbBqfGJdsdcCB05SGYbeq74Gatj6UR1qpYhkHbD8tn9uBV2yKWM?= =?iso-8859-2?q?Ru58YVDv1qGFU0+iS/m3QE5//9ZmypyYh8XM+YWdhzaKNGybel2qRz6GJbFg?= =?iso-8859-2?q?CiomiX4HXNNIqmBKMGirmIsKSO/XLDxE3MPZkAQQMNyUe5/8Kaf7ZZxt8sAi?= =?iso-8859-2?q?kJx9TaGPbepcXJOzrD/kqWYWO/K/2SoXxAoYpztW8+Ld2sq/IA99zC8oVp+g?= =?iso-8859-2?q?7EDC6cMWa1ESyZjeiW/wwOmhf/Gh5hBUHIIX8eLperdV5NvKd9+9BycOsT2P?= =?iso-8859-2?q?Lysje1kdnsgJ23VVH5RaGgUXtNFUQsVIVGHZuQqmUvXMzuM/ilbSuQ3DPadK?= =?iso-8859-2?q?7w3Wgm4umdobln3jHfT3zAG2nnr70FPiBQHOM21rkCr2LfMc7a1fqtPq/Vuv?= =?iso-8859-2?q?zB65FVz4QI0iTameA7bjhGtfG7+hZc7BMHkcsZ27nhrAgvoBgSHDjesCSUz1?= =?iso-8859-2?q?0+5GN/XxAzhN7Sk0E3g=3D=3D?= Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-8534-20-msonline-outlook-c6e85.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DB6PR08MB2693.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: a756b2ae-d894-4503-44ae-08dd99553239 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 May 2025 17:22:14.9922 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6375 ath11k currently lacks support for dynamic vlan (AP/VLAN), so make '__ath11k_mac_register' in dp_tx to register 'NL80211_IFTYPE_AP_VLAN' as available interface mode. Make 'ath11k_dp_tx' in dp_tx to add metadata info to notify firmware that the multicast/broadcast packets are encrypted in software. Make '__ieee80211_subif_start_xmit' in tx to offload encapsulation for VLAN unicast packets using 8023 xmit path instead of current 80211 xmit path. Tested, long-term in production environment using OpenWrt platform installed on multiple AX3600 with FT: Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-01385-QCAHKSWPL_SILICONZ-1 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-01977-QCAHKSWPL_SILICONZ-1 Co-developed-by: Seevalamuthu Mariappan Signed-off-by: Seevalamuthu Mariappan Signed-off-by: David Rapan --- v1 -> v2: Move 'cpu_to_be16(ETH_P_PAE)' to earlier condition and add 'ieee80211_is_qos_nullfunc' check so QoS NULL Data frames are properly send as open type frames with TID 7 in ethernet encap instead of QoS Data with TID 0. v2 -> v3: Make 'hal_tx_msdu_metadata' struct to comply with current coding standard (no use of bit masks in '__packed'). Make key retrieval in 8023 xmit path from '__ieee80211_subif_start_xmit' to be on pair with the standard flow in 'ieee80211_subif_start_xmit_8023' where it also falls back to 'default_unicast_key'. drivers/net/wireless/ath/ath11k/core.h | 1 + drivers/net/wireless/ath/ath11k/dp_tx.c | 83 +++++++++- drivers/net/wireless/ath/ath11k/hal_desc.h | 160 ++++++++++++++++++++ drivers/net/wireless/ath/ath11k/mac.c | 3 + net/mac80211/tx.c | 15 +++ 5 files changed, 260 insertions(+), 2 deletions(-) base-commit: ff8069c7cf3eb0fcd53adebdf341b6aaa98bdd3b --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -120,6 +120,7 @@ struct ath11k_skb_cb { u32 cipher; struct ath11k *ar; struct ieee80211_vif *vif; + u32 pkt_offset; } __packed; struct ath11k_skb_rxcb { --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -79,6 +79,43 @@ enum hal_encrypt_type ath11k_dp_tx_get_e } } +#define HTT_META_DATA_ALIGNMENT 0x8 + +static int ath11k_dp_metadata_align_skb(struct sk_buff *skb, u8 align_len) +{ + if (unlikely(skb_cow_head(skb, align_len))) + return -ENOMEM; + + skb_push(skb, align_len); + memset(skb->data, 0, align_len); + return 0; +} + +static int ath11k_dp_prepare_htt_metadata(struct sk_buff *skb, + u8 *htt_metadata_size) +{ + u8 htt_desc_size; + /* Size rounded of multiple of 8 bytes */ + u8 htt_desc_size_aligned; + int ret; + struct hal_tx_msdu_metadata *desc_ext; + + htt_desc_size = sizeof(struct hal_tx_msdu_metadata); + htt_desc_size_aligned = ALIGN(htt_desc_size, HTT_META_DATA_ALIGNMENT); + + ret = ath11k_dp_metadata_align_skb(skb, htt_desc_size_aligned); + if (unlikely(ret)) + return ret; + + desc_ext = (struct hal_tx_msdu_metadata *)skb->data; + desc_ext->info0 = le32_encode_bits(1, HAL_TX_MSDU_METADATA_INFO0_ENCRYPT_FLAG) | + le32_encode_bits(0, HAL_TX_MSDU_METADATA_INFO0_ENCRYPT_TYPE) | + le32_encode_bits(1, + HAL_TX_MSDU_METADATA_INFO0_HOST_TX_DESC_POOL); + *htt_metadata_size = htt_desc_size_aligned; + return 0; +} + int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif, struct ath11k_sta *arsta, struct sk_buff *skb) { @@ -97,6 +134,9 @@ int ath11k_dp_tx(struct ath11k *ar, stru u32 ring_selector = 0; u8 ring_map = 0; bool tcl_ring_retry; + bool is_diff_encap = false; + u8 align_pad; + u8 htt_meta_size = 0; if (unlikely(test_bit(ATH11K_FLAG_CRASH_FLUSH, &ar->ab->dev_flags))) return -ESHUTDOWN; @@ -189,7 +229,12 @@ tcl_ring_sel: switch (ti.encap_type) { case HAL_TCL_ENCAP_TYPE_NATIVE_WIFI: - ath11k_dp_tx_encap_nwifi(skb); + if ((arvif->vif->offload_flags & IEEE80211_OFFLOAD_ENCAP_ENABLED) && + (skb->protocol == cpu_to_be16(ETH_P_PAE) || + ieee80211_is_qos_nullfunc(hdr->frame_control))) + is_diff_encap = true; + else + ath11k_dp_tx_encap_nwifi(skb); break; case HAL_TCL_ENCAP_TYPE_RAW: if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) { @@ -208,6 +253,33 @@ tcl_ring_sel: goto fail_remove_idr; } + /* Add metadata for software encryption of vlan group traffic */ + if ((!test_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ar->ab->dev_flags) && + !(info->control.flags & IEEE80211_TX_CTL_HW_80211_ENCAP) && + !info->control.hw_key && ieee80211_has_protected(hdr->frame_control)) || + is_diff_encap) { + /* HW requirement is that metadata should always point to a + * 8-byte aligned address. So we add alignment pad to start of + * buffer. HTT Metadata should be ensured to be multiple of 8-bytes + * to get 8-byte aligned start address along with align_pad added + */ + align_pad = ((unsigned long)skb->data) & (HTT_META_DATA_ALIGNMENT - 1); + ret = ath11k_dp_metadata_align_skb(skb, align_pad); + if (unlikely(ret)) + goto fail_remove_idr; + + ti.pkt_offset += align_pad; + ret = ath11k_dp_prepare_htt_metadata(skb, &htt_meta_size); + if (unlikely(ret)) + goto fail_remove_idr; + + ti.pkt_offset += htt_meta_size; + ti.meta_data_flags |= HTT_TCL_META_DATA_VALID_HTT; + ti.flags0 |= FIELD_PREP(HAL_TCL_DATA_CMD_INFO1_TO_FW, 1); + ti.encap_type = HAL_TCL_ENCAP_TYPE_RAW; + ti.encrypt_type = HAL_ENCRYPT_TYPE_OPEN; + } + ti.paddr = dma_map_single(ab->dev, skb->data, skb->len, DMA_TO_DEVICE); if (unlikely(dma_mapping_error(ab->dev, ti.paddr))) { atomic_inc(&ab->soc_stats.tx_err.misc_fail); @@ -216,7 +288,8 @@ tcl_ring_sel: goto fail_remove_idr; } - ti.data_len = skb->len; + ti.data_len = skb->len - ti.pkt_offset; + skb_cb->pkt_offset = ti.pkt_offset; skb_cb->paddr = ti.paddr; skb_cb->vif = arvif->vif; skb_cb->ar = ar; @@ -272,6 +345,8 @@ fail_unmap_dma: dma_unmap_single(ab->dev, ti.paddr, ti.data_len, DMA_TO_DEVICE); fail_remove_idr: + if (ti.pkt_offset) + skb_pull(skb, ti.pkt_offset); spin_lock_bh(&tx_ring->tx_idr_lock); idr_remove(&tx_ring->txbuf_idr, FIELD_GET(DP_TX_DESC_ID_MSDU_ID, ti.desc_id)); @@ -348,6 +423,10 @@ ath11k_dp_tx_htt_tx_complete_buf(struct return; } + if (skb_cb->pkt_offset) + /* Removing the alignment and htt meta data */ + skb_pull(msdu, skb_cb->pkt_offset); + memset(&info->status, 0, sizeof(info->status)); if (ts->acked) { --- a/drivers/net/wireless/ath/ath11k/hal_desc.h +++ b/drivers/net/wireless/ath/ath11k/hal_desc.h @@ -2490,5 +2490,165 @@ * A count value that indicates the number of times the producer of * entries into this Ring has looped around the ring. */ + +#define HAL_TX_MSDU_METADATA_INFO0_ENCRYPT_FLAG BIT(8) +#define HAL_TX_MSDU_METADATA_INFO0_ENCRYPT_TYPE GENMASK(16, 15) +#define HAL_TX_MSDU_METADATA_INFO0_HOST_TX_DESC_POOL BIT(31) + +struct hal_tx_msdu_metadata { + __le32 info0; + __le32 rsvd0[6]; +} __packed; + +/* hal_tx_msdu_metadata + * + * valid_pwr + * If set, tx pwr spec is valid + * + * valid_mcs_mask + * If set, tx MCS mask is valid + * + * valid_nss_mask + * If set, tx Nss mask is valid + * + * valid_preamble_type + * If set, tx preamble spec is valid + * + * valid_retries + * If set, tx retries spec is valid + * + * valid_bw_info + * If set, tx dyn_bw and bw_mask are valid + * + * valid_guard_interval + * If set, tx guard intv spec is valid + * + * valid_chainmask + * If set, tx chainmask is valid + * + * valid_encrypt_type + * If set, encrypt type is valid + * + * valid_key_flags + * If set, key flags is valid + * + * valid_expire_tsf + * If set, tx expire TSF spec is valid + * + * valid_chanfreq + * If set, chanfreq is valid + * + * is_dsrc + * If set, MSDU is a DSRC frame + * + * guard_interval + * 0.4us, 0.8us, 1.6us, 3.2us + * + * encrypt_type + * 0 = NO_ENCRYPT, + * 1 = ENCRYPT, + * 2 ~ 3 - Reserved + * + * retry_limit + * Specify the maximum number of transmissions, including the + * initial transmission, to attempt before giving up if no ack + * is received. + * If the tx rate is specified, then all retries shall use the + * same rate as the initial transmission. + * If no tx rate is specified, the target can choose whether to + * retain the original rate during the retransmissions, or to + * fall back to a more robust rate. + * + * use_dcm_11ax + * If set, Use Dual subcarrier modulation. + * Valid only for 11ax preamble types HE_SU + * and HE_EXT_SU + * + * ltf_subtype_11ax + * Takes enum values of htt_11ax_ltf_subtype_t + * Valid only for 11ax preamble types HE_SU + * and HE_EXT_SU + * + * dyn_bw + * 0 = static bw, 1 = dynamic bw + * + * bw_mask + * Valid only if dyn_bw == 0 (static bw). + * + * host_tx_desc_pool + * If set, Firmware allocates tx_descriptors + * in WAL_BUFFERID_TX_HOST_DATA_EXP,instead + * of WAL_BUFFERID_TX_TCL_DATA_EXP. + * Use cases: + * Any time firmware uses TQM-BYPASS for Data + * TID, firmware expect host to set this bit. + * + * power + * Unit of the power field is 0.5 dbm + * signed value ranging from -64dbm to 63.5 dbm + * + * mcs_mask + * mcs bit mask of 0 ~ 11 + * Setting more than one MCS isn't currently + * supported by the target but is supported + * in the interface in case in the future + * the target supports specifications of + * a limited set of MCS values. + * + * nss_mask + * Nss bit mask 0 ~ 7 + * Setting more than one Nss isn't currently + * supported by the target but is supported + * in the interface in case in the future + * the target supports specifications of + * a limited set of Nss values. + * + * pream_type + * Preamble types + * + * update_peer_cache + * When set these custom values will be + * used for all packets, until the next + * update via this ext header. + * This is to make sure not all packets + * need to include this header. + * + * chain_mask + * Specify which chains to transmit from + * + * key_flags + * Key Index and related flags - used in mesh mode + * + * chanfreq + * Channel frequency: This identifies the desired channel + * frequency (in MHz) for tx frames. This is used by FW to help + * determine when it is safe to transmit or drop frames for + * off-channel operation. + * The default value of zero indicates to FW that the corresponding + * VDEV's home channel (if there is one) is the desired channel + * frequency. + * + * expire_tsf_lo + * tx expiry time (TSF) LSBs + * + * expire_tsf_hi + * tx expiry time (TSF) MSBs + * + * learning_frame + * When this flag is set, this frame will be dropped by FW + * rather than being enqueued to the Transmit Queue Manager (TQM) HW. + * + * send_as_standalone + * This will indicate if the msdu needs to be sent as a singleton PPDU, + * i.e. with no A-MSDU or A-MPDU aggregation. + * The scope is extended to other use-cases. + * + * is_host_opaque_valid + * Set this bit to 1 if the host_opaque_cookie is populated + * with valid information. + * + * host_opaque_cookie + * Host opaque cookie for special frames + */ #endif /* ATH11K_HAL_DESC_H */ --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -10324,6 +10324,9 @@ static int __ath11k_mac_register(struct goto err_free_if_combs; } + ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); + ar->hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN); + if (!ab->hw_params.supports_monitor) /* There's a race between calling ieee80211_register_hw() * and here where the monitor mode is enabled for a little --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -40,6 +40,10 @@ /* misc utils */ +static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata, + struct net_device *dev, struct sta_info *sta, + struct ieee80211_key *key, struct sk_buff *skb); + static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, struct sk_buff *skb, int group_addr, int next_frag_len) @@ -4281,5 +4285,16 @@ void __ieee80211_subif_start_xmit(struct if (IS_ERR(sta)) sta = NULL; + if (sta && sdata->vif.type == NL80211_IFTYPE_AP_VLAN && + get_bss_sdata(sdata)->vif.offload_flags & IEEE80211_OFFLOAD_ENCAP_ENABLED && + !is_multicast_ether_addr(skb->data)) { + struct ieee80211_key *key = rcu_dereference(sta->ptk[sta->ptk_idx]); + if (!key) + key = rcu_dereference(get_bss_sdata(sdata)->default_unicast_key); + ieee80211_8023_xmit(sdata, dev, sta, key, skb); + rcu_read_unlock(); + return; + } + skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); ieee80211_aggr_check(sdata, sta, skb);