tcp: rename tcp_skb_cb flags

Rename struct tcp_skb_cb "flags" to "tcp_flags" to ease code review and
maintenance.

Its content is a combination of FIN/SYN/RST/PSH/ACK/URG/ECE/CWR flags

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tcp: unalias tcp_skb_cb flags and ip_dsfield

struct tcp_skb_cb contains a "flags" field containing either tcp flags
or IP dsfield depending on context (input or output path)

Introduce ip_dsfield to make the difference clear and ease maintenance.
If later we want to save space, we can union flags/ip_dsfield

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Conflicts:
	net/ipv4/tcp_input.c
tcp: ECN blackhole should not force quickack mode

While playing with a new ADSL box at home, I discovered that ECN
blackhole can trigger suboptimal quickack mode on linux : We send one
ACK for each incoming data frame, without any delay and eventual
piggyback.

This is because TCP_ECN_check_ce() considers that if no ECT is seen on a
segment, this is because this segment was a retransmit.

Refine this heuristic and apply it only if we seen ECT in a previous
segment, to detect ECN blackhole at IP level.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Jamal Hadi Salim <jhs@mojatatu.com>
CC: Jerry Chu <hkchu@google.com>
CC: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
CC: Jim Gettys <jg@freedesktop.org>
CC: Dave Taht <dave.taht@gmail.com>
Acked-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>

Conflicts:
	net/ipv4/tcp_input.c
tcp: report ECN_SEEN in tcp_info

Allows ss command (iproute2) to display "ecnseen" if at least one packet
with ECT(0) or ECT(1) or ECN was received by this socket.

"ecn" means ECN was negotiated at session establishment (TCP level)

"ecnseen" means we received at least one packet with ECT fields set (IP
level)

ss -i
...
ESTAB      0      0   192.168.20.110:22  192.168.20.144:38016
ino:5950 sk:f178e400
	 mem:(r0,w0,f0,t0) ts sack ecn ecnseen bic wscale:7,8 rto:210
rtt:12.5/7.5 cwnd:10 send 9.3Mbps rcv_space:14480

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tcp: properly handle md5sig_pool references

tcp_v4_clear_md5_list() assumes that multiple tcp md5sig peers
only hold one reference to md5sig_pool. but tcp_v4_md5_do_add()
increases use count of md5sig_pool for each peer. This patch
makes tcp_v4_md5_do_add() only increases use count for the first
tcp md5sig peer.

Signed-off-by: Zheng Yan <zheng.z.yan@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tcp: properly update lost_cnt_hint during shifting

lost_skb_hint is used by tcp_mark_head_lost() to mark the first unhandled skb.
lost_cnt_hint is the number of packets or sacked packets before the lost_skb_hint;
When shifting a skb that is before the lost_skb_hint, if tcp_is_fack() is ture,
the skb has already been counted in the lost_cnt_hint; if tcp_is_fack() is false,
tcp_sacktag_one() will increase the lost_cnt_hint. So tcp_shifted_skb() does not
need to adjust the lost_cnt_hint by itself. When shifting a skb that is equal to
lost_skb_hint, the shifted packets will not be counted by tcp_mark_head_lost().
So tcp_shifted_skb() should adjust the lost_cnt_hint even tcp_is_fack(tp) is true.

Signed-off-by: Zheng Yan <zheng.z.yan@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Conflicts:
	net/ipv4/tcp_input.c
net: more accurate skb truesize

skb truesize currently accounts for sk_buff struct and part of skb head.
kmalloc() roundings are also ignored.

Considering that skb_shared_info is larger than sk_buff, its time to
take it into account for better memory accounting.

This patch introduces SKB_TRUESIZE(X) macro to centralize various
assumptions into a single place.

At skb alloc phase, we put skb_shared_info struct at the exact end of
skb head, to allow a better use of memory (lowering number of
reallocations), since kmalloc() gives us power-of-two memory blocks.

Unless SLUB/SLUB debug is active, both skb->head and skb_shared_info are
aligned to cache lines, as before.

Note: This patch might trigger performance regressions because of
misconfigured protocol stacks, hitting per socket or global memory
limits that were previously not reached. But its a necessary step for a
more accurate memory accounting.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Andi Kleen <ak@linux.intel.com>
CC: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net: add skb frag size accessors

To ease skb->truesize sanitization, its better to be able to localize
all references to skb frags size.

Define accessors : skb_frag_size() to fetch frag size, and
skb_frag_size_{set|add|sub}() to manipulate it.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Conflicts:
	drivers/atm/eni.c
	drivers/infiniband/hw/amso1100/c2.c
	drivers/infiniband/hw/nes/nes_nic.c
	drivers/infiniband/ulp/ipoib/ipoib_ib.c
	drivers/net/3c59x.c
	drivers/net/acenic.c
	drivers/net/atl1c/atl1c_main.c
	drivers/net/benet/be_main.c
	drivers/net/bna/bnad.c
	drivers/net/bnx2.c
	drivers/net/bnx2x/bnx2x_cmn.c
	drivers/net/cassini.c
	drivers/net/chelsio/sge.c
	drivers/net/cxgb3/sge.c
	drivers/net/e1000/e1000_main.c
	drivers/net/e1000e/netdev.c
	drivers/net/ehea/ehea_main.c
	drivers/net/enic/enic_main.c
	drivers/net/greth.c
	drivers/net/ibmveth.c
	drivers/net/igb/igb_main.c
	drivers/net/ixgb/ixgb_main.c
	drivers/net/ixgbe/ixgbe_main.c
	drivers/net/ixgbevf/ixgbevf_main.c
	drivers/net/jme.c
	drivers/net/ll_temac_main.c
	drivers/net/mv643xx_eth.c
	drivers/net/myri10ge/myri10ge.c
	drivers/net/netxen/netxen_nic_main.c
	drivers/net/niu.c
	drivers/net/ns83820.c
	drivers/net/pasemi_mac.c
	drivers/net/qla3xxx.c
	drivers/net/qlcnic/qlcnic_main.c
	drivers/net/qlge/qlge_main.c
	drivers/net/r8169.c
	drivers/net/s2io.c
	drivers/net/sfc/tx.c
	drivers/net/skge.c
	drivers/net/sky2.c
	drivers/net/starfire.c
	drivers/net/sungem.c
	drivers/net/sunhme.c
	drivers/net/tehuti.c
	drivers/net/tg3.c
	drivers/net/tsi108_eth.c
	drivers/net/typhoon.c
	drivers/net/via-velocity.c
	drivers/net/vmxnet3/vmxnet3_drv.c
	drivers/net/vxge/vxge-main.c
	drivers/net/xen-netback/netback.c
	net/ipv6/ip6_output.c
	net/xfrm/xfrm_ipcomp.c