Skip to contentSkip to conversation

3.7-rc2 regression : file copied to CIFS-mounted directory corrupted

PATCH Applied Jongman Heo 5 participants 12 messages Oct 23, 2012 – Nov 3, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Hi,

------- Original Message -------
Sender : Eric Dumazet<[email protected]>
Date : 2012-10-23 15:08 (GMT+09:00)
Title : Re: 3.7-rc2 regression : file copied to CIFS-mounted directory corrupted

Quoted 8 lines · Jongman Heo

Hmm,

I've just met the issue, with the commit 5640f768 reverted.
It seems that the issue does not always happen. So, my bisection may not be correct.

At this moment, I don't have enough time to do bisection again..

Regards.

What happens, if instead of reverting you try the following ?

If this solves the problem, then we shall find the driver that assumes frags are order-0 pages only.

net/core/sock.c +0 -0
index 8a146cf..a743e7c 100644
@@ -1726,7 +1726,7 @@ struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size,

EXPORT_SYMBOL(sock_alloc_send_skb);

/* On 32bit arches, an skb frag is limited to 2^15 */ -#define SKB_FRAG_PAGE_ORDER get_order(32768) +#define SKB_FRAG_PAGE_ORDER 0

bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag) {

------------------------------------------------------------------------------------

With above patch, the issue is not reproduced so far.

- Current mainline : issue reproduced on 1st run
- Reverting commit 5640f768 (tested again) : not reproduced until 300 runs
- Applying above patch : not reproduced until 300 runs

To be sure, maybe more testing is needed...

FYI, vmxnet3 driver is used for ethernet.

When the issue happens, following error messages were emitted.

[   84.445735] CIFS VFS: default security mechanism requested.  The default security mechanism will be upgraded from ntlm to ntlmv2 in kernel release 3.3
[   87.135291] net eth0: eth0: tq[0] error 0x80000000
[   87.135298] net eth0: eth0: tq[1] error 0x80000000
[   87.135402] eth0: resetting
[   87.146071] eth0: intr type 3, mode 0, 5 vectors allocated
[   87.146695] eth0: NIC Link is Up 10000 Mbps
[   88.925044] CIFS VFS: Error -104 sending data on socket to server
[   98.934656] CIFS VFS: No writable handles for inode
[   98.938317] CIFS VFS: No writable handles for inode
[   98.940895] CIFS VFS: No writable handles for inode
[   98.943712] CIFS VFS: No writable handles for inode
[   98.946050] CIFS VFS: No writable handles for inode
[   98.948569] CIFS VFS: No writable handles for inode
[   98.951320] CIFS VFS: No writable handles for inode
[   98.954675] CIFS VFS: No writable handles for inode
[   98.957188] CIFS VFS: No writable handles for inode
[   98.960622] CIFS VFS: No writable handles for inode
[   98.963083] CIFS VFS: No writable handles for inode
[   98.965851] CIFS VFS: No writable handles for inode
[   98.970822] CIFS VFS: No writable handles for inode
[   98.973132] CIFS VFS: No writable handles for inode
[   98.976405] CIFS VFS: No writable handles for inode
[   98.978737] CIFS VFS: No writable handles for inode
[   98.981645] CIFS VFS: No writable handles for inode
[   98.983794] CIFS VFS: No writable handles for inode
[   98.987325] CIFS VFS: No writable handles for inode
[   98.989483] CIFS VFS: No writable handles for inode
[   98.991317] CIFS VFS: No writable handles for inode
[   98.993488] CIFS VFS: No writable handles for inode
[   98.995697] CIFS VFS: No writable handles for inode
[   98.997633] CIFS VFS: No writable handles for inode
[   98.999935] CIFS VFS: No writable handles for inode
[   99.002929] CIFS VFS: No writable handles for inode
[   99.004821] CIFS VFS: No writable handles for inode
[   99.006988] CIFS VFS: No writable handles for inode
[   99.009084] CIFS VFS: No writable handles for inode
[   99.011119] CIFS VFS: No writable handles for inode
[   99.013276] CIFS VFS: No writable handles for inode
[   99.018433] CIFS VFS: No writable handles for inode
[   99.020087] CIFS VFS: No writable handles for inode
[   99.022303] CIFS VFS: No writable handles for inode
[   99.024561] CIFS VFS: No writable handles for inode
[   99.027029] CIFS VFS: No writable handles for inode
[   99.029989] CIFS VFS: No writable handles for inode
[   99.031945] CIFS VFS: No writable handles for inode
[   99.033966] CIFS VFS: No writable handles for inode
[   99.036478] CIFS VFS: No writable handles for inode
[   99.038424] CIFS VFS: No writable handles for inode
[   99.040542] CIFS VFS: No writable handles for inode
[   99.043051] CIFS VFS: No writable handles for inode
[   99.045687] CIFS VFS: No writable handles for inode
[   99.047890] CIFS VFS: No writable handles for inode
[   99.049974] CIFS VFS: No writable handles for inode
[   99.051911] CIFS VFS: No writable handles for inode
[   99.053984] CIFS VFS: No writable handles for inode
[   99.056304] CIFS VFS: No writable handles for inode
[   99.058446] CIFS VFS: No writable handles for inode
[   99.060956] CIFS VFS: No writable handles for inode
[   99.063243] CIFS VFS: No writable handles for inode
[   99.065744] CIFS VFS: No writable handles for inode
[   99.068592] CIFS VFS: No writable handles for inode
[   99.072413] CIFS VFS: No writable handles for inode
[   99.074762] CIFS VFS: No writable handles for inode
[   99.077070] CIFS VFS: No writable handles for inode
[   99.079275] CIFS VFS: No writable handles for inode
[   99.081153] CIFS VFS: No writable handles for inode
[   99.084438] CIFS VFS: No writable handles for inode
[   99.085381] CIFS VFS: No writable handles for inode
[   99.087665] CIFS VFS: No writable handles for inode
[   99.089626] CIFS VFS: No writable handles for inode
[   99.093592] CIFS VFS: No writable handles for inode
[   99.093917] CIFS VFS: No writable handles for inode
[   99.098944] CIFS VFS: No writable handles for inode
[   99.099862] CIFS VFS: No writable handles for inode
[   99.101750] CIFS VFS: No writable handles for inode
[   99.103742] CIFS VFS: No writable handles for inode
[   99.105721] CIFS VFS: No writable handles for inode
[   99.108514] CIFS VFS: No writable handles for inode
[   99.110649] CIFS VFS: No writable handles for inode
[   99.112777] CIFS VFS: No writable handles for inode
[   99.114931] CIFS VFS: No writable handles for inode
[   99.116961] CIFS VFS: No writable handles for inode
[   99.118876] CIFS VFS: No writable handles for inode
[   99.121018] CIFS VFS: No writable handles for inode
[   99.123855] CIFS VFS: No writable handles for inode
[   99.128161] CIFS VFS: No writable handles for inode
[   99.131628] CIFS VFS: No writable handles for inode
[   99.133981] CIFS VFS: No writable handles for inode
[   99.136556] CIFS VFS: No writable handles for inode
[   99.144838] CIFS VFS: No writable handles for inode
[   99.145400] CIFS VFS: No writable handles for inode
[   99.147937] CIFS VFS: No writable handles for inode
[   99.150207] CIFS VFS: No writable handles for inode
[   99.152736] CIFS VFS: No writable handles for inode
[   99.155053] CIFS VFS: No writable handles for inode
[   99.159129] CIFS VFS: No writable handles for inode
[   99.161704] CIFS VFS: No writable handles for inode
[   99.164052] CIFS VFS: No writable handles for inode
[   99.165932] CIFS VFS: No writable handles for inode
[   99.167853] CIFS VFS: No writable handles for inode
[   99.170069] CIFS VFS: No writable handles for inode
[   99.173877] CIFS VFS: No writable handles for inode
[   99.176124] CIFS VFS: No writable handles for inode
[   99.178481] CIFS VFS: No writable handles for inode
[   99.180650] CIFS VFS: No writable handles for inode
[   99.182594] CIFS VFS: No writable handles for inode
[   99.184490] CIFS VFS: No writable handles for inode
[   99.186808] CIFS VFS: No writable handles for inode
[   99.189290] CIFS VFS: No writable handles for inode
[   99.191268] CIFS VFS: No writable handles for inode
[   99.193450] CIFS VFS: No writable handles for inode
[   99.195688] CIFS VFS: No writable handles for inode
[   99.197691] CIFS VFS: No writable handles for inode
[   99.199917] CIFS VFS: No writable handles for inode
[   99.202435] CIFS VFS: No writable handles for inode
[   99.204365] CIFS VFS: No writable handles for inode
[   99.207785] CIFS VFS: No writable handles for inode
[   99.208852] CIFS VFS: No writable handles for inode
[   99.210881] CIFS VFS: No writable handles for inode
[   99.212819] CIFS VFS: No writable handles for inode
[   99.214687] CIFS VFS: No writable handles for inode
[   99.217646] CIFS VFS: No writable handles for inode
[   99.219113] CIFS VFS: No writable handles for inode
[   99.221024] CIFS VFS: No writable handles for inode
[   99.223119] CIFS VFS: No writable handles for inode
[   99.225714] CIFS VFS: No writable handles for inode
[   99.227819] CIFS VFS: No writable handles for inode
[   99.230155] CIFS VFS: No writable handles for inode
[   99.232507] CIFS VFS: No writable handles for inode
[   99.234721] CIFS VFS: No writable handles for inode
[   99.237112] CIFS VFS: No writable handles for inode
[   99.239099] CIFS VFS: No writable handles for inode
[   99.241165] CIFS VFS: No writable handles for inode
[   99.243192] CIFS VFS: No writable handles for inode
[   99.245056] CIFS VFS: No writable handles for inode
[   99.247091] CIFS VFS: No writable handles for inode
[   99.249537] CIFS VFS: No writable handles for inode
[   99.251581] CIFS VFS: No writable handles for inode
[   99.254136] CIFS VFS: No writable handles for inode
[   99.255693] CIFS VFS: No writable handles for inode
[   99.257751] CIFS VFS: No writable handles for inode
[   99.260073] CIFS VFS: No writable handles for inode
[   99.262034] CIFS VFS: No writable handles for inode
[   99.263945] CIFS VFS: No writable handles for inode
[   99.268429] CIFS VFS: No writable handles for inode
[   99.269245] CIFS VFS: No writable handles for inode
[   99.271384] CIFS VFS: No writable handles for inode
[   99.284337] CIFS VFS: No writable handles for inode
[   99.286461] CIFS VFS: No writable handles for inode
[   99.288751] CIFS VFS: No writable handles for inode
[   99.291391] CIFS VFS: No writable handles for inode
[   99.293489] CIFS VFS: No writable handles for inode
[   99.295453] CIFS VFS: No writable handles for inode
[   99.297539] CIFS VFS: No writable handles for inode
[   99.299699] CIFS VFS: No writable handles for inode
[   99.301625] CIFS VFS: No writable handles for inode
[   99.303612] CIFS VFS: No writable handles for inode
[   99.307376] CIFS VFS: No writable handles for inode
[   99.307746] CIFS VFS: No writable handles for inode
[   99.310013] CIFS VFS: No writable handles for inode
[   99.314325] CIFS VFS: No writable handles for inode
[   99.314975] CIFS VFS: No writable handles for inode
[   99.317209] CIFS VFS: No writable handles for inode
[   99.319170] CIFS VFS: No writable handles for inode
[   99.321063] CIFS VFS: No writable handles for inode
[   99.324000] CIFS VFS: No writable handles for inode
[   99.325868] CIFS VFS: No writable handles for inode
[   99.328080] CIFS VFS: No writable handles for inode
[   99.330139] CIFS VFS: No writable handles for inode
[   99.332033] CIFS VFS: No writable handles for inode
[   99.333893] CIFS VFS: No writable handles for inode
[   99.336164] CIFS VFS: No writable handles for inode
[   99.338178] CIFS VFS: No writable handles for inode
[   99.340240] CIFS VFS: No writable handles for inode
[   99.344359] CIFS VFS: No writable handles for inode
[   99.345060] CIFS VFS: No writable handles for inode
[   99.347397] CIFS VFS: No writable handles for inode
[   99.349643] CIFS VFS: No writable handles for inode
[   99.351537] CIFS VFS: No writable handles for inode
[   99.353579] CIFS VFS: No writable handles for inode
[   99.355830] CIFS VFS: No writable handles for inode
[   99.359613] CIFS VFS: No writable handles for inode
[   99.361690] CIFS VFS: No writable handles for inode
[   99.363793] CIFS VFS: No writable handles for inode
[   99.365703] CIFS VFS: No writable handles for inode
[   99.367615] CIFS VFS: No writable handles for inode
[   99.369506] CIFS VFS: No writable handles for inode
[   99.371413] CIFS VFS: No writable handles for inode
[   99.373504] CIFS VFS: No writable handles for inode
[   99.377574] CIFS VFS: No writable handles for inode
[   99.380010] CIFS VFS: No writable handles for inode
[   99.382033] CIFS VFS: No writable handles for inode
[   99.384279] CIFS VFS: No writable handles for inode
[   99.386217] CIFS VFS: No writable handles for inode
[   99.388558] CIFS VFS: No writable handles for inode
[   99.390884] CIFS VFS: No writable handles for inode
[   99.393282] CIFS VFS: No writable handles for inode
[   99.395154] CIFS VFS: No writable handles for inode
[   99.397046] CIFS VFS: No writable handles for inode
[   99.398986] CIFS VFS: No writable handles for inode
[   99.400920] CIFS VFS: No writable handles for inode
[   99.402976] CIFS VFS: No writable handles for inode
[   99.405042] CIFS VFS: No writable handles for inode
[   99.407172] CIFS VFS: No writable handles for inode
[   99.409224] CIFS VFS: No writable handles for inode
[   99.411218] CIFS VFS: No writable handles for inode
[   99.413171] CIFS VFS: No writable handles for inode
[   99.415035] CIFS VFS: No writable handles for inode
[   99.417124] CIFS VFS: No writable handles for inode
[   99.419719] CIFS VFS: No writable handles for inode
[  158.477345] net eth0: eth0: tq[0] error 0x80000000
[  158.477353] net eth0: eth0: tq[1] error 0x80000000
[  158.477448] eth0: resetting
[  158.486170] eth0: intr type 3, mode 0, 5 vectors allocated
[  158.486718] eth0: NIC Link is Up 10000 Mbps
[  160.223384] net eth0: eth0: tq[0] error 0x80000000
[  160.223392] net eth0: eth0: tq[1] error 0x80000000
[  160.223507] eth0: resetting
[  160.236060] eth0: intr type 3, mode 0, 5 vectors allocated
[  160.236654] eth0: NIC Link is Up 10000 Mbps
[  161.965368] net eth0: eth0: tq[0] error 0x80000000
[  161.965374] net eth0: eth0: tq[1] error 0x80000000
[  161.965409] eth0: resetting
[  161.974675] eth0: intr type 3, mode 0, 5 vectors allocated
[  161.975219] eth0: NIC Link is Up 10000 Mbps
[  162.441348] net eth0: eth0: tq[0] error 0x80000000
[  162.441356] net eth0: eth0: tq[1] error 0x80000000
[  162.441467] eth0: resetting
[  162.451447] eth0: intr type 3, mode 0, 5 vectors allocated
[  162.451791] eth0: NIC Link is Up 10000 Mbps
[  162.733057] net eth0: eth0: tq[0] error 0x80000000
[  162.733064] net eth0: eth0: tq[1] error 0x80000000
[  162.733103] eth0: resetting
[  162.743815] eth0: intr type 3, mode 0, 5 vectors allocated
[  162.744189] eth0: NIC Link is Up 10000 Mbps
[  163.028137] net eth0: eth0: tq[0] error 0x80000000
[  163.028143] net eth0: eth0: tq[1] error 0x80000000
[  163.028184] eth0: resetting
[  163.040926] eth0: intr type 3, mode 0, 5 vectors allocated
[  163.041285] eth0: NIC Link is Up 10000 Mbps
[  163.620144] net eth0: eth0: tq[0] error 0x80000000
[  163.620150] net eth0: eth0: tq[1] error 0x80000000
[  163.620246] eth0: resetting
[  163.632021] eth0: intr type 3, mode 0, 5 vectors allocated
[  163.632586] eth0: NIC Link is Up 10000 Mbps
[  164.016532] net eth0: eth0: tq[0] error 0x80000000
[  164.016540] net eth0: eth0: tq[1] error 0x80000000
[  164.016558] eth0: resetting
[  164.026814] eth0: intr type 3, mode 0, 5 vectors allocated
[  164.027315] eth0: NIC Link is Up 10000 Mbps
[  165.855878] net eth0: eth0: tq[0] error 0x80000000
[  165.855886] net eth0: eth0: tq[1] error 0x80000000
[  165.855935] eth0: resetting
[  165.865117] eth0: intr type 3, mode 0, 5 vectors allocated
[  165.865492] eth0: NIC Link is Up 10000 Mbps
[  166.314014] net eth0: eth0: tq[0] error 0x80000000
[  166.314021] net eth0: eth0: tq[1] error 0x80000000
[  166.314107] eth0: resetting
[  166.323707] eth0: intr type 3, mode 0, 5 vectors allocated
[  166.324065] eth0: NIC Link is Up 10000 Mbps
[  166.615083] net eth0: eth0: tq[0] error 0x80000000
[  166.615089] net eth0: eth0: tq[1] error 0x80000000
[  166.615153] eth0: resetting
[  166.624537] eth0: intr type 3, mode 0, 5 vectors allocated
[  166.624945] eth0: NIC Link is Up 10000 Mbps
[  166.918213] net eth0: eth0: tq[0] error 0x80000000
[  166.918220] net eth0: eth0: tq[1] error 0x80000000
[  166.918296] eth0: resetting
[  166.927277] eth0: intr type 3, mode 0, 5 vectors allocated
[  166.927540] eth0: NIC Link is Up 10000 Mbps
[  167.187279] net eth0: eth0: tq[0] error 0x80000000
[  167.187286] net eth0: eth0: tq[1] error 0x80000000
[  167.187373] eth0: resetting
[  167.196182] eth0: intr type 3, mode 0, 5 vectors allocated
[  167.196639] eth0: NIC Link is Up 10000 Mbps
[  167.479262] net eth0: eth0: tq[0] error 0x80000000
[  167.479270] net eth0: eth0: tq[1] error 0x80000000
[  167.479369] eth0: resetting
[  167.488185] eth0: intr type 3, mode 0, 5 vectors allocated
[  167.488563] eth0: NIC Link is Up 10000 Mbps
[  167.938086] net eth0: eth0: tq[0] error 0x80000000
[  167.938092] net eth0: eth0: tq[1] error 0x80000000
[  167.938128] eth0: resetting
[  167.950384] eth0: intr type 3, mode 0, 5 vectors allocated
[  167.950777] eth0: NIC Link is Up 10000 Mbps
[  168.209071] net eth0: eth0: tq[0] error 0x80000000
[  168.209078] net eth0: eth0: tq[1] error 0x80000000
[  168.209220] eth0: resetting
[  168.218303] eth0: intr type 3, mode 0, 5 vectors allocated
[  168.218577] eth0: NIC Link is Up 10000 Mbps
[  168.527235] net eth0: eth0: tq[0] error 0x80000000
[  168.527241] net eth0: eth0: tq[1] error 0x80000000
[  168.527263] eth0: resetting
[  168.538101] eth0: intr type 3, mode 0, 5 vectors allocated
[  168.538471] eth0: NIC Link is Up 10000 Mbps
[  168.796622] net eth0: eth0: tq[0] error 0x80000000
[  168.796628] net eth0: eth0: tq[1] error 0x80000000
[  168.796664] eth0: resetting
[  168.807190] eth0: intr type 3, mode 0, 5 vectors allocated
[  168.807463] eth0: NIC Link is Up 10000 Mbps
[  169.178494] net eth0: eth0: tq[0] error 0x80000000
[  169.178503] net eth0: eth0: tq[1] error 0x80000000
[  169.178668] eth0: resetting
[  169.187163] eth0: intr type 3, mode 0, 5 vectors allocated
[  169.187518] eth0: NIC Link is Up 10000 Mbps
[  169.425058] net eth0: eth0: tq[0] error 0x80000000
[  169.425064] net eth0: eth0: tq[1] error 0x80000000
[  169.425097] eth0: resetting
[  169.436125] eth0: intr type 3, mode 0, 5 vectors allocated
[  169.436492] eth0: NIC Link is Up 10000 Mbps
[  169.824717] net eth0: eth0: tq[0] error 0x80000000
[  169.824724] net eth0: eth0: tq[1] error 0x80000000
[  169.824808] eth0: resetting
[  169.837647] eth0: intr type 3, mode 0, 5 vectors allocated
[  169.837918] eth0: NIC Link is Up 10000 Mbps
[  170.249090] net eth0: eth0: tq[0] error 0x80000000
[  170.249097] net eth0: eth0: tq[1] error 0x80000000
[  170.249112] eth0: resetting
[  170.259593] eth0: intr type 3, mode 0, 5 vectors allocated
[  170.259888] eth0: NIC Link is Up 10000 Mbps
[  172.100435] net eth0: eth0: tq[0] error 0x80000000
[  172.100442] net eth0: eth0: tq[1] error 0x80000000
[  172.100522] eth0: resetting
[  172.113332] eth0: intr type 3, mode 0, 5 vectors allocated
[  172.113614] eth0: NIC Link is Up 10000 Mbps
[  172.396308] net eth0: eth0: tq[0] error 0x80000000
[  172.396314] net eth0: eth0: tq[1] error 0x80000000
[  172.396412] eth0: resetting
[  172.406927] eth0: intr type 3, mode 0, 5 vectors allocated
[  172.407198] eth0: NIC Link is Up 10000 Mbps
[  172.891922] net eth0: eth0: tq[0] error 0x80000000
[  172.891930] net eth0: eth0: tq[1] error 0x80000000
[  172.891951] eth0: resetting
[  172.902945] eth0: intr type 3, mode 0, 5 vectors allocated
[  172.903226] eth0: NIC Link is Up 10000 Mbps
#1 lore raw
Quoted 2 lines · Jongman Heo

FYI, vmxnet3 driver is used for ethernet.

Yes, this driver needs some changes

#define VMXNET3_MAX_TX_BUF_SIZE (1 << 14)

Thats 16KB

As we can now provide up to 32KB fragments we broke something.

vmxnet3_tq_xmit() needs to split large frags into 2 parts. (And without going to skb_linearize() of course !)

Any volunteer ?

Thanks !

#2 lore raw

Eric, thanks for the note. I will submit a patch to do it.

Shreyas

----- Original Message -----

Quoted 22 lines · Jongman Heo
Quoted 3 lines

FYI, vmxnet3 driver is used for ethernet.

Yes, this driver needs some changes

#define VMXNET3_MAX_TX_BUF_SIZE (1 << 14)

Thats 16KB

As we can now provide up to 32KB fragments we broke something.

vmxnet3_tq_xmit() needs to split large frags into 2 parts. (And without going to skb_linearize() of course !)

Any volunteer ?

Thanks !

#3 lore raw

Well, actually the driver does split large frags into frags of VMXNET3_MAX_TX_BUF_SIZE bytes each.

vmxnet3_drv.c
711 while (len) {
712 u32 buf_size;
713
714 if (len < VMXNET3_MAX_TX_BUF_SIZE) {
715 buf_size = len;
716 dw2 |= len;
717 } else {
718 buf_size = VMXNET3_MAX_TX_BUF_SIZE;
719 /* spec says that for TxDesc.len, 0 == 2^14 */
720 }
721
....
743
744 len -= buf_size;
745 buf_offset += buf_size;
746 }

----- Original Message -----

Quoted 32 lines

Eric, thanks for the note. I will submit a patch to do it.

Shreyas

----- Original Message -----

Quoted 11 lines · Jongman Heo
Quoted 3 lines

FYI, vmxnet3 driver is used for ethernet.

Yes, this driver needs some changes

#define VMXNET3_MAX_TX_BUF_SIZE (1 << 14)

Thats 16KB

Quoted 11 lines

As we can now provide up to 32KB fragments we broke something.

vmxnet3_tq_xmit() needs to split large frags into 2 parts. (And without going to skb_linearize() of course !)

Any volunteer ?

Thanks !

_______________________________________________
Pv-drivers mailing list
[email protected]
http://mailman2.vmware.com/mailman/listinfo/pv-drivers

#4 lore raw

On Tue, 2012-10-23 at 03:02 -0700, Shreyas Bhatewara wrote:

Please dont top post on netdev or lkml

Quoted 11 lines

Well, actually the driver does split large frags into frags of VMXNET3_MAX_TX_BUF_SIZE bytes each.

vmxnet3_drv.c
711 while (len) {
712 u32 buf_size;
713
714 if (len < VMXNET3_MAX_TX_BUF_SIZE) {
715 buf_size = len;
716 dw2 |= len;
717 } else {
718 buf_size = VMXNET3_MAX_TX_BUF_SIZE;

Quoted 8 lines

719 /* spec says that for TxDesc.len, 0 == 2^14 */
720 }
721
....
743
744 len -= buf_size;
745 buf_offset += buf_size;
746 }

Only the skb head is handled in the code you copy/pasted.

You need to generalize that to code in lines ~754

Then, the number of estimated descriptors is bad :

/* conservatively estimate # of descriptors to use */ count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) +

	skb_shinfo(skb)->nr_frags + 1;

