diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index e8839d3a75591960cf169b20f32fe951e6ac314f..8d5f97b03906958ac1af8d7c18c520b2ed754496 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -117,6 +117,10 @@
  */
 #define CRYPTO_NOLOAD			0x00008000
 
+#if defined(CONFIG_BLOG) && defined(CONFIG_BCM_KF_BLOG)
+#define CRYPTO_ALG_BLOG			0x80000000
+#endif
+
 /*
  * Transform masks and values (for crt_flags).
  */
@@ -128,6 +132,9 @@
 #define CRYPTO_TFM_REQ_WEAK_KEY		0x00000100
 #define CRYPTO_TFM_REQ_MAY_SLEEP	0x00000200
 #define CRYPTO_TFM_REQ_MAY_BACKLOG	0x00000400
+#if defined(CONFIG_BLOG) && defined(CONFIG_BCM_KF_BLOG)
+#define CRYPTO_TFM_REQ_MAY_BLOG		0x00080000
+#endif
 #define CRYPTO_TFM_RES_WEAK_KEY		0x00100000
 #define CRYPTO_TFM_RES_BAD_KEY_LEN   	0x00200000
 #define CRYPTO_TFM_RES_BAD_KEY_SCHED 	0x00400000
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index ff60ba537cf2c7710bb2c22c53234b8815db76a2..9632674905579ebf0c2fe04faae8d70754fe6477 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -12,6 +12,9 @@
 #include <linux/blkdev.h>
 #include <linux/math64.h>
 #include <linux/ratelimit.h>
+#if defined(CONFIG_BCM_KF_DM_CREATE_BACKPORT)
+#include <linux/dm-ioctl.h>
+#endif //defined(CONFIG_BCM_KF_DM_CREATE_BACKPORT)
 
 struct dm_dev;
 struct dm_target;
@@ -426,6 +429,16 @@ void dm_remap_zone_report(struct dm_target *ti, struct bio *bio,
 			  sector_t start);
 union map_info *dm_get_rq_mapinfo(struct request *rq);
 
+#if defined(CONFIG_BCM_KF_DM_CREATE_BACKPORT)
+/*
+ * Device mapper functions to parse and create devices specified by the
+ * parameter "dm-mod.create="
+ */
+int __init dm_early_create(struct dm_ioctl *dmi,
+			   struct dm_target_spec **spec_array,
+			   char **target_params_array);
+#endif //defined(CONFIG_BCM_KF_DM_CREATE_BACKPORT)
+
 struct queue_limits *dm_get_queue_limits(struct mapped_device *md);
 
 /*
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 60afff19d7fcd23336fee68e48f0fb5c4b988500..6dac2140945443e49fc4c3ff92e7fd51920defb5 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -81,7 +81,11 @@ static inline bool is_vlan_dev(const struct net_device *dev)
 }
 
 #define skb_vlan_tag_present(__skb)	((__skb)->vlan_tci & VLAN_TAG_PRESENT)
+#if defined(CONFIG_BCM_KF_VLAN_DEI) && (defined(CONFIG_BCM_VLAN) || defined(CONFIG_BCM_VLAN_MODULE))
+#define skb_vlan_tag_get(__skb)		(((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) | skbuff_bcm_ext_vlan_get(__skb, cfi_save))
+#else
 #define skb_vlan_tag_get(__skb)		((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
+#endif
 #define skb_vlan_tag_get_id(__skb)	((__skb)->vlan_tci & VLAN_VID_MASK)
 #define skb_vlan_tag_get_prio(__skb)	((__skb)->vlan_tci & VLAN_PRIO_MASK)
 
@@ -477,7 +481,14 @@ static inline struct sk_buff *__vlan_hwaccel_push_inside(struct sk_buff *skb)
 	skb = vlan_insert_tag_set_proto(skb, skb->vlan_proto,
 					skb_vlan_tag_get(skb));
 	if (likely(skb))
+#if defined(CONFIG_BCM_KF_VLAN_DEI) && (defined(CONFIG_BCM_VLAN) || defined(CONFIG_BCM_VLAN_MODULE))
+	{
+		skbuff_bcm_ext_vlan_get(skb, cfi_save) = 0;
 		skb->vlan_tci = 0;
+	}
+#else
+		skb->vlan_tci = 0;
+#endif
 	return skb;
 }
 
@@ -494,6 +505,9 @@ static inline void __vlan_hwaccel_put_tag(struct sk_buff *skb,
 {
 	skb->vlan_proto = vlan_proto;
 	skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci;
+#if defined(CONFIG_BCM_KF_VLAN_DEI) && (defined(CONFIG_BCM_VLAN) || defined(CONFIG_BCM_VLAN_MODULE))
+        skbuff_bcm_ext_vlan_get(skb, cfi_save) = vlan_tci & VLAN_CFI_MASK;
+#endif
 }
 
 /**
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 1f96ce2b47df1f21548ed892ba58af4bb5622c2a..5f18dedc0f346770ba9f04a64ae2501172196335 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -168,7 +168,14 @@ static inline bool kallsyms_show_value(const struct cred *cred)
 
 static inline void print_ip_sym(unsigned long ip)
 {
+#if defined(CONFIG_BCM_KF_EXTRA_DEBUG)
+	if (( is_kernel_text(ip) || is_kernel_inittext(ip)) || (ip >= MODULES_VADDR && ip < MODULES_END))
+		printk("[<%p>] %pS\n", (void *) ip, (void *) ip);
+	else
+		printk("[<%p>] (suspected corrupt symbol)\n", (void *) ip);
+#else
 	printk("[<%px>] %pS\n", (void *) ip, (void *) ip);
+#endif
 }
 
 #endif /*_LINUX_KALLSYMS_H*/
diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index a4be6b2bcc35a45a541516be2dc6c5389ba3a840..c3a91e517148f89b38e49c9e0e545842bcc90c95 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -198,6 +198,15 @@ enum nand_ecc_algo {
  */
 #define NAND_USE_BOUNCE_BUFFER	0x00100000
 
+#if defined(CONFIG_BCM_KF_MTD_BCMNAND)
+/* For Hynix MLC flashes, the BI are written to last and (last-2) pages. */
+#define NAND_SCAN_BI_3RD_PAGE   0x10000000
+
+/* NOP=1 NAND SLC device */
+#define NAND_PAGE_NOP1          0x20000000
+#endif
+
+
 /*
  * In case your controller is implementing ->cmd_ctrl() and is relying on the
  * default ->cmdfunc() implementation, you may want to let the core handle the
@@ -1331,6 +1340,13 @@ struct nand_chip {
 	uint16_t ecc_strength_ds;
 	uint16_t ecc_step_ds;
 	int onfi_timing_mode_default;
+#if defined(CONFIG_BCM_KF_MTD_BCMNAND)
+	/* Before ONFI auto timing adjustment in kernel, add Broadcom specific timing
+	* parameters for better performnace.
+	*/
+	uint32_t timing_1;
+	uint32_t timing_2;
+#endif
 	int badblockpos;
 	int badblockbits;
 
@@ -1518,6 +1534,13 @@ struct nand_flash_dev {
 		uint16_t step_ds;
 	} ecc;
 	int onfi_timing_mode_default;
+#if defined(CONFIG_BCM_KF_MTD_BCMNAND)
+	/* before ONFI auto timing adjustment in kernel, add Broadcom specific timing
+	 * parameters for better performnace.
+	 */
+	uint32_t timing_1;
+	uint32_t timing_2;
+#endif
 };
 
 /**
diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
index 9cdee97adb21dca91854484f79e497cd74958435..e450d6eea78fcecdfae6373892fc7840a0f33822 100644
--- a/include/linux/mtd/spinand.h
+++ b/include/linux/mtd/spinand.h
@@ -230,6 +230,9 @@ extern const struct spinand_manufacturer micron_spinand_manufacturer;
 extern const struct spinand_manufacturer paragon_spinand_manufacturer;
 extern const struct spinand_manufacturer toshiba_spinand_manufacturer;
 extern const struct spinand_manufacturer winbond_spinand_manufacturer;
+#ifdef CONFIG_BCM_KF_MTD_BCMNAND
+extern const struct spinand_manufacturer broadcom_spinand_manufacturer;
+#endif
 
 /**
  * struct spinand_op_variants - SPI NAND operation variants
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 4c76fe2c84880fa24bebc7826d19801a10466bfd..6e9079c570285b6dcbb1bd591542b3cf2c787055 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -86,6 +86,10 @@ enum {
 	NETIF_F_GRO_HW_BIT,		/* Hardware Generic receive offload */
 	NETIF_F_HW_TLS_RECORD_BIT,	/* Offload TLS record */
 
+#if defined(CONFIG_BCM_KF_EXTSTATS)
+	NETIF_F_EXTSTATS_BIT,		/* Support extended statistics */
+#endif
+
 	/*
 	 * Add your fresh new feature above and remember to update
 	 * netdev_features_strings[] in net/core/ethtool.c and maybe
@@ -156,6 +160,10 @@ enum {
 #define NETIF_F_HW_TLS_TX	__NETIF_F(HW_TLS_TX)
 #define NETIF_F_HW_TLS_RX	__NETIF_F(HW_TLS_RX)
 
+#if defined(CONFIG_BCM_KF_EXTSTATS)
+#define NETIF_F_EXTSTATS	__NETIF_F(EXTSTATS)
+#endif
+
 /* Finds the next feature with the highest number of the range of start till 0.
  */
 static inline int find_next_netdev_feature(u64 feature, unsigned long start)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 3272b2364e2cbb7fefae2da8c1ed0aa602fb0c48..8038c6dd746502ca95590d8d57fe21d75d0c2fde 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -25,6 +25,7 @@
 #ifndef _LINUX_NETDEVICE_H
 #define _LINUX_NETDEVICE_H
 
