Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 237512
b: refs/heads/master
c: 903ab86
h: refs/heads/master
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed Mar 1, 2011
1 parent 689e2ae commit 8f9e343
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f6b9664f8b711cf4fd53e70aa0d21f72d5bf806c
refs/heads/master: 903ab86d195cca295379699299c5fc10beba31c7
15 changes: 14 additions & 1 deletion trunk/net/ipv4/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
int err, is_udplite = IS_UDPLITE(sk);
int corkreq = up->corkflag || msg->msg_flags&MSG_MORE;
int (*getfrag)(void *, char *, int, int, int, struct sk_buff *);
struct sk_buff *skb;

if (len > 0xFFFF)
return -EMSGSIZE;
Expand All @@ -816,6 +817,8 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
ipc.opt = NULL;
ipc.tx_flags = 0;

getfrag = is_udplite ? udplite_getfrag : ip_generic_getfrag;

if (up->pending) {
/*
* There are pending frames.
Expand Down Expand Up @@ -940,6 +943,17 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
if (!ipc.addr)
daddr = ipc.addr = rt->rt_dst;

/* Lockless fast path for the non-corking case. */
if (!corkreq) {
skb = ip_make_skb(sk, getfrag, msg->msg_iov, ulen,
sizeof(struct udphdr), &ipc, &rt,
msg->msg_flags);
err = PTR_ERR(skb);
if (skb && !IS_ERR(skb))
err = udp_send_skb(skb, daddr, dport);
goto out;
}

lock_sock(sk);
if (unlikely(up->pending)) {
/* The socket is already corked while preparing it. */
Expand All @@ -961,7 +975,6 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,

do_append_data:
up->len += ulen;
getfrag = is_udplite ? udplite_getfrag : ip_generic_getfrag;
err = ip_append_data(sk, getfrag, msg->msg_iov, ulen,
sizeof(struct udphdr), &ipc, &rt,
corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags);
Expand Down

0 comments on commit 8f9e343

Please sign in to comment.