Yes, you need a more precise estimation and vmxnet3_map_pkt() should eventually split too big frags.

#5 lore raw
Quoted 7 lines · Eric Dumazet

Only the skb head is handled in the code you copy/pasted.

You need to generalize that to code in lines ~754

Then, the number of estimated descriptors is bad :

Quoted 7 lines

/* conservatively estimate # of descriptors to use */ count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) +

	skb_shinfo(skb)->nr_frags + 1;

Yes, you need a more precise estimation and vmxnet3_map_pkt() should eventually split too big frags.

raw patch would be :

drivers/net/vmxnet3/vmxnet3_drv.c +45 -20
index ce9d4f2..0ae1bcc 100644
@@ -744,28 +744,43 @@ vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx,
 
 	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
 		const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
+		u32 buf_size;
 
-		tbi = tq->buf_info + tq->tx_ring.next2fill;
-		tbi->map_type = VMXNET3_MAP_PAGE;
-		tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag,
-						 0, skb_frag_size(frag),
-						 DMA_TO_DEVICE);
+		buf_offset = 0;
+		len = skb_frag_size(frag);
+		while (len) {
+			tbi = tq->buf_info + tq->tx_ring.next2fill;
+			if (len < VMXNET3_MAX_TX_BUF_SIZE) {
+				buf_size = len;
+				dw2 |= len;
+			} else {
+				buf_size = VMXNET3_MAX_TX_BUF_SIZE;
+				/* spec says that for TxDesc.len, 0 == 2^14 */
+			}
+			tbi->map_type = VMXNET3_MAP_PAGE;
+			tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag,
+							 buf_offset, buf_size,
+							 DMA_TO_DEVICE);
 
