aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_ipv4.c
Commit message (Expand)AuthorAge
...
* ipv4: Use inet_csk_route_child_sock() in DCCP and TCP.David S. Miller2011-05-08
* tcp: Use cork flow in tcp_v4_connect()David S. Miller2011-05-08
* ipv4: Get route daddr from flow key in tcp_v4_connect().David S. Miller2011-04-29
* ipv4: Fetch route saddr from flow key in tcp_v4_connect().David S. Miller2011-04-29
* inet: add RCU protection to inet->optEric Dumazet2011-04-28
* ipv4: Sanitize and simplify ip_route_{connect,newports}()David S. Miller2011-04-27
* inet: constify ip headers and in6_addrEric Dumazet2011-04-22
* ipv4: Make output route lookup return rtable directly.David S. Miller2011-03-02
* ipv4: Can final ip_route_connect() arg to boolean "can_sleep".David S. Miller2011-03-01
* ipv4: Rearrange how ip_route_newports() gets port keys.David S. Miller2011-02-24
* tcp: Remove debug macro of TCP_CHECK_TIMERShan Wei2011-02-20
* inetpeer: Abstract address representation further.David S. Miller2011-02-10
* tcp: fix bug in listening_get_next()Eric Dumazet2011-01-24
* Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/ne...David S. Miller2010-12-27
|\
| * tcp: fix listening_get_next()Eric Dumazet2010-12-23
* | net: Abstract default ADVMSS behind an accessor.David S. Miller2010-12-13
* | Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/ne...David S. Miller2010-12-08
|\|
| * netns: Don't leak others' openreq-s in procPavel Emelyanov2010-11-28
* | timewait_sock: Create and use getpeer op.David S. Miller2010-12-01
* | inet: Turn ->remember_stamp into ->get_peer in connection AF ops.David S. Miller2010-11-30
* | inetpeer: Make inet_getpeer() take an inet_peer_adress_t pointer.David S. Miller2010-11-30
* | inetpeer: Introduce inet_peer_address_t.David S. Miller2010-11-30
|/
* tcp: Don't change unlocked socket state in tcp_v4_err().David S. Miller2010-11-12
* tproxy: fix hash locking issue when using port redirection in __inet_inherit_...Balazs Scheidler2010-10-21
* gro: unexport tcp4_gro_receive and tcp4_gro_completeEric Dumazet2010-08-31
* inet, inet6: make tcp_sendmsg() and tcp_sendpage() through inet_sendmsg() and...Changli Gao2010-07-12
* net/ipv4: EXPORT_SYMBOL cleanupsEric Dumazet2010-07-12
* syncookies: add support for ECNFlorian Westphal2010-06-27
* inetpeer: restore small inet_peer structuresEric Dumazet2010-06-16
* net-next: remove useless union keywordChangli Gao2010-06-11
* tcp: Fix slowness in read /proc/net/tcpTom Herbert2010-06-07
* Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/ne...David S. Miller2010-06-06
|\
| * rps: tcp: fix rps_sock_flow_table table updatesEric Dumazet2010-06-04
* | syncookies: avoid unneeded tcp header flag double checkFlorian Westphal2010-06-05
* | syncookies: make v4/v6 synflood warning behaviour the sameFlorian Westphal2010-06-05
|/
* net: Introduce sk_route_nocapsEric Dumazet2010-05-16
* net: Make RFS socket operations not be inet specific.David S. Miller2010-04-27
* net: Fix various endianness glitchesEric Dumazet2010-04-20
* rfs: Receive Flow SteeringTom Herbert2010-04-16
* inet: Remove unused send_check length argumentHerbert Xu2010-04-11
* tcp: Handle CHECKSUM_PARTIAL for SYNACK packets for IPv4Herbert Xu2010-04-11
* include cleanup: Update gfp.h and slab.h includes to prepare for breaking imp...Tejun Heo2010-03-30
* TCP: check min TTL on received ICMP packetsstephen hemminger2010-03-20
* tcp: Fix tcp_v4_rcv()Eric Dumazet2010-03-10
* tcp: Add SNMP counters for backlog and min_ttl dropsEric Dumazet2010-03-08
* net: backlog functions renameZhu Yi2010-03-05
* tcp: use limited socket backlogZhu Yi2010-03-05
* net: spread __net_init, __net_exitAlexey Dobriyan2010-01-17
* tcp: account SYN-ACK timeouts & retransmissionsOctavian Purdila2010-01-17
* tcp: Generalized TTL Security MechanismStephen Hemminger2010-01-11
                       
 



                                                         













                                                                          

                                     






                                                                   
                                                                      









                                                                            
                        
 


                                                             







                                                                      

                                                                                    






                                           
                            





                                                                  


                                                        
 
                                                




                                                                                

                                                                         






                                                   
                                    









                                         
                       
 
/*
 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
 * Portions based on net/core/datagram.c and copyrighted by their authors.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59
 * Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * The full GNU General Public License is included in this distribution in the
 * file called COPYING.
 */