+
 #include <linux/timer.h>
 #include <linux/bug.h>
 #include <linux/delay.h>
@@ -53,6 +54,11 @@
 #include <uapi/linux/pkt_cls.h>
 #include <linux/hashtable.h>
 
+
+#if defined(CONFIG_BCM_KF_NETDEV_EXT)
+#include <linux/bcm_netdevice.h>
+#endif /* CONFIG_BCM_KF_NETDEV_EXT */
+
 struct netpoll_info;
 struct device;
 struct phy_device;
@@ -186,6 +192,16 @@ struct net_device_stats {
 	unsigned long	tx_window_errors;
 	unsigned long	rx_compressed;
 	unsigned long	tx_compressed;
+#if defined(CONFIG_BCM_KF_EXTSTATS)
+	unsigned long   tx_multicast_packets;  /* multicast packets transmitted */
+	unsigned long   rx_multicast_bytes;  /* multicast bytes recieved */ 
+	unsigned long   tx_multicast_bytes;  /* multicast bytes transmitted */
+	unsigned long   rx_broadcast_packets;  /* broadcast packets recieved */
+	unsigned long   tx_broadcast_packets;  /* broadcast packets transmitted */
+	/* NOTE: Unicast packets are not counted but are instead calculated as needed
+		using total - (broadcast + multicast) */
+	unsigned long   rx_unknown_packets;  /* unknown protocol packets recieved */
+#endif
 };
 
 