-		tbi->len = skb_frag_size(frag);
+			tbi->len = buf_size;
 
-		gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
-		BUG_ON(gdesc->txd.gen == tq->tx_ring.gen);
+			gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
+			BUG_ON(gdesc->txd.gen == tq->tx_ring.gen);
 
-		gdesc->txd.addr = cpu_to_le64(tbi->dma_addr);
-		gdesc->dword[2] = cpu_to_le32(dw2 | skb_frag_size(frag));
-		gdesc->dword[3] = 0;
+			gdesc->txd.addr = cpu_to_le64(tbi->dma_addr);
+			gdesc->dword[2] = cpu_to_le32(dw2);
+			gdesc->dword[3] = 0;
 
-		dev_dbg(&adapter->netdev->dev,
-			"txd[%u]: 0x%llu %u %u\n",
-			tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr),
-			le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]);
-		vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
-		dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT;
+			dev_dbg(&adapter->netdev->dev,
+				"txd[%u]: 0x%llu %u %u\n",
+				tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr),
+				le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]);
+			vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
+			dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT;
+
+			len -= buf_size;
+			buf_offset += buf_size;
+		}
 	}
 
 	ctx->eop_txd = gdesc;
@@ -886,6 +901,18 @@ vmxnet3_prepare_tso(struct sk_buff *skb,
 	}
 }
 
