Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 108825
b: refs/heads/master
c: 88b9e2b
h: refs/heads/master
i:
  108823: 64f10ca
v: v3
  • Loading branch information
Adrian Bunk authored and John W. Linville committed Aug 18, 2008
1 parent a915ef9 commit dddf271
Show file tree
Hide file tree
Showing 20 changed files with 196 additions and 281 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: d28934ad8a4e87203a95de9c376611de8bc2f013
refs/heads/master: 88b9e2bef3e38c053ec8f054f2cbb9345724cdb1
2 changes: 1 addition & 1 deletion trunk/drivers/net/bnx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
#include <linux/time.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/if_vlan.h>
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
#include <linux/if_vlan.h>
#define BCM_VLAN 1
#endif
#include <net/ip.h>
Expand Down
67 changes: 67 additions & 0 deletions trunk/drivers/net/loopback.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,68 @@ struct pcpu_lstats {
unsigned long bytes;
};

/* KISS: just allocate small chunks and copy bits.
*
* So, in fact, this is documentation, explaining what we expect
* of largesending device modulo TCP checksum, which is ignored for loopback.
*/

#ifdef LOOPBACK_TSO
static void emulate_large_send_offload(struct sk_buff *skb)
{
struct iphdr *iph = ip_hdr(skb);
struct tcphdr *th = (struct tcphdr *)(skb_network_header(skb) +
(iph->ihl * 4));
unsigned int doffset = (iph->ihl + th->doff) * 4;
unsigned int mtu = skb_shinfo(skb)->gso_size + doffset;
unsigned int offset = 0;
u32 seq = ntohl(th->seq);
u16 id = ntohs(iph->id);

while (offset + doffset < skb->len) {
unsigned int frag_size = min(mtu, skb->len - offset) - doffset;
struct sk_buff *nskb = alloc_skb(mtu + 32, GFP_ATOMIC);

if (!nskb)
break;
skb_reserve(nskb, 32);
skb_set_mac_header(nskb, -ETH_HLEN);
skb_reset_network_header(nskb);
iph = ip_hdr(nskb);
skb_copy_to_linear_data(nskb, skb_network_header(skb),
doffset);
if (skb_copy_bits(skb,
doffset + offset,
nskb->data + doffset,
frag_size))
BUG();
skb_put(nskb, doffset + frag_size);
nskb->ip_summed = CHECKSUM_UNNECESSARY;
nskb->dev = skb->dev;
nskb->priority = skb->priority;
nskb->protocol = skb->protocol;
nskb->dst = dst_clone(skb->dst);
memcpy(nskb->cb, skb->cb, sizeof(skb->cb));
nskb->pkt_type = skb->pkt_type;

th = (struct tcphdr *)(skb_network_header(nskb) + iph->ihl * 4);
iph->tot_len = htons(frag_size + doffset);
iph->id = htons(id);
iph->check = 0;
iph->check = ip_fast_csum((unsigned char *) iph, iph->ihl);
th->seq = htonl(seq);
if (offset + doffset + frag_size < skb->len)
th->fin = th->psh = 0;
netif_rx(nskb);
offset += frag_size;
seq += frag_size;
id++;
}

dev_kfree_skb(skb);
}
#endif /* LOOPBACK_TSO */

/*
* The higher levels take care of making this non-reentrant (it's
* called with bh's disabled).
Expand All @@ -75,6 +137,9 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
skb_orphan(skb);

skb->protocol = eth_type_trans(skb,dev);
#ifndef LOOPBACK_MUST_CHECKSUM
skb->ip_summed = CHECKSUM_UNNECESSARY;
#endif

#ifdef LOOPBACK_TSO
if (skb_is_gso(skb)) {
Expand Down Expand Up @@ -169,7 +234,9 @@ static void loopback_setup(struct net_device *dev)
dev->type = ARPHRD_LOOPBACK; /* 0x0001*/
dev->flags = IFF_LOOPBACK;
dev->features = NETIF_F_SG | NETIF_F_FRAGLIST
#ifdef LOOPBACK_TSO
| NETIF_F_TSO
#endif
| NETIF_F_NO_CSUM
| NETIF_F_HIGHDMA
| NETIF_F_LLTX
Expand Down
105 changes: 4 additions & 101 deletions trunk/drivers/net/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,66 +358,6 @@ static unsigned int tun_chr_poll(struct file *file, poll_table * wait)
return mask;
}

/* prepad is the amount to reserve at front. len is length after that.
* linear is a hint as to how much to copy (usually headers). */
static struct sk_buff *tun_alloc_skb(size_t prepad, size_t len, size_t linear,
gfp_t gfp)
{
struct sk_buff *skb;
unsigned int i;

skb = alloc_skb(prepad + len, gfp|__GFP_NOWARN);
if (skb) {
skb_reserve(skb, prepad);
skb_put(skb, len);
return skb;
}

/* Under a page? Don't bother with paged skb. */
if (prepad + len < PAGE_SIZE)
return NULL;

/* Start with a normal skb, and add pages. */
skb = alloc_skb(prepad + linear, gfp);
if (!skb)
return NULL;

skb_reserve(skb, prepad);
skb_put(skb, linear);

len -= linear;

for (i = 0; i < MAX_SKB_FRAGS; i++) {
skb_frag_t *f = &skb_shinfo(skb)->frags[i];

f->page = alloc_page(gfp|__GFP_ZERO);
if (!f->page)
break;

f->page_offset = 0;
f->size = PAGE_SIZE;

skb->data_len += PAGE_SIZE;
skb->len += PAGE_SIZE;
skb->truesize += PAGE_SIZE;
skb_shinfo(skb)->nr_frags++;

if (len < PAGE_SIZE) {
len = 0;
break;
}
len -= PAGE_SIZE;
}

/* Too large, or alloc fail? */
if (unlikely(len)) {
kfree_skb(skb);
skb = NULL;
}

return skb;
}

