Skip to content

Commit

Permalink
Merge pull request #115 from qosmio/qualcommax-6.x-nss-wifi
Browse files Browse the repository at this point in the history
sync 8/5 2
  • Loading branch information
rmandrad authored May 8, 2024
2 parents 51e9aa6 + ac6cd6a commit 79fa74b
Show file tree
Hide file tree
Showing 187 changed files with 40,790 additions and 20 deletions.
2 changes: 2 additions & 0 deletions feeds.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ src-git packages https://git.openwrt.org/feed/packages.git
src-git luci https://git.openwrt.org/project/luci.git
src-git routing https://git.openwrt.org/feed/routing.git
src-git telephony https://git.openwrt.org/feed/telephony.git
src-git nss_packages https://github.com/qosmio/nss-packages.git;NSS-12.5-K6.x
src-git sqm_scripts_nss https://github.com/qosmio/sqm-scripts-nss.git
#src-git video https://github.com/openwrt/video.git
#src-git targets https://github.com/openwrt/targets.git
#src-git oldpackages http://git.openwrt.org/packages.git
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--- a/ath10k-6.4/mac.c
+++ b/ath10k-6.4/mac.c
@@ -6362,13 +6362,13 @@
ath10k_dbg(ar, ATH10K_DBG_MAC, "mac set txbf conf, value: 0x%x\n",
value);
return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
ar->wmi.vdev_param->txbf, value);
}