+static int txd_estimate(const struct sk_buff *skb)
+{
+	int count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) + 1;
+	int i;
+
+	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
+		const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
+
+		count += VMXNET3_TXD_NEEDED(skb_frag_size(frag));
+	}
+	return count;
+}
 
 /*
  * Transmits a pkt thru a given tq
@@ -914,9 +941,7 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
 	union Vmxnet3_GenericDesc tempTxDesc;
 #endif
 
-	/* conservatively estimate # of descriptors to use */
-	count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) +
-		skb_shinfo(skb)->nr_frags + 1;
+	count = txd_estimate(skb);
 
 	ctx.ipv4 = (vlan_get_protocol(skb) == cpu_to_be16(ETH_P_IP));
 
#6 lore raw

PATCH 1/1 vmxnet3: must split too big fragments

From: Eric Dumazet <[email protected]>

vmxnet3 has a 16Kbytes limit per tx descriptor, that happened to work as long as we provided PAGE_SIZE fragments.

Our stack can now build larger fragments, so we need to split them to the 16kbytes boundary.

---
 drivers/net/vmxnet3/vmxnet3_drv.c |   65 +++++++++++++++++++---------
 1 file changed, 45 insertions(+), 20 deletions(-)
drivers/net/vmxnet3/vmxnet3_drv.c +45 -20
index ce9d4f2..0ae1bcc 100644
@@ -744,28 +744,43 @@ vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx,
 
 	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
 		const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