/* Get packet from user space buffer */
static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv, size_t count)
{
Expand Down Expand Up @@ -451,12 +391,14 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv,
return -EINVAL;
}

if (!(skb = tun_alloc_skb(align, len, gso.hdr_len, GFP_KERNEL))) {
if (!(skb = alloc_skb(len + align, GFP_KERNEL))) {
tun->dev->stats.rx_dropped++;
return -ENOMEM;
}

if (skb_copy_datagram_from_iovec(skb, 0, iv, len)) {
if (align)
skb_reserve(skb, align);
if (memcpy_fromiovec(skb_put(skb, len), iv, len)) {
tun->dev->stats.rx_dropped++;
kfree_skb(skb);
return -EFAULT;
Expand Down Expand Up @@ -806,36 +748,6 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
return err;
}

static int tun_get_iff(struct net *net, struct file *file, struct ifreq *ifr)
{
struct tun_struct *tun = file->private_data;

if (!tun)
return -EBADFD;

DBG(KERN_INFO "%s: tun_get_iff\n", tun->dev->name);

strcpy(ifr->ifr_name, tun->dev->name);

ifr->ifr_flags = 0;

if (ifr->ifr_flags & TUN_TUN_DEV)
ifr->ifr_flags |= IFF_TUN;
else
ifr->ifr_flags |= IFF_TAP;

if (tun->flags & TUN_NO_PI)
ifr->ifr_flags |= IFF_NO_PI;

if (tun->flags & TUN_ONE_QUEUE)
ifr->ifr_flags |= IFF_ONE_QUEUE;

if (tun->flags & TUN_VNET_HDR)
ifr->ifr_flags |= IFF_VNET_HDR;

return 0;
}

/* This is like a cut-down ethtool ops, except done via tun fd so no
* privs required. */
static int set_offload(struct net_device *dev, unsigned long arg)
Expand Down Expand Up @@ -921,15 +833,6 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
DBG(KERN_INFO "%s: tun_chr_ioctl cmd %d\n", tun->dev->name, cmd);

switch (cmd) {
case TUNGETIFF:
ret = tun_get_iff(current->nsproxy->net_ns, file, &ifr);
if (ret)
return ret;

if (copy_to_user(argp, &ifr, sizeof(ifr)))
return -EFAULT;
break;

case TUNSETNOCSUM:
/* Disable/Enable checksum */
if (arg)
Expand Down
6 changes: 5 additions & 1 deletion trunk/drivers/net/wireless/ath9k/hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -5017,7 +5017,11 @@ static void ath9k_hw_spur_mitigate(struct ath_hal *ah,

for (i = 0; i < 123; i++) {
if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) {
if ((abs(cur_vit_mask - bin)) < 75)

/* workaround for gcc bug #37014 */
volatile int tmp = abs(cur_vit_mask - bin);

if (tmp < 75)
mask_amt = 1;
else
mask_amt = 0;
Expand Down
1 change: 0 additions & 1 deletion trunk/include/linux/if_tun.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#define TUNGETFEATURES _IOR('T', 207, unsigned int)
#define TUNSETOFFLOAD _IOW('T', 208, unsigned int)
#define TUNSETTXFILTER _IOW('T', 209, unsigned int)
#define TUNGETIFF _IOR('T', 210, unsigned int)

/* TUNSETIFF ifr flags */
#define IFF_TUN 0x0001
Expand Down
4 changes: 0 additions & 4 deletions trunk/include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -1452,10 +1452,6 @@ extern int skb_copy_datagram_iovec(const struct sk_buff *from,
extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
int hlen,
struct iovec *iov);
extern int skb_copy_datagram_from_iovec(struct sk_buff *skb,
int offset,
struct iovec *from,
int len);
extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
unsigned int flags);
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/net/sch_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ enum qdisc_state_t
{
__QDISC_STATE_RUNNING,
__QDISC_STATE_SCHED,
__QDISC_STATE_DEACTIVATED,
};

struct qdisc_size_table {
Expand Down Expand Up @@ -61,6 +60,7 @@ struct Qdisc
struct gnet_stats_basic bstats;
struct gnet_stats_queue qstats;
struct gnet_stats_rate_est rate_est;
struct rcu_head q_rcu;
int (*reshape_fail)(struct sk_buff *skb,
struct Qdisc *q);

Expand Down
15 changes: 5 additions & 10 deletions trunk/net/bridge/br_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,11 @@ static int br_set_tx_csum(struct net_device *dev, u32 data)
}

static struct ethtool_ops br_ethtool_ops = {
.get_drvinfo = br_getinfo,
.get_link = ethtool_op_get_link,
.get_tx_csum = ethtool_op_get_tx_csum,
.set_tx_csum = br_set_tx_csum,
.get_sg = ethtool_op_get_sg,
.set_sg = br_set_sg,
.get_tso = ethtool_op_get_tso,
.set_tso = br_set_tso,
.get_ufo = ethtool_op_get_ufo,
.get_flags = ethtool_op_get_flags,
.get_drvinfo = br_getinfo,
.get_link = ethtool_op_get_link,
.set_sg = br_set_sg,
.set_tx_csum = br_set_tx_csum,
.set_tso = br_set_tso,
};

void br_dev_setup(struct net_device *dev)
Expand Down
Loading

0 comments on commit dddf271

Please sign in to comment.