[Feature][T106][task-view-1427] merge ZXW-ipv6 patch

Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: yes
Doc Update: no

Change-Id: I6830bffdff648e9aba4f31c05616a0c8a609961d
diff --git a/ap/app/Script/scripts/psext_down_ipv6.sh b/ap/app/Script/scripts/psext_down_ipv6.sh
index c738a77..9c32c71 100755
--- a/ap/app/Script/scripts/psext_down_ipv6.sh
+++ b/ap/app/Script/scripts/psext_down_ipv6.sh
@@ -3,7 +3,7 @@
 if [ "$test_log" == "" ]; then
 	test_log=`nv get path_log`"te.log"
 fi
-echo "Info: psext_updown_ipv6.sh $ps_if $eth_if $br_if start" >> $test_log
+echo "Info: psext_down_ipv6.sh $1 start" >> $test_log
 
 c_id=$1
 ps_if=`nv get pswan`$c_id
@@ -15,7 +15,7 @@
 {
     br_ip=`nv get $br_if"_ipv6_ip"`
     ps_ip=`nv get $ps_if"_ipv6_ip"`
-    pdp_ip=`nv get ipv6_wan_ipaddr`
+    pdp_ip=`nv get $ps_if"_ipv6_pdp"`
 
     ip6tables -t filter -D FORWARD -p icmpv6 --icmpv6-type 135 -j DROP
 	
@@ -67,7 +67,7 @@
     nv set $ps_if"_dhcpv6_end"="::"
 
     #适配页面等其他地方使用老NV
-    nv set ipv6_wan_ipaddr="::"
+    nv set $ps_if"_ipv6_pdp"="::"
 	nv set $ps_if"_ipv6_state"="dead"
 	
 	local_ipv6_addr_nv="$ps_if""_local_ipv6_addr"
diff --git a/ap/app/Script/scripts/psext_updown_ipv6.sh b/ap/app/Script/scripts/psext_updown_ipv6.sh
index 06bee36..9207f11 100755
--- a/ap/app/Script/scripts/psext_updown_ipv6.sh
+++ b/ap/app/Script/scripts/psext_updown_ipv6.sh
@@ -142,7 +142,7 @@
         #pdp 激活的ipv6地址
         pdp_ip=$prefix_info_temp$interface_id_temp
         #pdp激活地址,适配页面使用
-        nv set ipv6_wan_ipaddr="$pdp_ip"
+        nv set $ps_if"_ipv6_pdp"="$pdp_ip"
         
         ipv6_addr_conver $pdp_ip "$ps_if"
         
@@ -364,7 +364,7 @@
 {
     br_ip=`nv get $br_if"_ipv6_ip"`
     ps_ip=`nv get $ps_if"_ipv6_ip"`
-    pdp_ip=`nv get ipv6_wan_ipaddr`
+    pdp_ip=`nv get $ps_if"_ipv6_pdp"`
 
     ip6tables -t filter -D FORWARD -p icmpv6 --icmpv6-type 135 -j DROP
 	
@@ -416,7 +416,7 @@
     nv set $ps_if"_dhcpv6_end"="::"
 
     #适配页面等其他地方使用老NV
-    nv set ipv6_wan_ipaddr="::"
+    nv set $ps_if"_ipv6_pdp"="::"
 	nv set $ps_if"_ipv6_state"="dead"
 	
 	local_ipv6_addr_nv="$ps_if""_local_ipv6_addr"
diff --git a/ap/os/linux/linux-3.4.x/drivers/net/psnet/psnet_io.c b/ap/os/linux/linux-3.4.x/drivers/net/psnet/psnet_io.c
index b5ffada..07db9aa 100755
--- a/ap/os/linux/linux-3.4.x/drivers/net/psnet/psnet_io.c
+++ b/ap/os/linux/linux-3.4.x/drivers/net/psnet/psnet_io.c
@@ -94,6 +94,8 @@
 
 int ra_mtu_enable;
 module_param(ra_mtu_enable, int, 0644);
+int rs_send_flag;
+module_param(rs_send_flag, int, 0644);
 extern struct psnet *global_psnet[DDR_DEV_MAX];
 
 void psnet_parse_RA_pkt(unsigned char cid, unsigned char* pkt, int len)
@@ -187,7 +189,7 @@
 
 int psnet_get_prefix(unsigned char cid, int len, unsigned char *prefix, unsigned char *prefix_len)
 {
-	if(cid > 0 && cid <= DDR_DEV_MAX){
+	if(cid > 0 && cid <= DDR_DEV_MAX && rs_send_flag == 0){
 		if(g_psnet_ipv6_prefix[cid-1].flag == 0){
 			int ret = down_timeout(&g_psnet_ipv6_prefix[cid-1].sem, 3*HZ);
 			if(ret != 0)//cov
diff --git a/ap/os/linux/linux-3.4.x/drivers/net/zvnet/zvnet_dev.c b/ap/os/linux/linux-3.4.x/drivers/net/zvnet/zvnet_dev.c
index 426b9ed..d059496 100755
--- a/ap/os/linux/linux-3.4.x/drivers/net/zvnet/zvnet_dev.c
+++ b/ap/os/linux/linux-3.4.x/drivers/net/zvnet/zvnet_dev.c
@@ -399,6 +399,7 @@
 	if (!skb)

 	{

 		write_free_capbuf(pbuf_temp->buff);

+		if(printk_ratelimit())

 		zv_err("skb=%d alloc fail tops=%d fromps=%d\n",atomic_read(&skb_used),atomic_read(&skb_tops),atomic_read(&skb_fromps));

 		return NULL;

 	}

@@ -992,6 +993,9 @@
 							.chID = channel_20,

 							.flag = 0};

 	struct T_zvnet_rpmsg buff[ZVNET_XMIT_BUFF_NUM];

+	struct sched_param param = { .sched_priority = 1 };

+	param.sched_priority = 36;

+	sched_setscheduler(current, SCHED_FIFO, &param);

     //struct zvp_header hzvp;

 /*

     if(IS_ERR(zvnetdev)) {

@@ -1027,6 +1031,7 @@
 		for(i = 0; i < num; i++){

 			skb = skb_build_capbuf(&buff[i]);

 			if (unlikely(!skb)) {

+				if(printk_ratelimit())

 				zv_err("skb_build_capbuf fail,len=%d i=%d",ret_len,i);

 				continue;

 			}

diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/u_ether.c b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/u_ether.c
index 16cf5dc..14d4b28 100755
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/u_ether.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/u_ether.c
@@ -294,6 +294,7 @@
 
 	skb = dev_alloc_skb(size);
 	if (skb == NULL) {
+		if(printk_ratelimit())
 		DBG(dev, "no rx skb\n");
 		goto enomem;
 	}
diff --git a/ap/os/linux/linux-3.4.x/net/core/SI/ext_mem.c b/ap/os/linux/linux-3.4.x/net/core/SI/ext_mem.c
index 5ebd6dc..851493c 100755
--- a/ap/os/linux/linux-3.4.x/net/core/SI/ext_mem.c
+++ b/ap/os/linux/linux-3.4.x/net/core/SI/ext_mem.c
@@ -334,6 +334,7 @@
 		psnet_freepsbuf(pbuf_temp->pbuf_head);

 #endif

 #endif

+		if(printk_ratelimit())

 		printk("skb=%d psbuff fail1 tops=%d fromps=%d\n",atomic_read(&skb_used),atomic_read(&skb_tops),atomic_read(&skb_fromps));

 		return NULL;

 	}

diff --git a/ap/os/linux/linux-3.4.x/net/core/fastproc/fast6.c b/ap/os/linux/linux-3.4.x/net/core/fastproc/fast6.c
index 3805cac..986119f 100755
--- a/ap/os/linux/linux-3.4.x/net/core/fastproc/fast6.c
+++ b/ap/os/linux/linux-3.4.x/net/core/fastproc/fast6.c
@@ -40,6 +40,7 @@
 extern struct tasklet_struct fast_tx_bh;
 /* ******************************** º¯ÊýÉêÃ÷ ********************************/
 extern int zvnet_get_index_by_netdev(struct net_device *net);
+extern struct net_device *fast_br_parent(const struct net_device *dev);
 
 /* ******************************** º¯ÊýʵÏÖ ********************************/
 // ipv6±¨Í·À©Õ¹Ñ¡ÏÅжÏÊÇ·ñ°üº¬l4head
@@ -367,6 +368,10 @@
 			return 0;
 		}
 	}
+	if(skb->isvlan && fast6_entry_data->hh_flag == 0){
+		rcu_read_unlock();
+		return 0;
+	}
 #endif
     dev = fast6_entry_data->outdev;
     /*Åжϱ¨Îij¤¶ÈÊÇ·ñ³¬¹ý³ö¿ÚDEVµÄMTU*/
@@ -402,6 +407,11 @@
 	l4_offset = l4head - skb->data;
     //tcpdumpin_sq(skb);
 #if _USE_VEHICLE_DC
+	if(skb->indev && zvnet_get_index_by_netdev(skb->indev) >= 0 && (zvnet_get_index_by_netdev(dev) >= 0 || 
+		((dev->priv_flags & IFF_EBRIDGE) && (fast_br_parent(skb->indev) != dev)))){
+		rcu_read_unlock();
+		return 0;
+	}
 	if(fastbr_level != 1){
 		if (IPPROTO_TCP == tuple.dst.protonum){
 			tcph = (struct tcphdr *)l4head;
diff --git a/ap/os/linux/linux-3.4.x/net/core/fastproc/fast_common.c b/ap/os/linux/linux-3.4.x/net/core/fastproc/fast_common.c
index 0d0b071..54d1f74 100755
--- a/ap/os/linux/linux-3.4.x/net/core/fastproc/fast_common.c
+++ b/ap/os/linux/linux-3.4.x/net/core/fastproc/fast_common.c
@@ -722,11 +722,11 @@
 {
     tcpack_rel(entry);
     entry->ct->timeout.function((unsigned long)entry->ct);
-    //²»ÔÙÒýÓÃctÁË
-    nf_ct_put(entry->ct);
 #if _USE_VEHICLE_DC
 	fast_entry_unlink_cap(entry);
 #endif
+    //²»ÔÙÒýÓÃctÁË
+    nf_ct_put(entry->ct);
     fn_list_del(list_head, entry, free_entry);
 }
 
@@ -1951,6 +1951,7 @@
     skb->protocol = old_pro;
     skb->data = old_data;
     skb->len = old_len;
+	skb->isvlan = 0;
     return 0;
 }
 
diff --git a/ap/os/linux/linux-3.4.x/net/core/fastproc/fastnat.c b/ap/os/linux/linux-3.4.x/net/core/fastproc/fastnat.c
index 7e9c7b1..dc9d5a4 100755
--- a/ap/os/linux/linux-3.4.x/net/core/fastproc/fastnat.c
+++ b/ap/os/linux/linux-3.4.x/net/core/fastproc/fastnat.c
@@ -285,6 +285,10 @@
         goto err_out;
     }
 }
+	if(skb->isvlan && nat_entry_data->hh_flag == 0){
+		rcu_read_unlock();
+		goto err_out;
+	}
 #endif
 /* Ended by AICoder, pid:40ce82efac7642c141d308ead0cdf7208c94b48b */
     dev = nat_entry_data->outdev;
@@ -514,9 +518,8 @@
 				struct nf_conn *ct_fwd = (struct nf_conn *)skb->nfct_bak;
 				fast_entry_t *nat_entry_fwd = ct_fwd?((fast_entry_t *)ct_fwd->fast_entry):nat_entry;
 				fast_entry_data_t *cap_entry_data = &nat_entry_fwd->data[dir];
-				if (nat_entry_fwd){
-					/*skbÒѾ­ÈÆ»ØÀ´ÁË£¬°ó¶¨ÐÂÀÏfast£¬¼Ç¼capct*/
-					spin_lock_bh(&fastnat_spinlock);
+				spin_lock_bh(&fastnat_spinlock);
+				if (nat_entry_fwd && nat_entry_fwd->fwd_entry == NULL && nat_entry->fwd_entry == NULL){
 					if(nat_entry_fwd != nat_entry){
 						if(!__nf_ct_tuple_src_equal(&cap_entry_data->tuplehash.tuple, &nat_entry_data->tuplehash.tuple) &&
 							__nf_ct_tuple_dst_equal(&cap_entry_data->tuplehash.tuple, &nat_entry_data->tuplehash.tuple)){
@@ -593,8 +596,8 @@
 							nat_entry_fwd->data[0].outdev = nat_entry_fwd->data[1].indev;
 						}
 					}
-					spin_unlock_bh(&fastnat_spinlock);
 				}
+				spin_unlock_bh(&fastnat_spinlock);
 			}else{
 /* Started by AICoder, pid:h335cmc8c7cc4681459c0af3d0a68e0bb604fd47 */
 if(nat_entry_data->indev != skb->indev){
diff --git a/ap/project/zx297520v3/prj_vehicle_dc/config/normal/config.linux b/ap/project/zx297520v3/prj_vehicle_dc/config/normal/config.linux
index 5385154..b072530 100755
--- a/ap/project/zx297520v3/prj_vehicle_dc/config/normal/config.linux
+++ b/ap/project/zx297520v3/prj_vehicle_dc/config/normal/config.linux
@@ -774,7 +774,7 @@
 # CONFIG_L2TP is not set
 CONFIG_STP=y
 CONFIG_BRIDGE=y
-CONFIG_BRIDGE_IGMP_SNOOPING=y
+# CONFIG_BRIDGE_IGMP_SNOOPING is not set
 # CONFIG_NET_DSA is not set
 CONFIG_VLAN_8021Q=y
 # CONFIG_VLAN_8021Q_GVRP is not set
diff --git a/ap/project/zx297520v3/prj_vehicle_dc_ref/config/normal/config.linux b/ap/project/zx297520v3/prj_vehicle_dc_ref/config/normal/config.linux
index 16efbbb..152255d 100755
--- a/ap/project/zx297520v3/prj_vehicle_dc_ref/config/normal/config.linux
+++ b/ap/project/zx297520v3/prj_vehicle_dc_ref/config/normal/config.linux
@@ -774,7 +774,7 @@
 # CONFIG_L2TP is not set
 CONFIG_STP=y
 CONFIG_BRIDGE=y
-CONFIG_BRIDGE_IGMP_SNOOPING=y
+# CONFIG_BRIDGE_IGMP_SNOOPING is not set
 # CONFIG_NET_DSA is not set
 CONFIG_VLAN_8021Q=y
 # CONFIG_VLAN_8021Q_GVRP is not set
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_sys b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_sys
index eade5dc..2474478 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_sys
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_sys
@@ -443,3 +443,4 @@
 DEBUG_INFO_FILE_NUM=2
 DEBUG_INFO_FILE_TOTAL_SIZE=1
 #debug info end
+nofast_port=21+22+23+25+53+67+68+69+110+115+123+500+1352+1723+1990+1991+1992+1993+1994+1995+1996+1997+1998+4500+5060
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_user b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_user
index 7570274..c084e8e 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_user
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_user
@@ -153,7 +153,7 @@
 natenable=
 dosenable=0
 need_jilian=1
-nofast_port=21+22+23+25+53+67+68+69+110+115+123+443+500+1352+1723+1990+1991+1992+1993+1994+1995+1996+1997+1998+4500+5060
+nofast_port=21+22+23+25+53+67+68+69+110+115+123+500+1352+1723+1990+1991+1992+1993+1994+1995+1996+1997+1998+4500+5060
 nv_save_interval=300
 path_conf=/etc_rw
 path_ro=/etc_ro
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_sys b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_sys
index 6745a8f..a42a25c 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_sys
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_sys
@@ -457,3 +457,4 @@
 DEBUG_INFO_FILE_NUM=2
 DEBUG_INFO_FILE_TOTAL_SIZE=1
 #debug info end
+nofast_port=21+22+23+25+53+67+68+69+110+115+123+500+1352+1723+1990+1991+1992+1993+1994+1995+1996+1997+1998+4500+5060
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user
index f7695af..ef54214 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user
@@ -153,7 +153,7 @@
 natenable=
 dosenable=0
 need_jilian=1
-nofast_port=21+22+23+25+53+67+68+69+110+115+123+443+500+1352+1723+1990+1991+1992+1993+1994+1995+1996+1997+1998+4500+5060
+nofast_port=21+22+23+25+53+67+68+69+110+115+123+500+1352+1723+1990+1991+1992+1993+1994+1995+1996+1997+1998+4500+5060
 nv_save_interval=300
 path_conf=/etc_rw
 path_ro=/etc_ro
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/skbuff.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/skbuff.c
index ccc996d..630f806 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/skbuff.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/net/core/skbuff.c
@@ -621,9 +621,9 @@
 			panic("");
 	}else{
 		if(skb->capHead){
+			v7_dma_map_area(skb->head, skb->end - skb->head + sizeof(struct skb_shared_info), DMA_FROM_DEVICE);
 			if(skb->isToap)
 				return;
-			v7_dma_map_area(skb->head, skb->end - skb->head + sizeof(struct skb_shared_info), DMA_FROM_DEVICE);
 			write_free_apbuf(skb->capHead);
 			skb->capHead = NULL;
 		}else{