+		u32 buf_size;
 
-		tbi = tq->buf_info + tq->tx_ring.next2fill;
-		tbi->map_type = VMXNET3_MAP_PAGE;
-		tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag,
-						 0, skb_frag_size(frag),
-						 DMA_TO_DEVICE);
+		buf_offset = 0;
+		len = skb_frag_size(frag);
+		while (len) {
+			tbi = tq->buf_info + tq->tx_ring.next2fill;
+			if (len < VMXNET3_MAX_TX_BUF_SIZE) {
+				buf_size = len;
+				dw2 |= len;
+			} else {
+				buf_size = VMXNET3_MAX_TX_BUF_SIZE;
+				/* spec says that for TxDesc.len, 0 == 2^14 */
+			}
+			tbi->map_type = VMXNET3_MAP_PAGE;
+			tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag,
+							 buf_offset, buf_size,
+							 DMA_TO_DEVICE);
 
-		tbi->len = skb_frag_size(frag);
+			tbi->len = buf_size;
 
-		gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
-		BUG_ON(gdesc->txd.gen == tq->tx_ring.gen);
+			gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
+			BUG_ON(gdesc->txd.gen == tq->tx_ring.gen);
 
-		gdesc->txd.addr = cpu_to_le64(tbi->dma_addr);
-		gdesc->dword[2] = cpu_to_le32(dw2 | skb_frag_size(frag));
-		gdesc->dword[3] = 0;
+			gdesc->txd.addr = cpu_to_le64(tbi->dma_addr);
+			gdesc->dword[2] = cpu_to_le32(dw2);
+			gdesc->dword[3] = 0;
 
