[Bugfix][T106BUG]Fixed the problem that FTP speed is too slow in Linux
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: I2e7d709ae744c9ddda01abacc0eac1ad4d9babbc
diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/multi_packet.c b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/multi_packet.c
index eab1ea0..ea72d9e 100755
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/multi_packet.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/multi_packet.c
@@ -128,7 +128,7 @@
struct multi_packet{
volatile int maxPacketNum;
-
+ volatile int bindedMaxPacketNum;
unsigned int active;
struct usb_gadget *gadget;
@@ -1468,6 +1468,12 @@
return multiPacket.maxPacketNum;
}
+void multi_packet_set_actual_maxnum(int max_packet_num)
+{
+ multiPacket.maxPacketNum = max_packet_num;
+ multiPacket.bind.maxPacketNum = max_packet_num;
+ multiPacket.unbind.maxPacketNum = max_packet_num;
+}
void multi_packet_activate(void)
{
@@ -1501,6 +1507,7 @@
{
int retval = 0;
unsigned long flags;
+ struct multi_packet *multiPkt = &multiPacket;
struct sk_buff *skb = (struct sk_buff *)req->context;
ep->is_netep = 1;
int bind_th_state = 0;
@@ -1510,7 +1517,10 @@
//req->dma = virt_to_phys(req->buf);
//retval = usb_gadget_map_request(multiPacket.gadget, req, 1);
//dma_sync_single_for_device();
- ep->protocol_type = 2;
+ if(strcmp(multiPkt->geth->func.name,RNDIS_NAME_STR) == 0)
+ ep->protocol_type = 1;
+ else
+ ep->protocol_type = 2;
retval = usb_ep_queue(ep, req, gfp_flags);
}
else
@@ -1586,12 +1596,16 @@
{
int retval = 0;
unsigned long flags;
-
+ struct multi_packet *multiPkt = &multiPacket;
ep->is_netep = 1;
if(multi_packet_get_maxnum() <=1 )
{
///retval = usb_gadget_map_request(multiPacket.gadget, req, 0);
- ep->protocol_type = 2;
+ //ep->protocol_type = 2;
+ if(strcmp(multiPkt->geth->func.name,RNDIS_NAME_STR) == 0)
+ ep->protocol_type = 1;
+ else
+ ep->protocol_type = 2;
retval = usb_ep_queue(ep, req, gfp_flags);
}
else
@@ -1776,6 +1790,16 @@
multiPkt->trans_buffer_size = 0 ;
}
+void set_rndis_wrap_unwrap_header()
+{
+ struct multi_packet *multiPkt = &multiPacket;
+ if(multiPkt->maxPacketNum > 1)
+ {
+ multiPkt->geth->ioport->wrap = NULL;
+ multiPkt->geth->ioport->unwrap = NULL;
+ }
+}
+
int multi_packet_buf_alloc()
{
struct multi_packet *multiPkt = &multiPacket;
@@ -1829,6 +1853,7 @@
struct usb_multi_packet *pbind = &multiPacket.bind;
struct usb_multi_packet *punbind = &multiPacket.unbind;
multiPkt->maxPacketNum = get_vnic_multi_packet_num();
+ multiPkt->bindedMaxPacketNum = multiPkt->maxPacketNum;
#if 1
size_t alloc_req_size = (multiPkt->maxPacketNum + PACKET_BUF_EXTRA_NUM) * sizeof(struct usb_request *) ;
@@ -1873,20 +1898,22 @@
usb_multi_pkt_init(pbind, 1);
pbind->thread = kthread_run(usbBind_thread, pbind, "usbbind_thread");
BUG_ON(IS_ERR(pbind->thread));
+#if 0
if(strcmp(geth->func.name,RNDIS_NAME_STR)==0)
{
geth->wrap = NULL;
}
#endif
+#endif
pbind->maxPacketNum = multiPkt->maxPacketNum ;
punbind->maxPacketNum = multiPkt->maxPacketNum ;
-
+#if 0
if(strcmp(geth->func.name,RNDIS_NAME_STR) == 0)
{
geth->unwrap = NULL;
}
-
+#endif
//ÅжÏÍø¿¨ÀàÐÍ
printk("$$$$$$$geth->func.name = %s \n",geth->func.name) ;
if(strcmp(geth->func.name,RNDIS_NAME_STR) == 0)
@@ -1931,19 +1958,22 @@
USBSTACK_DBG("multi-pkt exit begin!");
- if(multiPacket.maxPacketNum>1)
+ if(multiPacket.maxPacketNum>1 || multiPacket.bindedMaxPacketNum > 1)
{
#ifndef RNDIS_DL_MULTI_DESC
USBSTACK_DBG("kill bind thread");
kthread_stop(pbind->thread);
- usb_mutli_pkt_exit(pbind, 1);
+ if (multiPacket.maxPacketNum > 1)
+ usb_mutli_pkt_exit(pbind, 1);
#endif
USBSTACK_DBG("kill unbind thread");
kthread_stop(punbind->thread);
- usb_mutli_pkt_exit(punbind, 0);
+ if (multiPacket.maxPacketNum > 1)
+ usb_mutli_pkt_exit(punbind, 0);
}
multiPacket.maxPacketNum = 0;
+ multiPacket.bindedMaxPacketNum = 0;
if(multiPacket.alloc_mem != NULL)
{
kfree(multiPacket.alloc_mem);
diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/multi_packet.h b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/multi_packet.h
index c9ebd1d..4197f94 100644
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/multi_packet.h
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/multi_packet.h
@@ -8,6 +8,9 @@
#define MULTIPACKET_BUF_ALLOC 1
int multi_packet_get_maxnum(void);
+void multi_packet_set_actual_maxnum(int max_packet_num);
+void set_rndis_wrap_unwrap_header(void);
+
typedef void (*usb_complete_t)(struct usb_ep *ep, struct usb_request *req);
int multi_packet_tx_queue(struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags);
diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/rndis.c b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/rndis.c
index e2d2e3b..d72d333 100755
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/rndis.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/rndis.c
@@ -58,6 +58,12 @@
#define rndis_debug 0
#endif
extern unsigned int get_panic_flag(void);
+extern int get_vnic_multi_packet_num(void);
+extern void multi_packet_set_actual_maxnum(int max_packet_num);
+extern void set_rndis_wrap_unwrap_header(void);
+
+
+
#define RNDIS_MAX_CONFIGS 1
extern void usb_notify_up(usb_notify_event notify_type, void* puf);
@@ -585,6 +591,8 @@
{
rndis_init_cmplt_type *resp;
rndis_resp_t *r;
+ int pc_expect_max_packet_num = 0;
+ int max_multi_packet_num = get_vnic_multi_packet_num();
struct rndis_params *params = rndis_per_dev_params + configNr;
if (!params->dev)
@@ -605,8 +613,16 @@
resp->Medium = cpu_to_le32(RNDIS_MEDIUM_802_3);
#if 1
- resp->MaxPacketsPerTransfer = cpu_to_le32(multi_packet_get_maxnum());//cpu_to_le32(1);
- resp->MaxTransferSize = 1568*multi_packet_get_maxnum();
+ pc_expect_max_packet_num = le32_to_cpu(buf->MaxTransferSize) / 1568;
+ if (pc_expect_max_packet_num > max_multi_packet_num)
+ pc_expect_max_packet_num = max_multi_packet_num;
+ resp->MaxPacketsPerTransfer = cpu_to_le32(pc_expect_max_packet_num);
+ resp->MaxTransferSize = 1568*pc_expect_max_packet_num;
+ multi_packet_set_actual_maxnum(pc_expect_max_packet_num);
+ set_rndis_wrap_unwrap_header();
+
+ //resp->MaxPacketsPerTransfer = cpu_to_le32(multi_packet_get_maxnum());//cpu_to_le32(1);
+ //resp->MaxTransferSize = 1568*multi_packet_get_maxnum();
#else
resp->MaxPacketsPerTransfer = cpu_to_le32(1);
resp->MaxTransferSize = cpu_to_le32(
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.c
index bea60e1..ffdba06 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.c
@@ -451,7 +451,7 @@
}
if(unlikely(skb_headroom(skb) < NET_SKB_PAD || skb->next//|| skb->capHead
- || skb->fclone || skb->cloned || (skb_shinfo(skb)->nr_frags)
+ || skb->fclone || skb->cloned || (skb_shinfo(skb)->nr_frags) || skb->sk || (skb->indev == NULL)
|| (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) || (skb_has_frag_list(skb)))){
int ret_len = skb->len;