/*
 * This code allows the net stack to make use of a DMA engine for
 * skb to iovec copies.
 */

#include <linux/dmaengine.h>
#include <linux/socket.h>
#include <linux/rtnetlink.h> /* for BUG_TRAP */
#include <net/tcp.h>
#include <net/netdma.h>

#define NET_DMA_DEFAULT_COPYBREAK 4096

int sysctl_tcp_dma_copybreak = NET_DMA_DEFAULT_COPYBREAK;

/**
 *	dma_skb_copy_datagram_iovec - Copy a datagram to an iovec.
 *	@skb - buffer to copy
 *	@offset - offset in the buffer to start copying from
 *	@iovec - io vector to copy to
 *	@len - amount of data to copy from buffer to iovec
 *	@pinned_list - locked iovec buffer data
 *
 *	Note: the iovec is modified during the copy.
 */
int dma_skb_copy_datagram_iovec(struct dma_chan *chan,
			struct sk_buff *skb, int offset, struct iovec *to,
			size_t len, struct dma_pinned_list *pinned_list)
{
	int start = skb_headlen(skb);
	int i, copy = start - offset;
	dma_cookie_t cookie = 0;

	/* Copy header. */
	if (copy > 0) {
		if (copy > len)
			copy = len;
		cookie = dma_memcpy_to_iovec(chan, to, pinned_list,
					    skb->data + offset, copy);
		if (cookie < 0)
			goto fault;
		len -= copy;
		if (len == 0)
			goto end;
		offset += copy;
	}

	/* Copy paged appendix. Hmm... why does this look so complicated? */
	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
		int end;

		BUG_TRAP(start <= offset + len);

		end = start + skb_shinfo(skb)->frags[i].size;
		copy = end - offset;
		if ((copy = end - offset) > 0) {
			skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
			struct page *page = frag->page;

			if (copy > len)
				copy = len;

			cookie = dma_memcpy_pg_to_iovec(chan, to, pinned_list, page,
					frag->page_offset + offset - start, copy);
			if (cookie < 0)
				goto fault;
			len -= copy;
			if (len == 0)
				goto end;
			offset += copy;
		}
		start = end;
	}

	if (skb_shinfo(skb)->frag_list) {
		struct sk_buff *list = skb_shinfo(skb)->frag_list;

		for (; list; list = list->next) {
			int end;

			BUG_TRAP(start <= offset + len);

			end = start + list->len;
			copy = end - offset;
			if (copy > 0) {
				if (copy > len)
					copy = len;
				cookie = dma_skb_copy_datagram_iovec(chan, list,
						offset - start, to, copy,
						pinned_list);
				if (cookie < 0)
					goto fault;
				len -= copy;
				if (len == 0)
					goto end;
				offset += copy;
			}
			start = end;
		}
	}

end:
	if (!len) {
		skb->dma_cookie = cookie;
		return cookie;
	}

fault:
	return -EFAULT;
}