-		dev_dbg(&adapter->netdev->dev,
-			"txd[%u]: 0x%llu %u %u\n",
-			tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr),
-			le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]);
-		vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
-		dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT;
+			dev_dbg(&adapter->netdev->dev,
+				"txd[%u]: 0x%llu %u %u\n",
+				tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr),
+				le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]);
+			vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
+			dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT;
+
+			len -= buf_size;
+			buf_offset += buf_size;
+		}
 	}
 
 	ctx->eop_txd = gdesc;
@@ -886,6 +901,18 @@ vmxnet3_prepare_tso(struct sk_buff *skb,
 	}
 }
 
+static int txd_estimate(const struct sk_buff *skb)
+{
+	int count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) + 1;
+	int i;
+
+	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
+		const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
+
+		count += VMXNET3_TXD_NEEDED(skb_frag_size(frag));
+	}
+	return count;
+}
 
 /*
  * Transmits a pkt thru a given tq
@@ -914,9 +941,7 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
 	union Vmxnet3_GenericDesc tempTxDesc;
 #endif
 
-	/* conservatively estimate # of descriptors to use */
-	count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) +
-		skb_shinfo(skb)->nr_frags + 1;
+	count = txd_estimate(skb);
 
 	ctx.ipv4 = (vlan_get_protocol(skb) == cpu_to_be16(ETH_P_IP));
 