@@ -1819,6 +1835,11 @@ struct net_device {
 
 	struct net_device_stats	stats;
 
+
+#if defined(CONFIG_BCM_KF_NETDEV_EXT)
+    struct bcm_netdev_ext bcm_nd_ext;
+#endif
+
 	atomic_long_t		rx_dropped;
 	atomic_long_t		tx_dropped;
 	atomic_long_t		rx_nohandler;
@@ -4650,6 +4671,7 @@ static inline bool netif_reduces_vlan_mtu(struct net_device *dev)
 
 extern struct pernet_operations __net_initdata loopback_net_ops;
 
+
 /* Logging, debugging and troubleshooting/diagnostic helpers. */
 
 /* netdev_printk helpers, similar to dev_printk */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 2fda9893962d15749eaaa116a84a7a31b099a8a4..bcc6373ac583f480b9286c5b54171e8ecaddfed1 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1539,6 +1539,9 @@ void pci_cfg_access_unlock(struct pci_dev *dev);
  */
 #ifdef CONFIG_PCI_DOMAINS
 extern int pci_domains_supported;
+#ifdef CONFIG_BCM_KF_PCI_RESET_DOMAIN_NR
+void pci_reset_domain_nr(void);
+#endif /* CONFIG_BCM_KF_PCI_RESET_DOMAIN_NR */
 #else
 enum { pci_domains_supported = 0 };
 static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c69f308f3a53c7c4b3e59447d74f64fbce1ed403..b9467f5a970f1942f51470e000c8f9a2a0b0b9d7 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -661,6 +661,10 @@ struct task_struct {
 	unsigned int			policy;
 	int				nr_cpus_allowed;
 	cpumask_t			cpus_allowed;
+#if defined(CONFIG_BCM_KF_CPU_AFFINITY_HINT) && \
+	defined(CONFIG_BCM_PROC_CPU_AFFINITY_HINT)
+	cpumask_t			cpus_hint;
+#endif
 
 #ifdef CONFIG_PREEMPT_RCU
 	int				rcu_read_lock_nesting;
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index d6b0fbef8aaa7ecd054463778a850361d3542073..14446f37b0fbf73f8c565244a88da4c971610ff9 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -250,7 +250,7 @@ struct nf_conntrack {
 };
 #endif
 
-#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
+#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) || defined(CONFIG_BCM_KF_SKB_EXT)
 struct nf_bridge_info {
 	refcount_t		use;
 	enum {
@@ -491,6 +491,11 @@ int skb_zerocopy_iter_stream(struct sock *sk, struct sk_buff *skb,
  * the end of the header data, ie. at skb->end.
  */
 struct skb_shared_info {
+#if defined(CONFIG_BCM_KF_NBUFF)
+	/* to preserve compat with binary only modules, do not change the
+	 * position of this field relative to the start of the structure. */
+	__u8		*dirty_p;
+#endif	/* defined(CONFIG_BCM_KF_NBUFF) */
 	__u8		__unused;
 	__u8		meta_len;
 	__u8		nr_frags;
@@ -587,6 +592,10 @@ typedef unsigned int sk_buff_data_t;
 typedef unsigned char *sk_buff_data_t;
 #endif
 
+#if defined(CONFIG_BCM_KF_SKB_EXT)
+#include <linux/bcm_skbuff.h>
+#endif
+
 /** 
  *	struct sk_buff - socket buffer
  *	@next: Next buffer in list
@@ -662,7 +671,14 @@ typedef unsigned char *sk_buff_data_t;
  *	@users: User count - see {datagram,tcp}.c
  */
 
+#if defined(CONFIG_BCM_KF_SKB_EXT)
+/*
+ * Please note struct sk_buff is moved to bcm_skbuff.h. Here is no longer used.
+ */
+struct sk_buff_orig {
+#else
 struct sk_buff {
+#endif
 	union {
 		struct {
 			/* These two members must be first. */
@@ -697,7 +713,11 @@ struct sk_buff {
 	 * want to keep them across layers you have to do a skb_clone()
 	 * first. This is owned by whoever has the skb queued ATM.
 	 */
+#if !defined(CONFIG_BCM_KF_MPTCP) || !defined(CONFIG_BCM_MPTCP)
 	char			cb[48] __aligned(8);
+#else
+	char			cb[80] __aligned(8);
+#endif
 
 	union {
 		struct {
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index a64235e053216b9de52089c1ab4d85fb0b3b2d5b..affd288916e4a17bcce633562047b384f0ff375b 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -794,6 +794,37 @@ struct spi_transfer {
 	u16		delay_usecs;
 	u32		speed_hz;
 
+#if defined(CONFIG_BCM_KF_SPI)
+	/* added for controllers that support an ignore count for read
+	 operations. This is useful if the read requires command bytes
+	 and you want to ignore the read data on the bus during the
+	 transmission of those bytes. Note that only prepend_cnt bytes
+	 of data will be written from tx_buf.
+	*/
+	u8  prepend_cnt;
+
+	/* added for multibit support
+	 @multi_bit_en - enable multibit operation for this transfer
+	 @multi_bit_start_offset - start offset for multibit data
+	*/
+	u8  multi_bit_en;
+	u8  multi_bit_start_offset;
+
+	/* added for controllers that do not support large transfers
+	 the controller will break up the transfer into smaller
+	 transfers to avoid additional data copies
+	 Note that hdr_len should not be included in len
+	 @hdr_len - length of header
+	 @unit_size - data for each transfer will be divided into multiples of
+	          unit_size
+	 @adr_len - length of address field (max 4 bytes)
+	 @adr_offset - offset of first addr byte in header
+	*/
+	u8  hdr_len;
+	u8  unit_size;
+	u8  addr_len;
+	u8  addr_offset;
+#endif
 	struct list_head transfer_list;
 };
 
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 1192f1e76015f2104990baa96fb638f303389ca9..396394f320b259887e46c7f6b39a4135287a58c1 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -58,7 +58,11 @@ static inline unsigned int tcp_optlen(const struct sk_buff *skb)
 /* TCP Fast Open */
 #define TCP_FASTOPEN_COOKIE_MIN	4	/* Min Fast Open Cookie size in bytes */
 #define TCP_FASTOPEN_COOKIE_MAX	16	/* Max Fast Open Cookie size in bytes */
+#if !defined(CONFIG_BCM_KF_MPTCP) || !defined(CONFIG_BCM_MPTCP)
 #define TCP_FASTOPEN_COOKIE_SIZE 8	/* the size employed by this impl. */
+#else
+#define TCP_FASTOPEN_COOKIE_SIZE 4	/* the size employed by this impl. */
+#endif
 
 /* TCP Fast Open Cookie as stored in memory */
 struct tcp_fastopen_cookie {
@@ -83,6 +87,58 @@ struct tcp_sack_block {
 	u32	end_seq;
 };
 
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+struct tcp_out_options {
+	u16 options;		/* bit field of OPTION_* */
+	u16 mss;		/* 0 to disable */
+	u8 ws;			/* window scale, 0 to disable */
+	u8 num_sack_blocks;	/* number of SACK blocks to include */
+	u8 hash_size;		/* bytes in hash_location */
+	__u8 *hash_location;	/* temporary pointer, overloaded */
+	__u32 tsval, tsecr;	/* need to include OPTION_TS */
+	struct tcp_fastopen_cookie *fastopen_cookie;	/* Fast open cookie */
+#ifdef CONFIG_MPTCP
+	u16	mptcp_options;	/* bit field of MPTCP related OPTION_* */
+	u8	dss_csum:1,	/* dss-checksum required? */
+		add_addr_v4:1,
+		add_addr_v6:1,
+		mptcp_ver:4;
+
+	union {
+		struct {
+			__u64	sender_key;	/* sender's key for mptcp */
+			__u64	receiver_key;	/* receiver's key for mptcp */
+		} mp_capable;
+
+		struct {
+			__u64	sender_truncated_mac;
+			__u32	sender_nonce;
+					/* random number of the sender */
+			__u32	token;	/* token for mptcp */
+			u8	low_prio:1;
+		} mp_join_syns;
+	};
+
+	struct {
+		__u64 trunc_mac;
+		struct in_addr addr;
+		u16 port;
+		u8 addr_id;
+	} add_addr4;
+
+	struct {
+		__u64 trunc_mac;
+		struct in6_addr addr;
+		u16 port;
+		u8 addr_id;
+	} add_addr6;
+
+	u16	remove_addrs;	/* list of address id */
+	u8	addr_id;	/* address id (mp_join or add_address) */
+#endif /* CONFIG_MPTCP */
+};
+
+#endif
 /*These are used to set the sack_ok field in struct tcp_options_received */
 #define TCP_SACK_SEEN     (1 << 0)   /*1 = peer is SACK capable, */
 #define TCP_DSACK_SEEN    (1 << 2)   /*1 = DSACK was received from peer*/
@@ -106,6 +162,11 @@ struct tcp_options_received {
 	u16	mss_clamp;	/* Maximal mss, negotiated at connection setup */
 };
 
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+struct mptcp_cb;
+struct mptcp_tcp_sock;
+
+#endif
 static inline void tcp_clear_options(struct tcp_options_received *rx_opt)
 {
 	rx_opt->tstamp_ok = rx_opt->sack_ok = 0;
@@ -144,6 +205,10 @@ static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
 	return (struct tcp_request_sock *)req;
 }
 
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+struct tcp_md5sig_key;
+
+#endif
 struct tcp_sock {
 	/* inet_connection_sock has to be the first member of tcp_sock */
 	struct inet_connection_sock	inet_conn;
@@ -400,6 +465,46 @@ struct tcp_sock {
 	 */
 	struct request_sock *fastopen_rsk;
 	u32	*saved_syn;
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+
+	/* MPTCP/TCP-specific callbacks */
+	const struct tcp_sock_ops	*ops;
+
+	struct mptcp_cb		*mpcb;
+	struct sock		*meta_sk;
+	/* We keep these flags even if CONFIG_MPTCP is not checked, because
+	 * it allows checking MPTCP capability just by checking the mpc flag,
+	 * rather than adding ifdefs everywhere.
+	 */
+	u32     mpc:1,          /* Other end is multipath capable */
+		inside_tk_table:1, /* Is the tcp_sock inside the token-table? */
+		send_mp_fclose:1,
+		request_mptcp:1, /* Did we send out an MP_CAPABLE?
+				  * (this speeds up mptcp_doit() in tcp_recvmsg)
+				  */
+		pf:1, /* Potentially Failed state: when this flag is set, we
+		       * stop using the subflow
+		       */
+		mp_killed:1, /* Killed with a tcp_done in mptcp? */
+		is_master_sk:1,
+		close_it:1,	/* Must close socket in mptcp_data_ready? */
+		closing:1,
+		mptcp_ver:4,
+		mptcp_sched_setsockopt:1,
+		mptcp_pm_setsockopt:1,
+		record_master_info:1,
+		tcp_disconnect:1;
+	struct mptcp_tcp_sock *mptcp;
+#ifdef CONFIG_MPTCP
+#define MPTCP_SCHED_NAME_MAX 16
+#define MPTCP_PM_NAME_MAX 16
+	struct hlist_nulls_node tk_table;
+	u32		mptcp_loc_token;
+	u64		mptcp_loc_key;
+	char		mptcp_sched_name[MPTCP_SCHED_NAME_MAX];
+	char		mptcp_pm_name[MPTCP_PM_NAME_MAX];
+#endif /* CONFIG_MPTCP */
+#endif
 };
 
 enum tsq_enum {
@@ -411,6 +516,10 @@ enum tsq_enum {
 	TCP_MTU_REDUCED_DEFERRED,  /* tcp_v{4|6}_err() could not call
 				    * tcp_v{4|6}_mtu_reduced()
 				    */
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+	MPTCP_PATH_MANAGER_DEFERRED, /* MPTCP deferred creation of new subflows */
+	MPTCP_SUB_DEFERRED, /* A subflow got deferred - process them */
+#endif
 };
 
 enum tsq_flags {
@@ -420,6 +529,10 @@ enum tsq_flags {
 	TCPF_WRITE_TIMER_DEFERRED	= (1UL << TCP_WRITE_TIMER_DEFERRED),
 	TCPF_DELACK_TIMER_DEFERRED	= (1UL << TCP_DELACK_TIMER_DEFERRED),
 	TCPF_MTU_REDUCED_DEFERRED	= (1UL << TCP_MTU_REDUCED_DEFERRED),
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+	TCPF_PATH_MANAGER_DEFERRED	= (1UL << MPTCP_PATH_MANAGER_DEFERRED),
+	TCPF_SUB_DEFERRED		= (1UL << MPTCP_SUB_DEFERRED),
+#endif
 };
 
 static inline struct tcp_sock *tcp_sk(const struct sock *sk)
@@ -442,6 +555,9 @@ struct tcp_timewait_sock {
 #ifdef CONFIG_TCP_MD5SIG
 	struct tcp_md5sig_key	  *tw_md5_key;
 #endif
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+	struct mptcp_tw		  *mptcp_tw;
+#endif
 };
 
 static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk)
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index e2ec3582e54937d3818afed3e253440fc23541a0..ec5af385967a3c9477155e39671e04491d444667 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -63,7 +63,15 @@ struct usbnet {
 	unsigned		interrupt_count;
 	struct mutex		interrupt_mutex;
 	struct usb_anchor	deferred;
+#if (defined(CONFIG_BCM_KF_USBNET) && defined(CONFIG_BCM_USBNET_THREAD))
+	struct task_struct *usbnet_thread;
+	int usbnet_thread_resched;
+	wait_queue_head_t	thread_wq;
+	int pending_rx_skb_thresh;
+	int pending_rx_skb_count;
+#else
 	struct tasklet_struct	bh;
+#endif
 
 	struct pcpu_sw_netstats __percpu *stats64;
 
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 44985c4a1e86214dca6579b42bda3c6d666bcdc9..21b71f9f98f674c77418e913c6e0f8f57bffe77b 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -216,4 +216,8 @@ extern void watchdog_unregister_device(struct watchdog_device *);
 /* devres register variant */
 int devm_watchdog_register_device(struct device *dev, struct watchdog_device *);
 
+#if defined(CONFIG_BCM_KF_WDT)
+extern void watchdog_force_disable( void );
+#endif
+
 #endif  /* ifndef _LINUX_WATCHDOG_H */
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index db2a87981dd46e74b2b79c120feb1350b84e45c4..fe81463f93cdcdd12c262c1217a466d293eca381 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -490,4 +490,8 @@ int if6_proc_init(void);
 void if6_proc_exit(void);
 #endif
 
+#if defined(CONFIG_BCM_KF_IPV6)
+#include <net/bcm_addrconf.h>
+#endif
+
 #endif
diff --git a/include/net/bond_3ad.h b/include/net/bond_3ad.h
index fc3111515f5cbec0a230cfd242c5a8ba9dc24571..01a5db99091fa598813abec5187a076e1d31e1d9 100644
--- a/include/net/bond_3ad.h
+++ b/include/net/bond_3ad.h
@@ -37,6 +37,11 @@
 #define AD_LACP_SLOW 0
 #define AD_LACP_FAST 1
 
+#if defined(CONFIG_BCM_KF_KBONDING) && defined(CONFIG_BCM_KERNEL_BONDING)
+#define BOND_ASYNC_LINKSPEED_OFF	0
+#define BOND_ASYNC_LINKSPEED_ON		1
+#endif /* defined(CONFIG_BCM_KF_KBONDING) && defined(CONFIG_BCM_KERNEL_BONDING) */
+
 typedef struct mac_addr {
 	u8 mac_addr_value[ETH_ALEN];
 } __packed mac_addr_t;
diff --git a/include/net/bond_options.h b/include/net/bond_options.h
index d79d28f5318c239731317739a5933a356c21930e..99102ececd77429530cc598746488cda852d70d3 100644
--- a/include/net/bond_options.h
+++ b/include/net/bond_options.h
@@ -67,6 +67,9 @@ enum {
 	BOND_OPT_AD_ACTOR_SYSTEM,
 	BOND_OPT_AD_USER_PORT_KEY,
 	BOND_OPT_NUM_PEER_NOTIF_ALIAS,
+#if defined(CONFIG_BCM_KF_KBONDING) && defined(CONFIG_BCM_KERNEL_BONDING)
+	BOND_OPT_ASYNC_LINKSPEED,
+#endif /* defined(CONFIG_BCM_KF_KBONDING) && defined(CONFIG_BCM_KERNEL_BONDING) */
 	BOND_OPT_LAST
 };
 
diff --git a/include/net/bonding.h b/include/net/bonding.h
index 8116648873c351a3f2e918da5dd7aad9e1c01873..c935daf9f875465058d4f55dbc0cc2c7ee1765f0 100644
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -132,6 +132,9 @@ struct bond_params {
 
 	/* 2 bytes of padding : see ether_addr_equal_64bits() */
 	u8 ad_actor_system[ETH_ALEN + 2];
+#if defined(CONFIG_BCM_KF_KBONDING) && defined(CONFIG_BCM_KERNEL_BONDING)
+	int async_linkspeed;
+#endif /* defined(CONFIG_BCM_KF_KBONDING) && defined(CONFIG_BCM_KERNEL_BONDING) */
 };
 
 struct bond_parm_tbl {
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 8665bf24e3b7a90964e5a66dddad0c1afb64b701..1b2c7a60717724f527adf9a4df098caaf724a0d8 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -23,6 +23,9 @@
 #include <net/inet_sock.h>
 #include <net/snmp.h>
 #include <net/ip.h>
+#if defined(CONFIG_BCM_KF_MAP) && IS_ENABLED(CONFIG_BCM_MAP)
+#include <net/bcm_icmp.h>
+#endif
 
 struct icmp_err {
   int		errno;
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index 3ca969cbd16117fe15b1521333c5d7a28c8709f7..1ff1a59fcddfa71c927015ef03b5f6d612cbd002 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -2,6 +2,10 @@
 #ifndef _INET_COMMON_H
 #define _INET_COMMON_H
 
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+#include <net/sock.h>
+
+#endif
 extern const struct proto_ops inet_stream_ops;
 extern const struct proto_ops inet_dgram_ops;
 
@@ -14,6 +18,10 @@ struct sock;
 struct sockaddr;
 struct socket;
 
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+int inet_create(struct net *net, struct socket *sock, int protocol, int kern);
+int inet6_create(struct net *net, struct socket *sock, int protocol, int kern);
+#endif
 int inet_release(struct socket *sock);
 int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
 			int addr_len, int flags);
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index fc9d6e37552d32f633181fbb22801edcfb3710dd..8f96d2ddbf5b5c26797cf73d317153ac7d5c2af5 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -29,6 +29,9 @@
 
 struct inet_bind_bucket;
 struct tcp_congestion_ops;
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+struct tcp_options_received;
+#endif
 
 /*
  * Pointers to address related TCP functions
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index a80fd0ac4563283246f4f53cea1ac0cd17b41dab..1d5d65a14e835257378b135a17c9634fed8a2c62 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -83,7 +83,11 @@ struct inet_request_sock {
 #define ireq_state		req.__req_common.skc_state
 #define ireq_family		req.__req_common.skc_family
 
+#if !defined(CONFIG_BCM_KF_MPTCP) || !defined(CONFIG_BCM_MPTCP)
 	u16			snd_wscale : 4,
+#else
+	u32			snd_wscale : 4,
+#endif
 				rcv_wscale : 4,
 				tstamp_ok  : 1,
 				sack_ok	   : 1,
@@ -91,6 +95,10 @@ struct inet_request_sock {
 				ecn_ok	   : 1,
 				acked	   : 1,
 				no_srccheck: 1,
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+				mptcp_rqsk : 1,
+				saw_mpc    : 1,
+#endif
 				smc_ok	   : 1;
 	u32                     ir_mark;
 	union {
diff --git a/include/net/ip.h b/include/net/ip.h
index 5b29f357862dc00b77943a6f7aa1a1d75ce29da2..372296ac0dd209c7b955de1ca019cd61ce3ba3cb 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -594,6 +594,9 @@ enum ip_defrag_users {
 	IP_DEFRAG_VS_FWD,
 	IP_DEFRAG_AF_PACKET,
 	IP_DEFRAG_MACVLAN,
+#if defined(CONFIG_BCM_KF_MAP) && IS_ENABLED(CONFIG_BCM_MAP)
+	IP_DEFRAG_MAP,
+#endif
 };
 
 /* Return true if the value of 'user' is between 'lower_bond'
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 5007eaba207d53840101cda281df759181918692..c1084b20a055804656302319ed69e854345912b7 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -19,6 +19,9 @@
 #include <net/netns/packet.h>
 #include <net/netns/ipv4.h>
 #include <net/netns/ipv6.h>
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+#include <net/netns/mptcp.h>
+#endif
 #include <net/netns/ieee802154_6lowpan.h>
 #include <net/netns/sctp.h>
 #include <net/netns/dccp.h>
@@ -110,6 +113,11 @@ struct net {
 #if IS_ENABLED(CONFIG_IPV6)
 	struct netns_ipv6	ipv6;
 #endif
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+#if IS_ENABLED(CONFIG_MPTCP)
+	struct netns_mptcp	mptcp;
+#endif
+#endif
 #if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
 	struct netns_ieee802154_lowpan	ieee802154_lowpan;
 #endif
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index ac4d70aeee1294648c2229d95597c22af8c04dc6..700320546919b6fffc65fa0347e5961fc8ffd804 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -23,10 +23,19 @@
 #include <linux/netfilter/nf_conntrack_dccp.h>
 #include <linux/netfilter/nf_conntrack_sctp.h>
 #include <linux/netfilter/nf_conntrack_proto_gre.h>
+#if defined(CONFIG_BCM_KF_PROTO_IPSEC) && \
+	(defined(CONFIG_NF_CONNTRACK_IPSEC) || defined(CONFIG_NF_CONNTRACK_IPSEC_MODULE))
+#include <linux/netfilter/nf_conntrack_ipsec.h>
+#include <linux/netfilter/nf_conntrack_proto_esp.h>
+#endif
 #include <net/netfilter/ipv6/nf_conntrack_icmpv6.h>
 
 #include <net/netfilter/nf_conntrack_tuple.h>
 
+#if defined(CONFIG_BCM_KF_NETFILTER)
+#include <linux/bcm_nfconn_ext.h>
+#endif
+
 /* per conntrack: protocol private data */
 union nf_conntrack_proto {
 	/* insert conntrack proto private data here */
@@ -34,6 +43,10 @@ union nf_conntrack_proto {
 	struct ip_ct_sctp sctp;
 	struct ip_ct_tcp tcp;
 	struct nf_ct_gre gre;
+#if defined(CONFIG_BCM_KF_PROTO_ESP) && \
+	(defined(CONFIG_NF_CT_PROTO_ESP) || defined(CONFIG_NF_CT_PROTO_ESP_MODULE))
+	struct nf_ct_esp esp;
+#endif
 	unsigned int tmpl_padto;
 };
 
@@ -66,6 +79,10 @@ struct nf_conn {
 	spinlock_t	lock;
 	u16		cpu;
 
+#if defined(CONFIG_BCM_KF_NETFILTER)
+	struct bcm_nf_conn_ext bcm_ext;
+#endif
+
 #ifdef CONFIG_NF_CONNTRACK_ZONES
 	struct nf_conntrack_zone zone;
 #endif
@@ -261,14 +278,47 @@ static inline bool nf_is_loopback_packet(const struct sk_buff *skb)
 
 #define nfct_time_stamp ((u32)(jiffies))
 
+#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG)
+extern bool bcm_nf_blog_ct_is_expired(struct nf_conn *ct);
+
 /* jiffies until ct expires, 0 if already expired */
-static inline unsigned long nf_ct_expires(const struct nf_conn *ct)
+static inline unsigned long nf_ct_expires(struct nf_conn *ct)
 {
 	s32 timeout = ct->timeout - nfct_time_stamp;
 
+	if (timeout <= 0) {
+		bcm_nf_blog_ct_is_expired(ct);
+		timeout = ct->timeout - nfct_time_stamp;
+	}
+
 	return timeout > 0 ? timeout : 0;
 }
 
+static inline bool nf_ct_is_expired(struct nf_conn *ct)
+{
+	/* when connectin time out is expired check if the connection
+	 * is accelearted and update the time accordingly
+	 */
+
+	if ((__s32)(ct->timeout - nfct_time_stamp) <= 0)
+		return bcm_nf_blog_ct_is_expired(ct);
+	else
+		return 0;
+}
+
+static inline bool nf_ct_should_gc(struct nf_conn *ct)
+{
+	return nf_ct_is_expired(ct) && nf_ct_is_confirmed(ct) &&
+	       !nf_ct_is_dying(ct);
+}
+#else
+/* jiffies until ct expires, 0 if already expired */
+static inline unsigned long nf_ct_expires(const struct nf_conn *ct)
+{
+	s32 timeout = ct->timeout - nfct_time_stamp;
+
+	return timeout > 0 ? timeout : 0;
+}
 static inline bool nf_ct_is_expired(const struct nf_conn *ct)
 {
 	return (__s32)(ct->timeout - nfct_time_stamp) <= 0;
@@ -280,6 +330,7 @@ static inline bool nf_ct_should_gc(const struct nf_conn *ct)
 	return nf_ct_is_expired(ct) && nf_ct_is_confirmed(ct) &&
 	       !nf_ct_is_dying(ct);
 }
+#endif
 
 struct kernel_param;
 
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index bf0444e111a63a3e2b6520a21849a6c9bc83a6b3..bd3ae2893c2378f0053e004b280b1025786a446a 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -62,6 +62,12 @@ struct nf_conntrack_tuple {
 			struct {
 				__be16 key;
 			} gre;
+#if defined(CONFIG_BCM_KF_PROTO_ESP) && \
+	(defined(CONFIG_NF_CT_PROTO_ESP) || defined(CONFIG_NF_CT_PROTO_ESP_MODULE))
+			struct {
+				__be16 spi;
+			} esp;
+#endif
 		} u;
 
 		/* The protocol. */
diff --git a/include/net/sock.h b/include/net/sock.h
index bc752237dff3f29d702de096f2a6db7c5a924be4..47fc66e70606b9a6c8596a4ac227025765f7e910 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -815,6 +815,9 @@ enum sock_flags {
 	SOCK_SELECT_ERR_QUEUE, /* Wake select on error queue */
 	SOCK_RCU_FREE, /* wait rcu grace period in sk_destruct() */
 	SOCK_TXTIME,
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+	SOCK_MPTCP, /* MPTCP set on this socket */
+#endif
 };
 
 #define SK_FLAGS_TIMESTAMP ((1UL << SOCK_TIMESTAMP) | (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE))
@@ -1122,6 +1125,9 @@ struct proto {
 	void			(*unhash)(struct sock *sk);
 	void			(*rehash)(struct sock *sk);
 	int			(*get_port)(struct sock *sk, unsigned short snum);
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+	void			(*clear_sk)(struct sock *sk, int size);
+#endif
 
 	/* Keeping track of sockets in use */
 #ifdef CONFIG_PROC_FS
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 0d4501f44e00d79dcc8d8b9eb2793f8c0ab7113c..bb3a499f16275fad1a4651c186b3df2f9989b71b 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -185,6 +185,9 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
 #define TCPOPT_SACK             5       /* SACK Block */
 #define TCPOPT_TIMESTAMP	8	/* Better RTT estimations/PAWS */
 #define TCPOPT_MD5SIG		19	/* MD5 Signature (RFC2385) */
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+#define TCPOPT_MPTCP		30
+#endif
 #define TCPOPT_FASTOPEN		34	/* Fast open (RFC7413) */
 #define TCPOPT_EXP		254	/* Experimental */
 /* Magic number to be after the option value for sharing TCP
@@ -241,6 +244,33 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
  */
 #define	TFO_SERVER_WO_SOCKOPT1	0x400
 
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+/* Flags from tcp_input.c for tcp_ack */
+#define FLAG_DATA		0x01 /* Incoming frame contained data.		*/
+#define FLAG_WIN_UPDATE		0x02 /* Incoming ACK was a window update.	*/
+#define FLAG_DATA_ACKED		0x04 /* This ACK acknowledged new data.		*/
+#define FLAG_RETRANS_DATA_ACKED	0x08 /* "" "" some of which was retransmitted.	*/
+#define FLAG_SYN_ACKED		0x10 /* This ACK acknowledged SYN.		*/
+#define FLAG_DATA_SACKED	0x20 /* New SACK.				*/
+#define FLAG_ECE		0x40 /* ECE in this ACK				*/
+#define FLAG_LOST_RETRANS	0x80 /* This ACK marks some retransmission lost */
+#define FLAG_SLOWPATH		0x100 /* Do not skip RFC checks for window update.*/
+#define FLAG_ORIG_SACK_ACKED	0x200 /* Never retransmitted data are (s)acked	*/
+#define FLAG_SND_UNA_ADVANCED	0x400 /* Snd_una was changed (!= FLAG_DATA_ACKED) */
+#define FLAG_DSACKING_ACK	0x800 /* SACK blocks contained D-SACK info */
+#define FLAG_SET_XMIT_TIMER	0x1000 /* Set TLP or RTO timer */
+#define FLAG_SACK_RENEGING	0x2000 /* snd_una advanced to a sacked seq */
+#define FLAG_UPDATE_TS_RECENT	0x4000 /* tcp_replace_ts_recent() */
+#define FLAG_NO_CHALLENGE_ACK	0x8000 /* do not call tcp_send_challenge_ack()	*/
+#define FLAG_ACK_MAYBE_DELAYED	0x10000 /* Likely a delayed ACK */
+
+#define MPTCP_FLAG_DATA_ACKED	0x20000
+
+#define FLAG_ACKED		(FLAG_DATA_ACKED|FLAG_SYN_ACKED)
+#define FLAG_NOT_DUP		(FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED)
+#define FLAG_CA_ALERT		(FLAG_DATA_SACKED|FLAG_ECE|FLAG_DSACKING_ACK)
+#define FLAG_FORWARD_PROGRESS	(FLAG_ACKED|FLAG_DATA_SACKED)
+#endif
 
 /* sysctl variables for tcp */
 extern int sysctl_tcp_max_orphans;
@@ -313,6 +343,98 @@ extern struct proto tcp_prot;
 #define TCP_DEC_STATS(net, field)	SNMP_DEC_STATS((net)->mib.tcp_statistics, field)
 #define TCP_ADD_STATS(net, field, val)	SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val)
 
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+/**** START - Exports needed for MPTCP ****/
+extern const struct tcp_request_sock_ops tcp_request_sock_ipv4_ops;
+extern const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops;
+
+struct mptcp_options_received;
+
+void tcp_cleanup_rbuf(struct sock *sk, int copied);
+void tcp_cwnd_validate(struct sock *sk, bool is_cwnd_limited);
+int tcp_close_state(struct sock *sk);
+void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss_now,
+			 const struct sk_buff *skb);
+int tcp_xmit_probe_skb(struct sock *sk, int urgent, int mib);
+void tcp_event_new_data_sent(struct sock *sk, struct sk_buff *skb);
+int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
+		     gfp_t gfp_mask);
+unsigned int tcp_mss_split_point(const struct sock *sk,
+				 const struct sk_buff *skb,
+				 unsigned int mss_now,
+				 unsigned int max_segs,
+				 int nonagle);
+bool tcp_nagle_test(const struct tcp_sock *tp, const struct sk_buff *skb,
+		    unsigned int cur_mss, int nonagle);
+bool tcp_snd_wnd_test(const struct tcp_sock *tp, const struct sk_buff *skb,
+		      unsigned int cur_mss);
+unsigned int tcp_cwnd_test(const struct tcp_sock *tp, const struct sk_buff *skb);
+int tcp_init_tso_segs(struct sk_buff *skb, unsigned int mss_now);
+int __pskb_trim_head(struct sk_buff *skb, int len);
+void tcp_queue_skb(struct sock *sk, struct sk_buff *skb);
+void tcp_init_nondata_skb(struct sk_buff *skb, u32 seq, u8 flags);
+void tcp_reset(struct sock *sk);
+bool tcp_may_update_window(const struct tcp_sock *tp, const u32 ack,
+			   const u32 ack_seq, const u32 nwin);
+bool tcp_urg_mode(const struct tcp_sock *tp);
+void tcp_ack_probe(struct sock *sk);
+void tcp_rearm_rto(struct sock *sk);
+int tcp_write_timeout(struct sock *sk);
+bool retransmits_timed_out(struct sock *sk,
+			   unsigned int boundary,
+			   unsigned int timeout);
+void tcp_write_err(struct sock *sk);
+void tcp_adjust_pcount(struct sock *sk, const struct sk_buff *skb, int decr);
+void tcp_update_skb_after_send(struct tcp_sock *tp, struct sk_buff *skb);
+void tcp_set_skb_tso_segs(struct sk_buff *skb, unsigned int mss_now);
+
+void tcp_v4_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb,
+			   struct request_sock *req);
+void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb);
+struct sock *tcp_v4_cookie_check(struct sock *sk, struct sk_buff *skb);
+void tcp_v4_reqsk_destructor(struct request_sock *req);
+
+void tcp_v6_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb,
+			   struct request_sock *req);
+void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb);
+struct sock *tcp_v6_cookie_check(struct sock *sk, struct sk_buff *skb);
+int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb);
+int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
+void tcp_v6_destroy_sock(struct sock *sk);
+void inet6_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb);
+void tcp_v6_hash(struct sock *sk);
+struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb);
+struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
+				  struct request_sock *req,
+				  struct dst_entry *dst,
+				  struct request_sock *req_unhash,
+				  bool *own_req);
+void tcp_v6_reqsk_destructor(struct request_sock *req);
+
+unsigned int tcp_xmit_size_goal(struct sock *sk, u32 mss_now,
+				       int large_allowed);
+u32 tcp_tso_acked(struct sock *sk, struct sk_buff *skb);
+
+void skb_clone_fraglist(struct sk_buff *skb);
+
+void inet_twsk_free(struct inet_timewait_sock *tw);
+int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb);
+/* These states need RST on ABORT according to RFC793 */
+static inline bool tcp_need_reset(int state)
+{
+	return (1 << state) &
+	       (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT | TCPF_FIN_WAIT1 |
+		TCPF_FIN_WAIT2 | TCPF_SYN_RECV);
+}
+
+int __must_check tcp_queue_rcv(struct sock *sk, struct sk_buff *skb, int hdrlen,
+			       bool *fragstolen);
+void tcp_ofo_queue(struct sock *sk);
+void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb);
+int linear_payload_sz(bool first_skb);
+/**** END - Exports needed for MPTCP ****/
+
+#endif
 void tcp_tasklet_init(void);
 
 void tcp_v4_err(struct sk_buff *skb, u32);
@@ -412,7 +534,13 @@ int tcp_mmap(struct file *file, struct socket *sock,
 	     struct vm_area_struct *vma);
 void tcp_parse_options(const struct net *net, const struct sk_buff *skb,
 		       struct tcp_options_received *opt_rx,
+#if !defined(CONFIG_BCM_KF_MPTCP) || !defined(CONFIG_BCM_MPTCP)
 		       int estab, struct tcp_fastopen_cookie *foc);
+#else
+		       struct mptcp_options_received *mopt_rx,
+		       int estab, struct tcp_fastopen_cookie *foc,
+		       struct tcp_sock *tp);
+#endif
 const u8 *tcp_parse_md5sig_option(const struct tcphdr *th);
 
 /*
@@ -421,6 +549,9 @@ const u8 *tcp_parse_md5sig_option(const struct tcphdr *th);
 
 void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb);
 void tcp_v4_mtu_reduced(struct sock *sk);
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+void tcp_v6_mtu_reduced(struct sock *sk);
+#endif
 void tcp_req_err(struct sock *sk, u32 seq, bool abort);
 int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb);
 struct sock *tcp_create_openreq_child(const struct sock *sk,
@@ -538,7 +669,12 @@ static inline u32 tcp_cookie_time(void)
 
 u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th,
 			      u16 *mssp);
+#if !defined(CONFIG_BCM_KF_MPTCP) || !defined(CONFIG_BCM_MPTCP)
 __u32 cookie_v4_init_sequence(const struct sk_buff *skb, __u16 *mss);
+#else
+__u32 cookie_v4_init_sequence(struct request_sock *req, const struct sock *sk,
+			      const struct sk_buff *skb, __u16 *mss);
+#endif
 u64 cookie_init_timestamp(struct request_sock *req);
 bool cookie_timestamp_decode(const struct net *net,
 			     struct tcp_options_received *opt);
@@ -552,7 +688,12 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb);
 
 u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph,
 			      const struct tcphdr *th, u16 *mssp);
+#if !defined(CONFIG_BCM_KF_MPTCP) || !defined(CONFIG_BCM_MPTCP)
 __u32 cookie_v6_init_sequence(const struct sk_buff *skb, __u16 *mss);
+#else
+__u32 cookie_v6_init_sequence(struct request_sock *req, const struct sock *sk,
+			      const struct sk_buff *skb, __u16 *mss);
+#endif
 #endif
 /* tcp_output.c */
 
@@ -588,10 +729,20 @@ bool tcp_schedule_loss_probe(struct sock *sk, bool advancing_rto);
 void tcp_skb_collapse_tstamp(struct sk_buff *skb,
 			     const struct sk_buff *next_skb);
 
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+u16 tcp_select_window(struct sock *sk);
+bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
+		int push_one, gfp_t gfp);
+
+#endif
 /* tcp_input.c */
 void tcp_rearm_rto(struct sock *sk);
 void tcp_synack_rtt_meas(struct sock *sk, struct request_sock *req);
 void tcp_reset(struct sock *sk);
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+void tcp_set_rto(struct sock *sk);
+bool tcp_should_expand_sndbuf(const struct sock *sk);
+#endif
 void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp, struct sk_buff *skb);
 void tcp_fin(struct sock *sk);
 
@@ -635,7 +786,11 @@ static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize)
 }
 
 /* tcp.c */
+#if !defined(CONFIG_BCM_KF_MPTCP) || !defined(CONFIG_BCM_MPTCP)
 void tcp_get_info(struct sock *, struct tcp_info *);
+#else
+void tcp_get_info(struct sock *, struct tcp_info *, bool no_lock);
+#endif
 
 /* Read 'sendfile()'-style from a TCP socket */
 int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
@@ -823,6 +978,14 @@ struct tcp_skb_cb {
 			u16	tcp_gso_size;
 		};
 	};
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+
+#ifdef CONFIG_MPTCP
+	__u8		mptcp_flags;	/* flags for the MPTCP layer    */
+	__u8		dss_off;	/* Number of 4-byte words until
+					 * seq-number */
+#endif
+#endif
 	__u8		tcp_flags;	/* TCP header flags. (tcp[13])	*/
 
 	__u8		sacked;		/* State flags for SACK.	*/
@@ -841,6 +1004,16 @@ struct tcp_skb_cb {
 			has_rxtstamp:1,	/* SKB has a RX timestamp	*/
 			unused:5;
 	__u32		ack_seq;	/* Sequence number ACK'd	*/
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+
+#ifdef CONFIG_MPTCP
+	union {			/* For MPTCP outgoing frames */
+		__u32 path_mask; /* paths that tried to send this skb */
+		__u32 dss[6];	/* DSS options */
+	};
+#endif
+
+#endif
 	union {
 		struct {
 			/* There is space for up to 24 bytes */
@@ -1361,6 +1534,21 @@ static inline int tcp_win_from_space(const struct sock *sk, int space)
 		space - (space>>tcp_adv_win_scale);
 }
 
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+#ifdef CONFIG_MPTCP
+extern struct static_key mptcp_static_key;
+static inline bool mptcp(const struct tcp_sock *tp)
+{
+	return static_key_false(&mptcp_static_key) && tp->mpc;
+}
+#else
+static inline bool mptcp(const struct tcp_sock *tp)
+{
+	return 0;
+}
+#endif
+
+#endif
 /* Note: caller must be prepared to deal with negative returns */
 static inline int tcp_space(const struct sock *sk)
 {
@@ -1906,6 +2094,32 @@ struct tcp_sock_af_ops {
 #endif
 };
 
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+/* TCP/MPTCP-specific functions */
+struct tcp_sock_ops {
+	u32 (*__select_window)(struct sock *sk);
+	u16 (*select_window)(struct sock *sk);
+	void (*select_initial_window)(const struct sock *sk, int __space,
+				      __u32 mss, __u32 *rcv_wnd,
+				      __u32 *window_clamp, int wscale_ok,
+				      __u8 *rcv_wscale, __u32 init_rcv_wnd);
+	int (*select_size)(const struct sock *sk, bool first_skb, bool zc);
+	void (*init_buffer_space)(struct sock *sk);
+	void (*set_rto)(struct sock *sk);
+	bool (*should_expand_sndbuf)(const struct sock *sk);
+	void (*send_fin)(struct sock *sk);
+	bool (*write_xmit)(struct sock *sk, unsigned int mss_now, int nonagle,
+			   int push_one, gfp_t gfp);
+	void (*send_active_reset)(struct sock *sk, gfp_t priority);
+	int (*write_wakeup)(struct sock *sk, int mib);
+	void (*retransmit_timer)(struct sock *sk);
+	void (*time_wait)(struct sock *sk, int state, int timeo);
+	void (*cleanup_rbuf)(struct sock *sk, int copied);
+	void (*cwnd_validate)(struct sock *sk, bool is_cwnd_limited);
+};
+extern const struct tcp_sock_ops tcp_specific;
+
+#endif
 struct tcp_request_sock_ops {
 	u16 mss_clamp;
 #ifdef CONFIG_TCP_MD5SIG
@@ -1916,12 +2130,24 @@ struct tcp_request_sock_ops {
 					  const struct sock *sk,
 					  const struct sk_buff *skb);
 #endif
+#if !defined(CONFIG_BCM_KF_MPTCP) || !defined(CONFIG_BCM_MPTCP)
 	void (*init_req)(struct request_sock *req,
 			 const struct sock *sk_listener,
 			 struct sk_buff *skb);
+#else
+	int (*init_req)(struct request_sock *req,
+			const struct sock *sk_listener,
+			struct sk_buff *skb,
+			bool want_cookie);
+#endif
 #ifdef CONFIG_SYN_COOKIES
+#if !defined(CONFIG_BCM_KF_MPTCP) || !defined(CONFIG_BCM_MPTCP)
 	__u32 (*cookie_init_seq)(const struct sk_buff *skb,
 				 __u16 *mss);
+#else
+	__u32 (*cookie_init_seq)(struct request_sock *req, const struct sock *sk,
+				 const struct sk_buff *skb, __u16 *mss);
+#endif
 #endif
 	struct dst_entry *(*route_req)(const struct sock *sk, struct flowi *fl,
 				       const struct request_sock *req);
@@ -1935,15 +2161,25 @@ struct tcp_request_sock_ops {
 
 #ifdef CONFIG_SYN_COOKIES
 static inline __u32 cookie_init_sequence(const struct tcp_request_sock_ops *ops,
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+					 struct request_sock *req,
+#endif
 					 const struct sock *sk, struct sk_buff *skb,
 					 __u16 *mss)
 {
 	tcp_synq_overflow(sk);
 	__NET_INC_STATS(sock_net(sk), LINUX_MIB_SYNCOOKIESSENT);
+#if !defined(CONFIG_BCM_KF_MPTCP) || !defined(CONFIG_BCM_MPTCP)
 	return ops->cookie_init_seq(skb, mss);
+#else
+	return ops->cookie_init_seq(req, sk, skb, mss);
+#endif
 }
 #else
 static inline __u32 cookie_init_sequence(const struct tcp_request_sock_ops *ops,
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+					 struct request_sock *req,
+#endif
 					 const struct sock *sk, struct sk_buff *skb,
 					 __u16 *mss)
 {
diff --git a/include/net/tcp_states.h b/include/net/tcp_states.h
index 2875e169d7445e65b65110081215b5f62d6e911c..ab6c0cece30f9a29e4de59456e8d6bdcdb7648cb 100644
--- a/include/net/tcp_states.h
+++ b/include/net/tcp_states.h
@@ -26,6 +26,9 @@ enum {
 	TCP_LISTEN,
 	TCP_CLOSING,	/* Now a valid state */
 	TCP_NEW_SYN_RECV,
+#if ((defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)) || !defined(CONFIG_BCM_IN_KERNEL))
+	TCP_RST_WAIT,
+#endif
 
 	TCP_MAX_STATES	/* Leave at the end! */
 };
@@ -47,6 +50,9 @@ enum {
 	TCPF_LISTEN	 = (1 << TCP_LISTEN),
 	TCPF_CLOSING	 = (1 << TCP_CLOSING),
 	TCPF_NEW_SYN_RECV = (1 << TCP_NEW_SYN_RECV),
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+	TCPF_RST_WAIT	 = (1 << TCP_RST_WAIT),
+#endif
 };
 
 #endif	/* _LINUX_TCP_STATES_H */
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index a8f6020f1196edc9940cbb6c605a06279db4fd36..4dda89d3abb40e336db456a96eb5523550929ea4 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -58,6 +58,10 @@ ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp, __u16 srcp,
 
 /* address family specific functions */
 extern const struct inet_connection_sock_af_ops ipv4_specific;
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+extern const struct inet_connection_sock_af_ops ipv6_mapped;
+extern const struct inet_connection_sock_af_ops ipv6_specific;
+#endif
 
 void inet6_destroy_sock(struct sock *sk);
 
diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h
index ac55b328d61b22107cb2e3c2ab3591ca093ad9fb..281d4278b4e7e39c4064147d8796dcf341aadd70 100644
--- a/include/trace/events/tcp.h
+++ b/include/trace/events/tcp.h
@@ -10,6 +10,9 @@
 #include <linux/tracepoint.h>
 #include <net/ipv6.h>
 #include <net/tcp.h>
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+#include <net/mptcp.h>
+#endif
 #include <linux/sock_diag.h>
 
 #define TP_STORE_V4MAPPED(__entry, saddr, daddr)		\
@@ -178,6 +181,15 @@ DEFINE_EVENT(tcp_event_sk, tcp_rcv_space_adjust,
 	TP_ARGS(sk)
 );
 
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+DEFINE_EVENT(tcp_event_sk_skb, mptcp_retransmit,
+
+	TP_PROTO(const struct sock *sk, const struct sk_buff *skb),
+
+	TP_ARGS(sk, skb)
+);
+
+#endif
 TRACE_EVENT(tcp_retransmit_synack,
 
 	TP_PROTO(const struct sock *sk, const struct request_sock *req),
@@ -245,6 +257,9 @@ TRACE_EVENT(tcp_probe,
 		__field(__u32, srtt)
 		__field(__u32, rcv_wnd)
 		__field(__u64, sock_cookie)
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+		__field(__u8, mptcp)
+#endif
 	),
 
 	TP_fast_assign(
@@ -271,13 +286,25 @@ TRACE_EVENT(tcp_probe,
 		__entry->ssthresh = tcp_current_ssthresh(sk);
 		__entry->srtt = tp->srtt_us >> 3;
 		__entry->sock_cookie = sock_gen_cookie(sk);
+#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)
+		__entry->mptcp = mptcp(tp) ? tp->mptcp->path_index : 0;
+#endif
 	),
 
+#if !defined(CONFIG_BCM_KF_MPTCP) || !defined(CONFIG_BCM_MPTCP)
 	TP_printk("src=%pISpc dest=%pISpc mark=%#x data_len=%d snd_nxt=%#x snd_una=%#x snd_cwnd=%u ssthresh=%u snd_wnd=%u srtt=%u rcv_wnd=%u sock_cookie=%llx",
+#else
+	TP_printk("src=%pISpc dest=%pISpc mark=%#x data_len=%d snd_nxt=%#x snd_una=%#x snd_cwnd=%u ssthresh=%u snd_wnd=%u srtt=%u rcv_wnd=%u sock_cookie=%llx mptcp=%d",
+#endif
 		  __entry->saddr, __entry->daddr, __entry->mark,
 		  __entry->data_len, __entry->snd_nxt, __entry->snd_una,
 		  __entry->snd_cwnd, __entry->ssthresh, __entry->snd_wnd,
+#if !defined(CONFIG_BCM_KF_MPTCP) || !defined(CONFIG_BCM_MPTCP)
 		  __entry->srtt, __entry->rcv_wnd, __entry->sock_cookie)
+#else
+		  __entry->srtt, __entry->rcv_wnd, __entry->sock_cookie,
+		  __entry->mptcp)
+#endif
 );
 
 #endif /* _TRACE_TCP_H */
diff --git a/include/uapi/linux/atmdev.h b/include/uapi/linux/atmdev.h
index a5c15cf23bd78b7bca429783292cd293a9381078..18c8b46ad822d8712c6039fcce222ca13fb10926 100644
--- a/include/uapi/linux/atmdev.h
+++ b/include/uapi/linux/atmdev.h
@@ -117,6 +117,14 @@ struct atm_dev_stats {
 #define ATM_BACKEND_PPP		1	/* PPPoATM - RFC2364 */
 #define ATM_BACKEND_BR2684	2	/* Bridged RFC1483/2684 */
 
+#if defined(CONFIG_BCM_KF_PPP)
+#define ATM_BACKEND_RT2684       3  /* Routed RFC1483/2684 */
+#define ATM_BACKEND_BR2684_BCM   4  /* Bridged RFC1483/2684 uses Broadcom ATMAPI*/
+#define ATM_BACKEND_PPP_BCM      5  /* PPPoA uses Broadcom bcmxtmrt driver */
+#define ATM_BACKEND_PPP_BCM_DISCONN    6  /* PPPoA LCP disconnect */
+#define ATM_BACKEND_PPP_BCM_CLOSE_DEV  7  /* PPPoA close device */
+#endif
+
 /* for ATM_GETTYPE */
 #define ATM_ITFTYP_LEN	8	/* maximum length of interface type name */
 
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index d143e277cdaf25739e69ef718b123f2a8bdd653a..9935be6033e663c24bb4220a507cc4d300028a95 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -2674,6 +2674,9 @@ enum {
 	BPF_TCP_LISTEN,
 	BPF_TCP_CLOSING,	/* Now a valid state */
 	BPF_TCP_NEW_SYN_RECV,
+#if ((defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)) || !defined(CONFIG_BCM_IN_KERNEL))
+	BPF_TCP_RST_WAIT,
+#endif
 
 	BPF_TCP_MAX_STATES	/* Leave at the end! */
 };
diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h
index 7fea0fd7d6f54debe3cd4356a1e7ca04ef9c9c7d..8eb1b28267138699f8370e66e341985eabbd017f 100644
--- a/include/uapi/linux/if.h
+++ b/include/uapi/linux/if.h
@@ -132,6 +132,11 @@ enum net_device_flags {
 #define IFF_ECHO			IFF_ECHO
 #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
 
+#if ((defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)) || !defined(CONFIG_BCM_IN_KERNEL))
+#define IFF_NOMULTIPATH	0x80000		/* Disable for MPTCP 		*/
+#define IFF_MPBACKUP	0x100000	/* Use as backup path for MPTCP */
+
+#endif
 #define IFF_VOLATILE	(IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
 		IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
 
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 43391e2d1153adb701433d6794702b73f2d60297..8b83ef88585f98a2ac6bb981a99458cfa52f7b9f 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -37,6 +37,17 @@ struct rtnl_link_stats {
 	__u32	rx_compressed;
 	__u32	tx_compressed;
 
+#if defined(CONFIG_BCM_KF_EXTSTATS)
+	__u32   tx_multicast_packets;  /* multicast packets transmitted */
+	__u32   rx_multicast_bytes;  /* multicast bytes recieved */ 
+	__u32   tx_multicast_bytes;  /* multicast bytes transmitted */
+	__u32   rx_broadcast_packets;  /* broadcast packets recieved */
+	__u32   tx_broadcast_packets;  /* broadcast packets transmitted */
+	/* NOTE: Unicast packets are not counted but are instead calculated as needed
+	using total - (broadcast + multicast) */
+	__u32   rx_unknown_packets;  /* unknown protocol packets recieved */
+#endif
+
 	__u32	rx_nohandler;		/* dropped, no handler found	*/
 };
 
@@ -72,6 +83,17 @@ struct rtnl_link_stats64 {
 	__u64	rx_compressed;
 	__u64	tx_compressed;
 
+#if defined(CONFIG_BCM_KF_EXTSTATS)
+        __u64   tx_multicast_packets;  /* multicast packets transmitted */
+        __u64   rx_multicast_bytes;  /* multicast bytes recieved */ 
+        __u64   tx_multicast_bytes;  /* multicast bytes transmitted */
+        __u64   rx_broadcast_packets;  /* broadcast packets recieved */
+        __u64   tx_broadcast_packets;  /* broadcast packets transmitted */
+        /* NOTE: Unicast packets are not counted but are instead calculated as needed
+        using total - (broadcast + multicast) */
+        __u64   rx_unknown_packets;  /* unknown protocol packets recieved */
+#endif
+
 	__u64	rx_nohandler;		/* dropped, no handler found	*/
 };
 
diff --git a/include/uapi/linux/netfilter/nf_conntrack_common.h b/include/uapi/linux/netfilter/nf_conntrack_common.h
index 336014bf8868c3f04b92cdbf31bdf2ccafc68a71..d6261374e0d24c1c8bea78cf584471bce29dc5d8 100644
--- a/include/uapi/linux/netfilter/nf_conntrack_common.h
+++ b/include/uapi/linux/netfilter/nf_conntrack_common.h
@@ -105,6 +105,15 @@ enum ip_conntrack_status {
 	IPS_OFFLOAD_BIT = 14,
 	IPS_OFFLOAD = (1 << IPS_OFFLOAD_BIT),
 
+#if defined(CONFIG_BCM_KF_NETFILTER) || !defined(CONFIG_BCM_IN_KERNEL)
+	/* Conntrack eligible for Blogging */
+	IPS_BLOG_BIT = 15,
+	IPS_BLOG = (1 << IPS_BLOG_BIT),
+
+	/* ingress qos */
+	IPS_IQOS_BIT = 16,
+	IPS_IQOS = (1 << IPS_IQOS_BIT),
+#endif
 	/* Be careful here, modifying these bits can make things messy,
 	 * so don't let users modify them directly.
 	 */
@@ -112,7 +121,11 @@ enum ip_conntrack_status {
 				 IPS_EXPECTED | IPS_CONFIRMED | IPS_DYING |
 				 IPS_SEQ_ADJUST | IPS_TEMPLATE | IPS_OFFLOAD),
 
+#if defined(CONFIG_BCM_KF_NETFILTER)
+	__IPS_MAX_BIT = 17,
+#else
 	__IPS_MAX_BIT = 15,
+#endif
 };
 
 /* Connection tracking event types */
@@ -130,6 +143,9 @@ enum ip_conntrack_events {
 	IPCT_SECMARK,		/* new security mark has been set */
 	IPCT_LABEL,		/* new connlabel has been set */
 	IPCT_SYNPROXY,		/* synproxy has been set */
+#if defined(CONFIG_BCM_KF_DPI)
+	IPCT_DPI,		/* dpi classification for ct is complete */
+#endif
 #ifdef __KERNEL__
 	__IPCT_MAX
 #endif
diff --git a/include/uapi/linux/netfilter/nf_conntrack_tuple_common.h b/include/uapi/linux/netfilter/nf_conntrack_tuple_common.h
index 64390fac6f7eacbea0181ac3eb156593f28c876e..5bff8a1cff6828cb18c052dd74916e38b2f4464f 100644
--- a/include/uapi/linux/netfilter/nf_conntrack_tuple_common.h
+++ b/include/uapi/linux/netfilter/nf_conntrack_tuple_common.h
@@ -39,6 +39,12 @@ union nf_conntrack_man_proto {
 	struct {
 		__be16 key;	/* GRE key is 32bit, PPtP only uses 16bit */
 	} gre;
+#if defined(CONFIG_BCM_KF_PROTO_ESP) && \
+	(defined(CONFIG_NF_CT_PROTO_ESP) || defined(CONFIG_NF_CT_PROTO_ESP_MODULE))
+	struct {
+		__be16 spi;
+	} esp;
+#endif
 };
 
 #define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL)
diff --git a/include/uapi/linux/netfilter/nfnetlink_conntrack.h b/include/uapi/linux/netfilter/nfnetlink_conntrack.h
index 1d41810d17e2caffc6c7c31e586300d02da6947e..a2439ac91ae573941940994cd0f993c47307a905 100644
--- a/include/uapi/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/uapi/linux/netfilter/nfnetlink_conntrack.h
@@ -55,6 +55,9 @@ enum ctattr_type {
 	CTA_LABELS,
 	CTA_LABELS_MASK,
 	CTA_SYNPROXY,
+#if defined(CONFIG_BCM_KF_DPI)
+	CTA_DPI,
+#endif
 	__CTA_MAX
 };
 #define CTA_MAX (__CTA_MAX - 1)
@@ -276,4 +279,16 @@ enum ctattr_expect_stats {
 };
 #define CTA_STATS_EXP_MAX (__CTA_STATS_EXP_MAX - 1)
 
+#if defined(CONFIG_BCM_KF_DPI)
+enum ctattr_dpi {
+	CTA_DPI_UNSPEC,
+	CTA_DPI_APP_ID,
+	CTA_DPI_MAC,
+	CTA_DPI_STATUS,
+	CTA_DPI_URL,
+	__CTA_DPI_MAX,
+};
+#define CTA_DPI_MAX (__CTA_DPI_MAX - 1)
+#endif
+
 #endif /* _IPCONNTRACK_NETLINK_H */
diff --git a/include/uapi/linux/netfilter/xt_tcpudp.h b/include/uapi/linux/netfilter/xt_tcpudp.h
index 658c169998197f7e8c02ca590e4ca8d9661c1336..326146f1585f20ee52be639fb84a8871b9ae102e 100644
--- a/include/uapi/linux/netfilter/xt_tcpudp.h
+++ b/include/uapi/linux/netfilter/xt_tcpudp.h
@@ -12,6 +12,9 @@ struct xt_tcp {
 	__u8 flg_mask;			/* TCP flags mask byte */
 	__u8 flg_cmp;			/* TCP flags compare byte */
 	__u8 invflags;			/* Inverse flags */
+#if defined(CONFIG_BCM_KF_NETFILTER)
+	__u8 pure_ack;			/* Pure ACK packet */
+#endif
 };
 
 /* Values for "inv" field in struct ipt_tcp. */
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index fa43dd5a7b3dcc84d29ecf441e28986e2a6bcec4..f872492614bdfb688600b25ff047f70e7a874730 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -4284,6 +4284,10 @@ enum nl80211_key_attributes {
 	NL80211_KEY_DEFAULT_MGMT,
 	NL80211_KEY_TYPE,
 	NL80211_KEY_DEFAULT_TYPES,
+#ifdef CONFIG_BCM_KF_MISC_BACKPORTS
+	NL80211_KEY_MODE,
+	NL80211_KEY_DEFAULT_BEACON,
+#endif /* CONFIG_BCM_KF_MISC_BACKPORTS */
 
 	/* keep last */
 	__NL80211_KEY_AFTER_LAST,
@@ -4339,6 +4343,9 @@ enum nl80211_txrate_gi {
  * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
  * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
  * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
+#ifdef CONFIG_BCM_KF_NL80211_6G_BAND_SUPPORT
+ * @NL80211_BAND_6GHZ: around 6 GHz band (5.9 - 7.1 GHz)
+#endif
  * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace
  *	since newer kernel versions may support more bands
  */
@@ -4346,6 +4353,9 @@ enum nl80211_band {
 	NL80211_BAND_2GHZ,
 	NL80211_BAND_5GHZ,
 	NL80211_BAND_60GHZ,
+#ifdef CONFIG_BCM_KF_NL80211_6G_BAND_SUPPORT
+	NL80211_BAND_6GHZ,
+#endif /* CONFIG_BCM_KF_NL80211_6G_BAND_SUPPORT */
 
 	NUM_NL80211_BANDS,
 };
@@ -5259,6 +5269,19 @@ enum nl80211_ext_feature_index {
 	NL80211_EXT_FEATURE_TXQS,
 	NL80211_EXT_FEATURE_SCAN_RANDOM_SN,
 	NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT,
+#ifdef CONFIG_BCM_KF_MISC_BACKPORTS
+	NL80211_EXT_FEATURE_CAN_REPLACE_PTK0,
+	NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER,
+	NL80211_EXT_FEATURE_AIRTIME_FAIRNESS,
+	NL80211_EXT_FEATURE_AP_PMKSA_CACHING,
+	NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD,
+	NL80211_EXT_FEATURE_EXT_KEY_ID,
+	NL80211_EXT_FEATURE_STA_TX_PWR,
+	NL80211_EXT_FEATURE_SAE_OFFLOAD,
+	NL80211_EXT_FEATURE_VLAN_OFFLOAD,
+	NL80211_EXT_FEATURE_AQL,
+	NL80211_EXT_FEATURE_BEACON_PROTECTION,
+#endif /* CONFIG_BCM_KF_MISC_BACKPORTS */
 
 	/* add new features before the definition below */
 	NUM_NL80211_EXT_FEATURES,
diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
index e02d31986ff911b0547bd954abcc7339f4668ca6..9d11ed5e7c9ef19b74f31609af3ed501e451d474 100644
--- a/include/uapi/linux/tcp.h
+++ b/include/uapi/linux/tcp.h
@@ -18,10 +18,26 @@
 #ifndef _UAPI_LINUX_TCP_H
 #define _UAPI_LINUX_TCP_H
 
+#if ((defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)) || !defined(CONFIG_BCM_IN_KERNEL))
+
+#ifndef __KERNEL__
+#include <sys/socket.h>
+#endif
+
+#include <asm/byteorder.h>
+#include <linux/in.h>
+#include <linux/in6.h>
+#include <linux/socket.h>
+#include <linux/types.h>
+
+#else
+
 #include <linux/types.h>
 #include <asm/byteorder.h>
 #include <linux/socket.h>
 
+#endif
+
 struct tcphdr {
 	__be16	source;
 	__be16	dest;
@@ -131,6 +147,15 @@ enum {
 #define TCP_REPAIR_OFF		0
 #define TCP_REPAIR_OFF_NO_WP	-1	/* Turn off without window probes */
 
+#if ((defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)) || !defined(CONFIG_BCM_IN_KERNEL))
+#define MPTCP_ENABLED		42
+#define MPTCP_SCHEDULER		43
+#define MPTCP_PATH_MANAGER	44
+#define MPTCP_INFO		45
+
+#define MPTCP_INFO_FLAG_SAVE_MASTER	0x01
+
+#endif
 struct tcp_repair_opt {
 	__u32	opt_code;
 	__u32	opt_val;
@@ -268,6 +293,55 @@ enum {
 	TCP_NLA_REORD_SEEN,	/* reordering events seen */
 };
 
+#if ((defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP)) || !defined(CONFIG_BCM_IN_KERNEL))
+struct mptcp_meta_info {
+	__u8	mptcpi_state;
+	__u8	mptcpi_retransmits;
+	__u8	mptcpi_probes;
+	__u8	mptcpi_backoff;
+
+	__u32	mptcpi_rto;
+	__u32	mptcpi_unacked;
+
+	/* Times. */
+	__u32	mptcpi_last_data_sent;
+	__u32	mptcpi_last_data_recv;
+	__u32	mptcpi_last_ack_recv;
+
+	__u32	mptcpi_total_retrans;
+
+	__u64	mptcpi_bytes_acked;    /* RFC4898 tcpEStatsAppHCThruOctetsAcked */
+	__u64	mptcpi_bytes_received; /* RFC4898 tcpEStatsAppHCThruOctetsReceived */
+};
+
+struct mptcp_sub_info {
+	union {
+		struct sockaddr src;
+		struct sockaddr_in src_v4;
+		struct sockaddr_in6 src_v6;
+	};
+
+	union {
+		struct sockaddr dst;
+		struct sockaddr_in dst_v4;
+		struct sockaddr_in6 dst_v6;
+	};
+};
+
+struct mptcp_info {
+	__u32	tcp_info_len;	/* Length of each struct tcp_info in subflows pointer */
+	__u32	sub_len;	/* Total length of memory pointed to by subflows pointer */
+	__u32	meta_len;	/* Length of memory pointed to by meta_info */
+	__u32	sub_info_len;	/* Length of each struct mptcp_sub_info in subflow_info pointer */
+	__u32	total_sub_info_len;	/* Total length of memory pointed to by subflow_info */
+
+	struct mptcp_meta_info	*meta_info;
+	struct tcp_info		*initial;
+	struct tcp_info		*subflows;	/* Pointer to array of tcp_info structs */
+	struct mptcp_sub_info	*subflow_info;
+};
+
+#endif
 /* for TCP_MD5SIG socket option */
 #define TCP_MD5SIG_MAXKEYLEN	80
 
diff --git a/include/uapi/mtd/mtd-abi.h b/include/uapi/mtd/mtd-abi.h
index aff5b5e59845a837d038532259673bd56fa49ddd..fbbe90b03a0a572707a896b3de05f2de0ab38cd0 100644
--- a/include/uapi/mtd/mtd-abi.h
+++ b/include/uapi/mtd/mtd-abi.h
@@ -104,6 +104,9 @@ struct mtd_write_req {
 #define MTD_BIT_WRITEABLE	0x800	/* Single bits can be flipped */
 #define MTD_NO_ERASE		0x1000	/* No erase necessary */
 #define MTD_POWERUP_LOCK	0x2000	/* Always locked after reset */
+#if defined(CONFIG_BCM_KF_MTD_BCMNAND)
+#define MTD_NAND_NOP1		0x10000000	/* SLC NAND that only supports single page write (NOP=1) */
+#endif
 
 /* Some common devices / combinations of capabilities */
 #define MTD_CAP_ROM		0