-static void ath10k_update_vif_offload(struct ieee80211_hw *hw,
+static int ath10k_update_vif_offload(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
{
struct ath10k_vif *arvif = (void *)vif->drv_priv;
struct ath10k *ar = hw->priv;
u32 vdev_param;
int ret;
@@ -6384,14 +6384,16 @@
ATH10K_HW_TXRX_NATIVE_WIFI);
/* 10.X firmware does not support this VDEV parameter. Do not warn */
if (ret && ret != -EOPNOTSUPP) {
ath10k_warn(ar, "failed to set vdev %i TX encapsulation: %d\n",
arvif->vdev_id, ret);
}
+
+ return ret;
}

/*
* TODO:
* Figure out how to handle WMI_VDEV_SUBTYPE_P2P_DEVICE,
* because we will send mgmt frames without CCK. This requirement
11 changes: 10 additions & 1 deletion package/kernel/cryptodev-linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,22 @@ define KernelPackage/cryptodev/description
hardware ciphers by user-space applications.
endef

ifneq ($(CONFIG_PACKAGE_kmod-crypto-qce),)
EXTRA_CFLAGS+=-DQCA
endif

ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-crypto),)
EXTRA_CFLAGS+=-DQCANSS
endif

define Build/Configure
endef

define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
$(KERNEL_MAKE_FLAGS) \
KERNEL_DIR="$(LINUX_DIR)"
KERNEL_DIR="$(LINUX_DIR)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)"
endef

define Build/InstallDev
Expand Down
99 changes: 99 additions & 0 deletions package/kernel/cryptodev-linux/patches/0005-add-qca-nss.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
--- a/ioctl.c
+++ b/ioctl.c
@@ -829,29 +829,37 @@ static inline void tfm_info_to_alg_info(
"%s", crypto_tfm_alg_driver_name(tfm));
}

-#ifndef CRYPTO_ALG_KERN_DRIVER_ONLY
+#if defined(QCANSS) || defined(QCA) || defined(MT7621) || defined(MT7622) || defined(LANTIQ) || defined(BCM675X) || defined(BCM49XX) || defined(MT798X)
static unsigned int is_known_accelerated(struct crypto_tfm *tfm)
{
const char *name = crypto_tfm_alg_driver_name(tfm);

if (name == NULL)
- return 1; /* assume accelerated */
+ return 0;

/* look for known crypto engine names */
- if (strstr(name, "-talitos") ||
- !strncmp(name, "mv-", 3) ||
- !strncmp(name, "atmel-", 6) ||
- strstr(name, "geode") ||
- strstr(name, "hifn") ||
- strstr(name, "-ixp4xx") ||
- strstr(name, "-omap") ||
- strstr(name, "-picoxcell") ||
- strstr(name, "-s5p") ||
- strstr(name, "-ppc4xx") ||
- strstr(name, "-caam") ||
- strstr(name, "-n2"))
+#if defined(QCANSS)
+ if (!strncmp(name, "nss-", 4))
return 1;
-
+#elif defined(QCA)
+ if (!strncmp(name, "qcrypto", 7))
+ return 1;
+#elif defined(MT7621)
+ if (strstr(name, "eip93"))
+ return 1;
+#elif defined(MT7622)
+ if (strstr(name, "mtk"))
+ return 1;
+#elif defined(MT798X)
+ if (strstr(name, "safexcel-"))
+ return 1;
+#elif defined(LANTIQ)
+ if (strstr(name, "ltq-crypto"))
+ return 1;
+#elif defined(BCM675X) || defined(BCM49XX)
+ if (strstr(name, "-iproc"))
+ return 1;
+#endif
return 0;
}
#endif
@@ -876,22 +884,22 @@ static int get_session_info(struct fcryp
else
tfm = crypto_aead_tfm(ses_ptr->cdata.async.as);
tfm_info_to_alg_info(&siop->cipher_info, tfm);
-#ifdef CRYPTO_ALG_KERN_DRIVER_ONLY
- if (tfm->__crt_alg->cra_flags & CRYPTO_ALG_KERN_DRIVER_ONLY)
+#if defined(QCANSS) || defined(QCA) || defined(MT7621) || defined(MT7622) || defined(LANTIQ) || defined(BCM675X) || defined(BCM49XX) || defined(MT798X)
+ if (is_known_accelerated(tfm))
siop->flags |= SIOP_FLAG_KERNEL_DRIVER_ONLY;
#else
- if (is_known_accelerated(tfm))
+ if (tfm->__crt_alg->cra_flags & CRYPTO_ALG_KERN_DRIVER_ONLY)
siop->flags |= SIOP_FLAG_KERNEL_DRIVER_ONLY;
#endif
}
if (ses_ptr->hdata.init) {
tfm = crypto_ahash_tfm(ses_ptr->hdata.async.s);
tfm_info_to_alg_info(&siop->hash_info, tfm);
-#ifdef CRYPTO_ALG_KERN_DRIVER_ONLY
- if (tfm->__crt_alg->cra_flags & CRYPTO_ALG_KERN_DRIVER_ONLY)
+#if defined(QCANSS) || defined(QCA) || defined(MT7621) || defined(MT7622) || defined(LANTIQ) || defined(BCM675X) || defined(BCM49XX) || defined(MT798X)
+ if (is_known_accelerated(tfm))
siop->flags |= SIOP_FLAG_KERNEL_DRIVER_ONLY;
#else
- if (is_known_accelerated(tfm))
+ if (tfm->__crt_alg->cra_flags & CRYPTO_ALG_KERN_DRIVER_ONLY)
siop->flags |= SIOP_FLAG_KERNEL_DRIVER_ONLY;
#endif
}
--- a/main.c
+++ b/main.c
@@ -168,6 +168,12 @@ __crypto_run_zc(struct csession *ses_ptr
struct crypt_op *cop = &kcop->cop;
int ret = 0;

+#if defined(QCANSS)
+//openssl bug!!!
+ if (unlikely(cop->src != cop->dst)) {
+ return __crypto_run_std(ses_ptr, cop);
+ }
+#endif
ret = get_userbuf(ses_ptr, cop->src, cop->len, cop->dst, cop->len,
kcop->task, kcop->mm, &src_sg, &dst_sg);
if (unlikely(ret)) {
17 changes: 17 additions & 0 deletions package/kernel/linux/modules/crypto.mk
Original file line number Diff line number Diff line change
Expand Up @@ -1159,3 +1159,20 @@ endef

$(eval $(call KernelPackage,crypto-xts))

define KernelPackage/crypto-qce
TITLE:=QTI Crypto Engine (QCE)
KCONFIG:= \
CONFIG_CRYPTO_DEV_QCE \
CONFIG_CRYPTO_DEV_QCE_AEAD=y \
CONFIG_CRYPTO_DEV_QCE_ENABLE_ALL=y \
CONFIG_CRYPTO_DEV_QCE_SHA=y \
CONFIG_CRYPTO_DEV_QCE_SKCIPHER=y \
CONFIG_CRYPTO_DEV_QCE_SW_MAX_LEN=512
FILES:= \
$(LINUX_DIR)/drivers/crypto/qce/qcrypto.ko
AUTOLOAD:=$(call AutoLoad,09,qcrypto)
DEPENDS:=@TARGET_qualcommax +kmod-crypto-manager +kmod-crypto-hash +kmod-crypto-des
$(call AddDepends/crypto)
endef

$(eval $(call KernelPackage,crypto-qce))
1 change: 1 addition & 0 deletions package/kernel/linux/modules/netfilter.mk
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ $(eval $(call KernelPackage,ipt-offload))
define KernelPackage/ipt-ipopt
TITLE:=Modules for matching/changing IP packet options
KCONFIG:=$(KCONFIG_IPT_IPOPT)
DEPENDS:=+PACKAGE_kmod-nf-conntrack:kmod-nf-conntrack
FILES:=$(foreach mod,$(IPT_IPOPT-m),$(LINUX_DIR)/net/$(mod).ko)
AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_IPOPT-m)))
$(call AddDepends/ipt)
Expand Down
53 changes: 50 additions & 3 deletions package/kernel/mac80211/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mac80211

PKG_VERSION:=6.6.15
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_LICENSE:=GPL-2.0-only
PKG_LICENSE_FILES:=COPYING

