[qca-nss-drv] 2K SKB size support for 512MB 32 bit premium profile
Necessary changes to restrict SKB buffer allocation size
to 2KB for 512MB premium profile. This is applicable only
for 32 bit build.
Change-Id: Ide70b52afe8131e034ee8c143df6b83834b77908
Signed-off-by: Amit Gupta <amitgupt@codeaurora.org>
diff --git a/nss_hlos_if.h b/nss_hlos_if.h
index 0d9bbf2..7d2c50c 100644
--- a/nss_hlos_if.h
+++ b/nss_hlos_if.h
@@ -34,6 +34,7 @@
#if defined (NSS_MEM_PROFILE_LOW)
#define NSS_DEFAULT_NUM_CONN 512 /* Default number of connections for IPv4 and IPv6 each, for low memory profile */
#define NSS_MAX_TOTAL_NUM_CONN_IPV4_IPV6 1024 /* MAX Connection shared between IPv4 and IPv6 for low memory profile */
+#define NSS_LOW_MEM_EMPTY_POOL_BUF_SZ 4096 /* Default empty buffer pool size for low profile */
#elif defined (NSS_MEM_PROFILE_MEDIUM)
#define NSS_DEFAULT_NUM_CONN 2048 /* Default number of connections for IPv4 and IPv6 each, for medium memory profile */
#define NSS_MAX_TOTAL_NUM_CONN_IPV4_IPV6 4096 /* MAX Connection shared between IPv4 and IPv6 for medium memory profile */
@@ -42,11 +43,12 @@
#define NSS_MAX_TOTAL_NUM_CONN_IPV4_IPV6 8192 /* MAX Connection shared between IPv4 and IPv6 */
#endif
-#if defined (NSS_MEM_PROFILE_LOW)
-#define NSS_EMPTY_BUFFER_SIZE 1792 /* Default buffer size for low profile. */
-#define NSS_LOW_MEM_EMPTY_POOL_BUF_SZ 4096 /* Default empty buffer pool size for low profile */
+#if defined(NSS_SKB_FIXED_SIZE_2K) && !defined(__LP64__)
+#define NSS_EMPTY_BUFFER_SIZE 1792 /* Default buffer size for reduced memory profiles. */
+#define NSS_FIXED_BUFFER_SIZE /* For low memory profiles, maximum buffer size/MTU is fixed */
#else
-#define NSS_EMPTY_BUFFER_SIZE 1984 /* Default buffer size for medium and high profile. */
+#define NSS_EMPTY_BUFFER_SIZE 1984 /* Default buffer size for regular memory profiles. */
+#undef NSS_FIXED_BUFFER_SIZE
#endif
enum {
diff --git a/nss_phys_if.c b/nss_phys_if.c
index 1257f03..60e5888 100644
--- a/nss_phys_if.c
+++ b/nss_phys_if.c
@@ -432,7 +432,7 @@
/*
* We disallow MTU changes for low memory profiles in order to keep the buffer size constant
*/
-#ifdef NSS_MEM_PROFILE_LOW
+#ifdef NSS_FIXED_BUFFER_SIZE
if (mtu > ETH_DATA_LEN) {
nss_info_always("MTU change beyond 1500 restricted for low memory profile \n");
return NSS_TX_FAILURE;
@@ -476,7 +476,7 @@
* to it due to MTU changes. Also, NSS_EMPTY_BUFFER_SIZE includes the
* PAD and ETH_HLEN, and is aligned to SMP_CACHE_BYTES
*/
-#ifndef NSS_MEM_PROFILE_LOW
+#ifndef NSS_FIXED_BUFFER_SIZE
nss_ctx->max_buf_size = ((mtu_sz + ETH_HLEN + SMP_CACHE_BYTES - 1) & ~(SMP_CACHE_BYTES - 1)) + NSS_NBUF_ETH_EXTRA + NSS_NBUF_PAD_EXTRA;
/*