Reviewed-by on v1 1/1
#7 lore raw

Re: [Pv-drivers] [PATCH] vmxnet3: must split too big fragments

LGTM. Thanks for doing this! Did you do any performance testing with this patch?

--
Bhavesh Davda

----- Original Message -----

Quoted 129 lines

From: "Eric Dumazet" <[email protected]>
To: "Shreyas Bhatewara" <[email protected]>, "David Miller" <[email protected]>
Cc: "VMware, Inc." <[email protected]>, [email protected], [email protected], "jongman heo" <[email protected]>
Sent: Monday, October 29, 2012 10:30:49 AM
Subject: [Pv-drivers] [PATCH] vmxnet3: must split too big fragments

From: Eric Dumazet <[email protected]>

vmxnet3 has a 16Kbytes limit per tx descriptor, that happened to work as long as we provided PAGE_SIZE fragments.

Our stack can now build larger fragments, so we need to split them to the 16kbytes boundary.

---
 drivers/net/vmxnet3/vmxnet3_drv.c |   65
 +++++++++++++++++++---------
 1 file changed, 45 insertions(+), 20 deletions(-)
drivers/net/vmxnet3/vmxnet3_drv.c +32 -17
index ce9d4f2..0ae1bcc 100644
@@ -744,28 +744,43 @@ vmxnet3_map_pkt(struct sk_buff *skb, struct
 vmxnet3_tx_ctx *ctx,
 
 	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
 		const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
+		u32 buf_size;
 
-		tbi = tq->buf_info + tq->tx_ring.next2fill;
-		tbi->map_type = VMXNET3_MAP_PAGE;
-		tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag,
-						 0, skb_frag_size(frag),
-						 DMA_TO_DEVICE);
+		buf_offset = 0;
+		len = skb_frag_size(frag);
+		while (len) {
+			tbi = tq->buf_info + tq->tx_ring.next2fill;
+			if (len < VMXNET3_MAX_TX_BUF_SIZE) {
+				buf_size = len;
+				dw2 |= len;
+			} else {
+				buf_size = VMXNET3_MAX_TX_BUF_SIZE;
+				/* spec says that for TxDesc.len, 0 == 2^14 */
+			}
+			tbi->map_type = VMXNET3_MAP_PAGE;
+			tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag,
+							 buf_offset, buf_size,
+							 DMA_TO_DEVICE);
 