Expand All @@ -36,14 +36,18 @@ PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_MAC80211_DEBUGFS \
CONFIG_PACKAGE_MAC80211_MESH \
CONFIG_PACKAGE_MAC80211_TRACING \
CONFIG_PACKAGE_MAC80211_NSS_SUPPORT \
CONFIG_PACKAGE_MAC80211_NSS_REDIRECT \
CONFIG_PACKAGE_IWLWIFI_DEBUG \
CONFIG_PACKAGE_IWLWIFI_DEBUGFS \
CONFIG_PACKAGE_RTLWIFI_DEBUG \
CONFIG_PACKAGE_RTLWIFI_DEBUG

include $(INCLUDE_DIR)/package.mk

WMENU:=Wireless Drivers

NSS_PATCH:= subsys ath10k ath11k

define KernelPackage/mac80211/Default
SUBMENU:=$(WMENU)
URL:=https://wireless.wiki.kernel.org/
Expand Down Expand Up @@ -129,17 +133,37 @@ define KernelPackage/mac80211
$(call KernelPackage/mac80211/Default)
TITLE:=Linux 802.11 Wireless Networking Stack
# +kmod-crypto-cmac is a runtime only dependency of net/mac80211/aes_cmac.c
DEPENDS+= +kmod-cfg80211 +kmod-crypto-cmac +kmod-crypto-ccm +kmod-crypto-gcm +hostapd-common
DEPENDS+= +kmod-cfg80211 +kmod-crypto-cmac +kmod-crypto-ccm +kmod-crypto-gcm +hostapd-common \
+ATH11K_NSS_SUPPORT:kmod-qca-nss-drv
KCONFIG:=\
CONFIG_AVERAGE=y
FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko
ifdef CONFIG_PACKAGE_MAC80211_NSS_REDIRECT
AUTOLOAD:=$(call AutoProbe, mac80211)
MODPARAMS.mac80211:=nss_redirect=1
endif
ABI_VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
MENU:=1
endef

define KernelPackage/mac80211/config
if PACKAGE_kmod-mac80211

if PACKAGE_kmod-qca-nss-drv
config PACKAGE_MAC80211_NSS_SUPPORT
bool "Enable NSS support"
default y
help
This option enables support for NSS in QCA boards.
config PACKAGE_MAC80211_NSS_REDIRECT
bool "Enable autoloading with 'nss_redirect=1' (not needed on ath11k)"
depends on PACKAGE_MAC80211_NSS_SUPPORT
default n
help
This option enables autoloading mac80211 with 'nss_redirect=1'.
However, it is not required for wifi offloading.
endif

config PACKAGE_MAC80211_DEBUGFS
bool "Export mac80211 internals in DebugFS"
select KERNEL_DEBUG_FS
Expand Down Expand Up @@ -281,6 +305,12 @@ ifeq ($(BUILD_VARIANT),smallbuffers)
C_DEFINES+= -DCONFIG_ATH10K_SMALLBUFFERS
endif

ifdef CONFIG_ATH11K_NSS_SUPPORT
IREMAP_CFLAGS+=-I$(STAGING_DIR)/usr/include/qca-nss-drv -I$(STAGING_DIR)/usr/include/qca-nss-clients
endif

config-$(CONFIG_PACKAGE_MAC80211_NSS_SUPPORT) += MAC80211_NSS_SUPPORT

MAKE_OPTS:= \
$(subst -C $(LINUX_DIR),-C "$(PKG_BUILD_DIR)",$(KERNEL_MAKEOPTS)) \
EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/include $(IREMAP_CFLAGS) $(C_DEFINES)" \
Expand Down Expand Up @@ -349,6 +379,11 @@ define Build/Patch
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath9k,ath9k/)
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath10k,ath10k/)
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath11k,ath11k/)
ifdef CONFIG_ATH11K_NSS_SUPPORT
$(foreach driver,$(NSS_PATCH),
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/nss/$(driver),nss/$(driver)/)
)
endif
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rt2x00,rt2x00/)
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mt7601u,mt7601u/)
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mwl,mwl/)
Expand All @@ -365,6 +400,11 @@ define Quilt/Refresh/Package
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath9k,ath9k/)
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath10k,ath10k/)
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath11k,ath11k/)
ifdef CONFIG_ATH11K_NSS_SUPPORT
$(foreach driver,$(NSS_PATCH),
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/nss/$(driver),nss/$(driver)/)
)
endif
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rt2x00,rt2x00/)
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mt7601u,mt7601u/)
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mwl,mwl/)
Expand All @@ -391,6 +431,13 @@ define Build/InstallDev
rm -f $(1)/usr/include/mac80211-backport/linux/module.h
endef

ifdef CONFIG_ATH11K_NSS_SUPPORT
define KernelPackage/ath11k/install
$(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/config
$(INSTALL_BIN) ./files/qca-nss-pbuf.init $(1)/etc/init.d/qca-nss-pbuf
$(INSTALL_BIN) ./files/pbuf.uci $(1)/etc/config/pbuf
endef
endif

$(eval $(foreach drv,$(PKG_DRIVERS),$(call KernelPackage,$(drv))))
$(eval $(call KernelPackage,cfg80211))
Expand Down
Loading

0 comments on commit 79fa74b

Please sign in to comment.