提交 15f7176e 编写于 作者: L Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
  wireless: remove duplicated .ndo_set_mac_address
  netfilter: xtables: fix IPv6 dependency in the cluster match
  tg3: Add GRO support.
  niu: Add GRO support.
  ucc_geth: Fix use-after-of_node_put() in ucc_geth_probe().
  gianfar: Fix use-after-of_node_put() in gfar_of_init().
  kernel: remove HIPQUAD()
  netpoll: store local and remote ip in net-endian
  netfilter: fix endian bug in conntrack printks
  dmascc: fix incomplete conversion to network_device_ops
  gso: Fix support for linear packets
  skbuff.h: fix missing kernel-doc
  ni5010: convert to net_device_ops
......@@ -289,9 +289,9 @@ static int gfar_of_init(struct net_device *dev)
id = of_get_property(phy, "reg", NULL);
of_node_put(phy);
of_node_put(mdio);
fsl_pq_mdio_bus_name(bus_name, mdio);
of_node_put(mdio);
snprintf(priv->phy_bus_id, sizeof(priv->phy_bus_id), "%s:%02x",
bus_name, *id);
}
......
......@@ -445,6 +445,7 @@ static const struct net_device_ops scc_netdev_ops = {
.ndo_stop = scc_close,
.ndo_start_xmit = scc_send_packet,
.ndo_do_ioctl = scc_ioctl,
.ndo_set_mac_address = scc_set_mac_address,
};
static int __init setup_adapter(int card_base, int type, int n)
......@@ -584,7 +585,6 @@ static int __init setup_adapter(int card_base, int type, int n)
dev->irq = irq;
dev->netdev_ops = &scc_netdev_ops;
dev->header_ops = &ax25_header_ops;
dev->set_mac_address = scc_set_mac_address;
}
if (register_netdev(info->dev[0])) {
printk(KERN_ERR "dmascc: could not register %s\n",
......
......@@ -294,14 +294,12 @@ static ssize_t show_remote_port(struct netconsole_target *nt, char *buf)
static ssize_t show_local_ip(struct netconsole_target *nt, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%d.%d.%d.%d\n",
HIPQUAD(nt->np.local_ip));
return snprintf(buf, PAGE_SIZE, "%pI4\n", &nt->np.local_ip);
}
static ssize_t show_remote_ip(struct netconsole_target *nt, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%d.%d.%d.%d\n",
HIPQUAD(nt->np.remote_ip));
return snprintf(buf, PAGE_SIZE, "%pI4\n", &nt->np.remote_ip);
}
static ssize_t show_local_mac(struct netconsole_target *nt, char *buf)
......@@ -438,7 +436,7 @@ static ssize_t store_local_ip(struct netconsole_target *nt,
return -EINVAL;
}
nt->np.local_ip = ntohl(in_aton(buf));
nt->np.local_ip = in_aton(buf);
return strnlen(buf, count);
}
......@@ -454,7 +452,7 @@ static ssize_t store_remote_ip(struct netconsole_target *nt,
return -EINVAL;
}
nt->np.remote_ip = ntohl(in_aton(buf));
nt->np.remote_ip = in_aton(buf);
return strnlen(buf, count);
}
......
......@@ -189,6 +189,17 @@ static void __init trigger_irq(int ioaddr)
outb(MM_EN_XMT|MM_MUX, IE_MMODE); /* Start transmission */
}
static const struct net_device_ops ni5010_netdev_ops = {
.ndo_open = ni5010_open,
.ndo_stop = ni5010_close,
.ndo_start_xmit = ni5010_send_packet,
.ndo_set_multicast_list = ni5010_set_multicast_list,
.ndo_tx_timeout = ni5010_timeout,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
.ndo_change_mtu = eth_change_mtu,
};
/*
* This is the real probe routine. Linux has a history of friendly device
* probes on the ISA bus. A good device probes avoids doing writes, and
......@@ -328,13 +339,8 @@ static int __init ni5010_probe1(struct net_device *dev, int ioaddr)
outb(0, IE_RBUF); /* set buffer byte 0 to 0 again */
}
printk("-> bufsize rcv/xmt=%d/%d\n", bufsize_rcv, NI5010_BUFSIZE);
memset(netdev_priv(dev), 0, sizeof(struct ni5010_local));
dev->open = ni5010_open;
dev->stop = ni5010_close;
dev->hard_start_xmit = ni5010_send_packet;
dev->set_multicast_list = ni5010_set_multicast_list;
dev->tx_timeout = ni5010_timeout;
dev->netdev_ops = &ni5010_netdev_ops;
dev->watchdog_timeo = HZ/20;
dev->flags &= ~IFF_MULTICAST; /* Multicast doesn't work */
......
......@@ -3441,7 +3441,8 @@ static int niu_rx_pkt_ignore(struct niu *np, struct rx_ring_info *rp)
return num_rcr;
}
static int niu_process_rx_pkt(struct niu *np, struct rx_ring_info *rp)
static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
struct rx_ring_info *rp)
{
unsigned int index = rp->rcr_index;
struct sk_buff *skb;
......@@ -3518,7 +3519,7 @@ static int niu_process_rx_pkt(struct niu *np, struct rx_ring_info *rp)
skb->protocol = eth_type_trans(skb, np->dev);
skb_record_rx_queue(skb, rp->rx_channel);
netif_receive_skb(skb);
napi_gro_receive(napi, skb);
return num_rcr;
}
......@@ -3706,7 +3707,8 @@ static inline void niu_sync_rx_discard_stats(struct niu *np,
}
}
static int niu_rx_work(struct niu *np, struct rx_ring_info *rp, int budget)
static int niu_rx_work(struct napi_struct *napi, struct niu *np,
struct rx_ring_info *rp, int budget)
{
int qlen, rcr_done = 0, work_done = 0;
struct rxdma_mailbox *mbox = rp->mbox;
......@@ -3728,7 +3730,7 @@ static int niu_rx_work(struct niu *np, struct rx_ring_info *rp, int budget)
rcr_done = work_done = 0;
qlen = min(qlen, budget);
while (work_done < qlen) {
rcr_done += niu_process_rx_pkt(np, rp);
rcr_done += niu_process_rx_pkt(napi, np, rp);
work_done++;
}
......@@ -3776,7 +3778,7 @@ static int niu_poll_core(struct niu *np, struct niu_ldg *lp, int budget)
if (rx_vec & (1 << rp->rx_channel)) {
int this_work_done;
this_work_done = niu_rx_work(np, rp,
this_work_done = niu_rx_work(&lp->napi, np, rp,
budget);
budget -= this_work_done;
......
......@@ -4392,7 +4392,7 @@ static void tg3_recycle_rx(struct tg3 *tp, u32 opaque_key,
#if TG3_VLAN_TAG_USED
static int tg3_vlan_rx(struct tg3 *tp, struct sk_buff *skb, u16 vlan_tag)
{
return vlan_hwaccel_receive_skb(skb, tp->vlgrp, vlan_tag);
return vlan_gro_receive(&tp->napi, tp->vlgrp, vlan_tag, skb);
}
#endif
......@@ -4539,7 +4539,7 @@ static int tg3_rx(struct tg3 *tp, int budget)
desc->err_vlan & RXD_VLAN_MASK);
} else
#endif
netif_receive_skb(skb);
napi_gro_receive(&tp->napi, skb);
received++;
budget--;
......
......@@ -3648,15 +3648,16 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
mdio = of_get_parent(phy);
if (mdio == NULL)
return -1;
return -ENODEV;
err = of_address_to_resource(mdio, 0, &res);
of_node_put(mdio);
if (err)
return -1;
if (err) {
of_node_put(mdio);
return err;
}
fsl_pq_mdio_bus_name(bus_name, mdio);
of_node_put(mdio);
snprintf(ug_info->phy_bus_id, sizeof(ug_info->phy_bus_id),
"%s:%02x", bus_name, *prop);
}
......
......@@ -2752,7 +2752,6 @@ static const struct net_device_ops airo_netdev_ops = {
.ndo_set_mac_address = airo_set_mac_address,
.ndo_do_ioctl = airo_ioctl,
.ndo_change_mtu = airo_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
......@@ -2765,7 +2764,6 @@ static const struct net_device_ops mpi_netdev_ops = {
.ndo_set_mac_address = airo_set_mac_address,
.ndo_do_ioctl = airo_ioctl,
.ndo_change_mtu = airo_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
......
......@@ -11593,7 +11593,6 @@ static const struct net_device_ops ipw_netdev_ops = {
.ndo_set_mac_address = ipw_net_set_mac_address,
.ndo_start_xmit = ieee80211_xmit,
.ndo_change_mtu = ieee80211_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
......
......@@ -803,7 +803,6 @@ static const struct net_device_ops islpci_netdev_ops = {
.ndo_tx_timeout = islpci_eth_tx_timeout,
.ndo_set_mac_address = prism54_set_mac_address,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
......
......@@ -1725,7 +1725,6 @@ static const struct net_device_ops zd1201_netdev_ops = {
.ndo_set_multicast_list = zd1201_set_multicast,
.ndo_set_mac_address = zd1201_set_mac_address,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
......
......@@ -379,18 +379,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
((unsigned char *)&addr)[3]
#define NIPQUAD_FMT "%u.%u.%u.%u"
#if defined(__LITTLE_ENDIAN)
#define HIPQUAD(addr) \
((unsigned char *)&addr)[3], \
((unsigned char *)&addr)[2], \
((unsigned char *)&addr)[1], \
((unsigned char *)&addr)[0]
#elif defined(__BIG_ENDIAN)
#define HIPQUAD NIPQUAD
#else
#error "Please fix asm/byteorder.h"
#endif /* __LITTLE_ENDIAN */
/*
* min()/max()/clamp() macros that also do
* strict type-checking.. See the
......
......@@ -18,7 +18,7 @@ struct netpoll {
const char *name;
void (*rx_hook)(struct netpoll *, int, char *, int);
u32 local_ip, remote_ip;
__be32 local_ip, remote_ip;
u16 local_port, remote_port;
u8 remote_mac[ETH_ALEN];
};
......
......@@ -168,6 +168,7 @@ struct skb_shared_hwtstamps {
* @software: generate software time stamp
* @in_progress: device driver is going to provide
* hardware time stamp
* @flags: all shared_tx flags
*
* These flags are attached to packets as part of the
* &skb_shared_info. Use skb_tx() to get a pointer.
......
......@@ -345,8 +345,8 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
udph->dest = htons(np->remote_port);
udph->len = htons(udp_len);
udph->check = 0;
udph->check = csum_tcpudp_magic(htonl(np->local_ip),
htonl(np->remote_ip),
udph->check = csum_tcpudp_magic(np->local_ip,
np->remote_ip,
udp_len, IPPROTO_UDP,
csum_partial(udph, udp_len, 0));
if (udph->check == 0)
......@@ -365,8 +365,8 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
iph->ttl = 64;
iph->protocol = IPPROTO_UDP;
iph->check = 0;
put_unaligned(htonl(np->local_ip), &(iph->saddr));
put_unaligned(htonl(np->remote_ip), &(iph->daddr));
put_unaligned(np->local_ip, &(iph->saddr));
put_unaligned(np->remote_ip, &(iph->daddr));
iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
eth = (struct ethhdr *) skb_push(skb, ETH_HLEN);
......@@ -424,7 +424,7 @@ static void arp_reply(struct sk_buff *skb)
memcpy(&tip, arp_ptr, 4);
/* Should we ignore arp? */
if (tip != htonl(np->local_ip) ||
if (tip != np->local_ip ||
ipv4_is_loopback(tip) || ipv4_is_multicast(tip))
return;
......@@ -533,9 +533,9 @@ int __netpoll_rx(struct sk_buff *skb)
goto out;
if (checksum_udp(skb, uh, ulen, iph->saddr, iph->daddr))
goto out;
if (np->local_ip && np->local_ip != ntohl(iph->daddr))
if (np->local_ip && np->local_ip != iph->daddr)
goto out;
if (np->remote_ip && np->remote_ip != ntohl(iph->saddr))
if (np->remote_ip && np->remote_ip != iph->saddr)
goto out;
if (np->local_port && np->local_port != ntohs(uh->dest))
goto out;
......@@ -560,14 +560,14 @@ void netpoll_print_options(struct netpoll *np)
{
printk(KERN_INFO "%s: local port %d\n",
np->name, np->local_port);
printk(KERN_INFO "%s: local IP %d.%d.%d.%d\n",
np->name, HIPQUAD(np->local_ip));
printk(KERN_INFO "%s: local IP %pI4\n",
np->name, &np->local_ip);
printk(KERN_INFO "%s: interface %s\n",
np->name, np->dev_name);
printk(KERN_INFO "%s: remote port %d\n",
np->name, np->remote_port);
printk(KERN_INFO "%s: remote IP %d.%d.%d.%d\n",
np->name, HIPQUAD(np->remote_ip));
printk(KERN_INFO "%s: remote IP %pI4\n",
np->name, &np->remote_ip);
printk(KERN_INFO "%s: remote ethernet address %pM\n",
np->name, np->remote_mac);
}
......@@ -589,7 +589,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
if ((delim = strchr(cur, '/')) == NULL)
goto parse_failed;
*delim = 0;
np->local_ip = ntohl(in_aton(cur));
np->local_ip = in_aton(cur);
cur = delim;
}
cur++;
......@@ -618,7 +618,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
if ((delim = strchr(cur, '/')) == NULL)
goto parse_failed;
*delim = 0;
np->remote_ip = ntohl(in_aton(cur));
np->remote_ip = in_aton(cur);
cur = delim + 1;
if (*cur != 0) {
......@@ -759,10 +759,9 @@ int netpoll_setup(struct netpoll *np)
goto release;
}
np->local_ip = ntohl(in_dev->ifa_list->ifa_local);
np->local_ip = in_dev->ifa_list->ifa_local;
rcu_read_unlock();
printk(KERN_INFO "%s: local IP %d.%d.%d.%d\n",
np->name, HIPQUAD(np->local_ip));
printk(KERN_INFO "%s: local IP %pI4\n", np->name, &np->local_ip);
}
if (np->rx_hook) {
......
......@@ -2579,7 +2579,7 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int features)
skb_network_header_len(skb));
skb_copy_from_linear_data(skb, nskb->data, doffset);
if (pos >= offset + len)
if (fskb != skb_shinfo(skb)->frag_list)
continue;
if (!sg) {
......
......@@ -66,7 +66,7 @@ static const char *const dccprotos[] = {
* ad_beg_p returns pointer to first byte of addr data
* ad_end_p returns pointer to last byte of addr data
*/
static int parse_dcc(char *data, const char *data_end, u_int32_t *ip,
static int parse_dcc(char *data, const char *data_end, __be32 *ip,
u_int16_t *port, char **ad_beg_p, char **ad_end_p)
{
char *tmp;
......@@ -85,7 +85,7 @@ static int parse_dcc(char *data, const char *data_end, u_int32_t *ip,
return -1;
*ad_beg_p = data;
*ip = simple_strtoul(data, &data, 10);
*ip = cpu_to_be32(simple_strtoul(data, &data, 10));
/* skip blanks between ip and port */
while (*data == ' ') {
......@@ -112,7 +112,7 @@ static int help(struct sk_buff *skb, unsigned int protoff,
int dir = CTINFO2DIR(ctinfo);
struct nf_conntrack_expect *exp;
struct nf_conntrack_tuple *tuple;
u_int32_t dcc_ip;
__be32 dcc_ip;
u_int16_t dcc_port;
__be16 port;
int i, ret = NF_ACCEPT;
......@@ -177,13 +177,14 @@ static int help(struct sk_buff *skb, unsigned int protoff,
pr_debug("unable to parse dcc command\n");
continue;
}
pr_debug("DCC bound ip/port: %u.%u.%u.%u:%u\n",
HIPQUAD(dcc_ip), dcc_port);
pr_debug("DCC bound ip/port: %pI4:%u\n",
&dcc_ip, dcc_port);
/* dcc_ip can be the internal OR external (NAT'ed) IP */
tuple = &ct->tuplehash[dir].tuple;
if (tuple->src.u3.ip != htonl(dcc_ip) &&
tuple->dst.u3.ip != htonl(dcc_ip)) {
if (tuple->src.u3.ip != dcc_ip &&
tuple->dst.u3.ip != dcc_ip) {
if (net_ratelimit())
printk(KERN_WARNING
"Forged DCC command from %pI4: %pI4:%u\n",
......
......@@ -57,6 +57,13 @@ xt_cluster_hash(const struct nf_conn *ct,
return (((u64)hash * info->total_nodes) >> 32);
}
static inline bool
xt_cluster_ipv6_is_multicast(const struct in6_addr *addr)
{
__be32 st = addr->s6_addr32[0];
return ((st & htonl(0xFF000000)) == htonl(0xFF000000));
}
static inline bool
xt_cluster_is_multicast_addr(const struct sk_buff *skb, u_int8_t family)
{
......@@ -67,8 +74,8 @@ xt_cluster_is_multicast_addr(const struct sk_buff *skb, u_int8_t family)
is_multicast = ipv4_is_multicast(ip_hdr(skb)->daddr);
break;
case NFPROTO_IPV6:
is_multicast = ipv6_addr_type(&ipv6_hdr(skb)->daddr) &
IPV6_ADDR_MULTICAST;
is_multicast =
xt_cluster_ipv6_is_multicast(&ipv6_hdr(skb)->daddr);
break;
default:
WARN_ON(1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册