-		tbi->len = skb_frag_size(frag);
+			tbi->len = buf_size;
 
-		gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
-		BUG_ON(gdesc->txd.gen == tq->tx_ring.gen);
+			gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
+			BUG_ON(gdesc->txd.gen == tq->tx_ring.gen);
 
-		gdesc->txd.addr = cpu_to_le64(tbi->dma_addr);
-		gdesc->dword[2] = cpu_to_le32(dw2 | skb_frag_size(frag));
-		gdesc->dword[3] = 0;
+			gdesc->txd.addr = cpu_to_le64(tbi->dma_addr);
+			gdesc->dword[2] = cpu_to_le32(dw2);
+			gdesc->dword[3] = 0;
 
-		dev_dbg(&adapter->netdev->dev,
-			"txd[%u]: 0x%llu %u %u\n",
-			tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr),
-			le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]);
-		vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
-		dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT;
+			dev_dbg(&adapter->netdev->dev,
+				"txd[%u]: 0x%llu %u %u\n",
+				tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr),
+				le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]);
+			vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
+			dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT;
+
+			len -= buf_size;
+			buf_offset += buf_size;
+		}
 	}
 
drivers/net/vmxnet3/vmxnet3_drv.c +13 -3
 	ctx->eop_txd = gdesc;
@@ -886,6 +901,18 @@ vmxnet3_prepare_tso(struct sk_buff *skb,
 	}
 }
 
+static int txd_estimate(const struct sk_buff *skb)
+{
+	int count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) + 1;
+	int i;
+
+	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
+		const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
+
+		count += VMXNET3_TXD_NEEDED(skb_frag_size(frag));
+	}
+	return count;
+}
 
 /*
  * Transmits a pkt thru a given tq
@@ -914,9 +941,7 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct
 vmxnet3_tx_queue *tq,
 	union Vmxnet3_GenericDesc tempTxDesc;
 #endif
 
-	/* conservatively estimate # of descriptors to use */
-	count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) +
-		skb_shinfo(skb)->nr_frags + 1;
+	count = txd_estimate(skb);
 
 	ctx.ipv4 = (vlan_get_protocol(skb) == cpu_to_be16(ETH_P_IP));

_______________________________________________
Pv-drivers mailing list
[email protected]
http://mailman2.vmware.com/mailman/listinfo/pv-drivers

#8 lore raw

Re: [Pv-drivers] [PATCH] vmxnet3: must split too big fragments

Quoted 3 lines · Bhavesh Davda

LGTM. Thanks for doing this! Did you do any performance testing with this patch?

Just to be clear : I coded the patch and compiled it, but didnt test it.

Jongman did the tests ;)

Thanks !

#9 lore raw

Re: [PATCH] vmxnet3: must split too big fragments

In reply to Eric Dumazet

----- Original Message -----

Quoted 8 lines

From: Eric Dumazet <[email protected]>

vmxnet3 has a 16Kbytes limit per tx descriptor, that happened to work as long as we provided PAGE_SIZE fragments.

Our stack can now build larger fragments, so we need to split them to the 16kbytes boundary.

Quoted 9 lines
---
 drivers/net/vmxnet3/vmxnet3_drv.c |   65
 +++++++++++++++++++---------
 1 file changed, 45 insertions(+), 20 deletions(-)

Thanks for the patch Eric.

maintainer Applied
#11 lore raw

Re: [PATCH] vmxnet3: must split too big fragments

In reply to Eric Dumazet

From: Eric Dumazet <[email protected]>
Date: Mon, 29 Oct 2012 18:30:49 +0100

Quoted 5 lines

From: Eric Dumazet <[email protected]>

vmxnet3 has a 16Kbytes limit per tx descriptor, that happened to work as long as we provided PAGE_SIZE fragments.

Quoted 7 lines

Our stack can now build larger fragments, so we need to split them to the 16kbytes boundary.

Applied, thanks everyone.