From patchwork Wed Jun 4 23:22:37 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: 894157 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03olkn2096.outbound.protection.outlook.com [40.92.57.96]) (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 66896224AF2 for ; Wed, 4 Jun 2025 23:22:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.57.96 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749079365; cv=fail; b=eItD7MB6oGzVy3gTMOQfsy3qVXJFq6fUtu1+uBre7Rkm3jiA1pAgcaMcvQGkXU+lpFIeRYK3qB1Xn8Cm3Qqvp1nmyVoLXrcK7zUaq/eUBmKm5pcQ9CZoc4VLKbz3K2SU6v7YiA0kuuIgARUUvfaoZjmKa/GnSfXk4mXsutCZ+ss= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749079365; c=relaxed/simple; bh=T8WSp6IYDqH0HtJ4F+z9k6Mab26dqOPTOjqXn2fJ3UE=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=d6qC5blKz9nCV7B5X2i3zyW/lsUfAOY4quDQDCQ8u1KruSV4LMdX04fIVkpXBJOtGdgIS/M9rBabGPISHVnTf3wgu0O82PShTGrYDu+UtIIAaXkd0JGrjkjCoeFLr7H/iFla7iEyXAldMkm32sATQ6Q932nns+XXTu7nW8mTBKM= 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=40.92.57.96 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=LM8i52ngU04wt0xXbp98Cw+DXs2mLa/gp+7QD1rjg9QQh4nKeqYJSb3L7OEclC9jVmWu14pFEQ+umfow3e2bsgJMqzhoECrzK8dRWy434RaPqkzJbyX6svEbwDRNAthNEdKgV//5dTQJeYpZELvSoC7ZNfDr0TVib5v3uOXfqDb2Bq9zTKcNIogYhAAkDyJ+tmV+gvAqg8Js0qsYg9k7LSU3oVWZdds6XB7y/yecrVv7fAtB2eqn0HuXlZb0PiaiGF33ID9e1JoyaUR6xh3GvZML3oMLO+gYRgZLTQjnQN///+idM0HJfZiQ21qy/xcyc9jwS/hh3xD6sMH59K72Dg== 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=uqI7XJY9jvK52BclyCr+qcqx9dDiEyNwW0yQ32Ujylw7qY3Xoxxs+VPiLUoM5vWZgSbcCBv5Yk2e44e4yrJXpyZ/JpTucrEvovcqsvMSEYXE/b31XfnzGixjmLUg1p6FyS0ag3chp7CwLpiLCGMoZ8StfO+tZdUZmrGan58pWsa1X99OgxrMvDsmfbdb7OvqPh/RULM2JkvIj8fyYZJ9IyxbrKbbqKAubwT+qgkfeAk7fOWddFlo8hZ3AgYy8VR2liBuJ0gNC+m8oAHqjqs1jhpYcReanMAQjkwrpFVQ/gyyisDAmuKHG6O15UqRJKORlPd6/rl5Z8rKNA9KVYDyTw== 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 FRZPR08MB11191.eurprd08.prod.outlook.com (2603:10a6:d10:136::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8746.30; Wed, 4 Jun 2025 23:22:38 +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.8769.033; Wed, 4 Jun 2025 23:22:37 +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 RESEND] ath11k: add support for dynamic vlan (ap/vlan) Thread-Topic: [PATCH v3 RESEND] ath11k: add support for dynamic vlan (ap/vlan) Thread-Index: AQHb1adfoTFPcIeVW0mmho0YmcrzaQ== Date: Wed, 4 Jun 2025 23:22:37 +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_|FRZPR08MB11191:EE_ x-ms-office365-filtering-correlation-id: f6f72086-9b88-43a8-12b0-08dda3beb1b4 x-ms-exchange-slblob-mailprops: 30ekHghIwFqEAsnBe6Mts21oemuWkGZz7K7wSG4CLOM74a9Z/Bst5F8tjCVO2nbAh6AKapW1N3ua+nmHDkgKnTAYZb92rIz5ou9yiBWF10CAnj2fh9B4+7oWz4xM9zuK8kxFlKpv+yIVpd1SxoS3rLSPQH21zr2bMf7Hei4vN96FPIl9rLl3lTZnlkkdpTrMvmjhQQW1tAiMG7IO6SOdUA63z8vDRFgCwU66ZMaRF4qfXKrTtEZiqjFyxmGQTecOzYyv8EO3NC7JHDLrXE82h/x12gNv7iXtWnr7aagEKRlK9upfPyDaXyYam3X3bFJyz5j3bUwx32keR+9BvFSJHNi8+Q1IQ3dnWpMNORen3RxrgNuEcUqrB2d5r8pMrv7NxECGraPn0+eRA1l9+BHHxEZ7VkvmREEPKqU17FlX+DUpZT4hm1StSXkyh5+1LlZMj6cSuHeJTvXR0GN3lgDNsYZINYnvX7VeBdsbvxBMHW72BfI9SDIgTVC6tJXaievqV/qgYWYbdX9C0afdkWiwD2J301z5n1l/+p9LMCW9ZpNdIZVCMi1oHf4FutfJQNt0GEwHvJYaoncRloLNIbZRVC3hcDLhnhsIhOBX+9b0efKnQKdUnw8LbHCYKn9UwyLIcTe7beK8ZFYLrVClacK2JfqS1MWs5F63XJkQHD60DZi5d0bQqUd0lnm1FK8UYHSBXaPlsL2Yi0qbeW+Sp/1sZ/HWC88K9+8/gdNOZf0GLfIlpZLOQ8LMokXEYtgMamHJ x-microsoft-antispam: BCL:0; ARA:14566002|8062599006|461199028|7072599006|41001999006|8060799009|7092599006|15030799003|15080799009|19110799006|3412199025|440099028|102099032|19111999003|12091999003; x-microsoft-antispam-message-info: =?iso-8859-2?q?vIffQ3N5k2yY1bhoEhUOe+MGpD?= =?iso-8859-2?q?Sndqa+bDBuGuxiYXSB1Lw18fhCGEiS0sYA73Nw6yc8ZK/p0S/z9DwDZjG6Z1?= =?iso-8859-2?q?H1pE1ONTXkJRP+SG5pVD7VFHqBH4hv/Mi78L2pGjvL5C10qrBEIvPCl3WEwr?= =?iso-8859-2?q?t74ADHcoZDKzQZxqBDnuL1FVe2STVnIc4AosErG8t0FVIAVnvyOZueDfYoUj?= =?iso-8859-2?q?LoqqGkpL4+XJHthdBUzoT5ffmSEvBsUUt1gJeHqefo8rKkKwjjAwNbmQ5Bdj?= =?iso-8859-2?q?fsLjLXhXObdsfad698NRibxtqdgkuQirq+K1ss87Hbv0c7NX/kZ+eAJ+xEi/?= =?iso-8859-2?q?VIUguCeboPOsTwQ6Tr9bd/X7d1/HU7Ey2xPSF/dHSgOCcvStHBcMdEexG5S1?= =?iso-8859-2?q?tu93+GilvYqlDITR50kEbroilHkQWc618vyTcEih6yxN4k+7wd/kiF7MmPzh?= =?iso-8859-2?q?XqrM/LiNyBxpj1Cb+NnsBoBweMQ6ShyQSyrwYnemjZlS/p67wF+CB4sAwTlu?= =?iso-8859-2?q?yOevQpxNV7mu4eF5PDiPbVbn9vKrrUDFJl/MphUPkgla2MZCbKjg65z7yCEf?= =?iso-8859-2?q?VdFz3JUk8Dz3t1ixFfPSsMNT09vDnyLLC4xMeybkEF1N0+HhqywP5Gr9OYi8?= =?iso-8859-2?q?b/1vWd8kKUjspXbKiSigSO8EbgWy6Vb8M2/xcva7rRVOr6kY6xyN405frIrk?= =?iso-8859-2?q?hQLsn9PLNW74NPXrEtMDxDmACYMoW3FFVti2NPLImZcESgfBqf5YdGlyg1Qv?= =?iso-8859-2?q?LP85MTVl6oL4BpfMwOVdlbcI0Lw7InsQvMleC5RGiL+4AIVg1Mhl1vI60nTi?= =?iso-8859-2?q?B1F5BN7zSkOmqUb479rCNXAGs7EFNrFUKZGscYojfkoex8Z4FOoELgmVgjA1?= =?iso-8859-2?q?lBeMA2CMjXJszcIa7Ldj+TCVV1j7OO3JQNjMjkcPHqvHx8tSPER2tAUEJdDo?= =?iso-8859-2?q?7cudRL0/JKKvI5POwdGpWCiIFkzglmKnMW2NM9B1gp5hymlZOIuNTaI4h2T3?= =?iso-8859-2?q?pnkYp9YA55aZ/dfxABdv7SSGXTnNYczoXm7y7djfKbU3ljDxbk5a2URAluy1?= =?iso-8859-2?q?nG6oeprDrc3B0wmoKFAdulAo5XuoUpfrG+aORA7sFGdkUmFjKRuqOTZnGJLQ?= =?iso-8859-2?q?syfib3Il7wSqiEfTHsOETV7BS4+LcaDExhvY8VIcfpv40cp7P1KZTbL0Uooq?= =?iso-8859-2?q?BasZDkfaHMbKb40522gIgzGQXN7SCDlfZ9qS7nNRQAfMWiJibInIHw4SlqmG?= =?iso-8859-2?q?nJLE4R+zmA0TvHpi3UrqdN7P059BkSGGIYkT4/0905MrJdjHaEDZcakfFt2M?= =?iso-8859-2?q?K5B2imX602xVCCkw=3D=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-2?q?8po0YLPHGHZUoEeIeGwFW/u?= =?iso-8859-2?q?uQpAzQRjgp1RktRaxtAo9Kh9YIwEPA4vWr4ftGYJDeVAY+kE0xGFOqXrtPGb?= =?iso-8859-2?q?/9ACEMvxxxzmWpPLipDEByOYJGaq+b8yUXCcPcEsZw6oXqTnZrQ3/q4rapRy?= =?iso-8859-2?q?SEGHW2Xs8cmZxiYWlBs+fq4k5+QQcSavaH3EV8aKhWcM4XAJlAqqhROnWZoR?= =?iso-8859-2?q?tjSqnSflo9tPGWWErye/Fanm04CxqlxvREKIlgtq0AgOO3ZxilradvDpoTXv?= =?iso-8859-2?q?5UOS+nGFVwJbA+16A9cpNMY8Nc7swsrojMQ8Ot/rLv7SixQAbyCgltnkuAjA?= =?iso-8859-2?q?u0IpU+BQ1OYCKU/sWYng5PE0kZiO4TSSSj/dlVPU1FLktRv12TBleS6GPEez?= =?iso-8859-2?q?yAB0kuuwv8QbNSpr9KN5y9W9gMgHrCBSwODoHULIct4Kuy38Dn8cSLM7qHvp?= =?iso-8859-2?q?infXk6CbCD/sjEUS6X9eLtDlbIk4fbhT0eJJOgzujjTO/tVJgOiehycTx0Y5?= =?iso-8859-2?q?nN/oTjLM5ebfRO05SYBtbecF/BM5Y2+UQhe4F4K3b1Koi3vNaPoRvTLaay/k?= =?iso-8859-2?q?l5K9IzWpjHMiXo/yBaSHsNR17qfmZAg8G+Rm7DQr8bt6pmNQ0qmHKOa0Xk2e?= =?iso-8859-2?q?V0N9wF+HX0HgrrWQY85HlcRZWiL1UVy5Jw+jaiRlrk3iXIhg5QaMPKIUiSsK?= =?iso-8859-2?q?dhDF9/vydOYxgB+ACJecWlVAr/oiM4vLhVHnykvaOOI/XaPkNNmWIXm3ssDa?= =?iso-8859-2?q?rzsJ3snm639sbsc+NYFqZppi6EOBvZbSI4Z6fLNE+ODD7NU1hlUM1o8IRxrP?= =?iso-8859-2?q?79WHaUmRDvy3n7pRTAENRLrTI09D9Tya15fvEYyW50oox/ue+dF/oL97o8G+?= =?iso-8859-2?q?FO+CkHq796gLc48V5Qspwz8RroQkYQC6vs848/gNzF5pGELIwPVAdWLxEnFU?= =?iso-8859-2?q?6j/ySTyj0kJYlBgbFZ10o1RSaUePw3CHdR5hwQ0sT9ZrjRDW5gvnE9+MsfHL?= =?iso-8859-2?q?EsiNc1Y4oKd950TLJVARKhWtx2OmrzSzd4oL5iK4pEsQW1wdtJw3N9Kf2uL3?= =?iso-8859-2?q?phWDZuU+rNvXoi12Qa2cgeBjtCQsCQXJDa/+5or2bjiwDzX8hZ1XGq3a2slX?= =?iso-8859-2?q?2kGlxlhdn4R2bAQa7Q7Fiom4J5XefJKr71NeJC+epvJ77MkwH9mSxHRWQ7IO?= =?iso-8859-2?q?2iBa2aTmPXn/su5IOHG2Uc6vvtRNgvrP3/NE6z+eY/92roLGX7VYFLqNVBnI?= =?iso-8859-2?q?NahEXuqa/GOaNr1e8JR4TSvRA3ZZ9FNTHQhouXp0X70uYb2KVHyA+c3gO0qz?= =?iso-8859-2?q?wQwZgEqsIisAJQc5EsA=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: f6f72086-9b88-43a8-12b0-08dda3beb1b4 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jun 2025 23:22:37.6396 (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: FRZPR08MB11191 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);