Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 202951
b: refs/heads/master
c: 16fb62b
h: refs/heads/master
i:
  202949: 59fe4e4
  202947: f842780
  202943: bd4a035
v: v3
  • Loading branch information
David S. Miller committed Jun 15, 2010
1 parent 05946aa commit 0172125
Show file tree
Hide file tree
Showing 32 changed files with 389 additions and 289 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: f9181f4ffc71d7b7dd1906c9a11d51d6659220ae
refs/heads/master: 16fb62b6b4d57339a0ec931b3fb8c8d0ca6414e8
2 changes: 1 addition & 1 deletion trunk/drivers/net/ksz884x.c
Original file line number Diff line number Diff line change
Expand Up @@ -5718,7 +5718,7 @@ static void dev_set_promiscuous(struct net_device *dev, struct dev_priv *priv,
* from the bridge.
*/
if ((hw->features & STP_SUPPORT) && !promiscuous &&
dev->br_port) {
(dev->priv_flags & IFF_BRIDGE_PORT)) {
struct ksz_switch *sw = hw->ksz_switch;
int port = priv->port.first_port;

Expand Down
28 changes: 16 additions & 12 deletions trunk/drivers/net/macvlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ struct macvlan_port {
struct rcu_head rcu;
};

#define macvlan_port_get_rcu(dev) \
((struct macvlan_port *) rcu_dereference(dev->rx_handler_data))
#define macvlan_port_get(dev) ((struct macvlan_port *) dev->rx_handler_data)
#define macvlan_port_exists(dev) (dev->priv_flags & IFF_MACVLAN_PORT)

static struct macvlan_dev *macvlan_hash_lookup(const struct macvlan_port *port,
const unsigned char *addr)
{
Expand Down Expand Up @@ -155,7 +160,7 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
struct net_device *dev;
unsigned int len;

port = rcu_dereference(skb->dev->macvlan_port);
port = macvlan_port_get_rcu(skb->dev);
if (is_multicast_ether_addr(eth->h_dest)) {
src = macvlan_hash_lookup(port, eth->h_source);
if (!src)
Expand Down Expand Up @@ -530,14 +535,12 @@ static int macvlan_port_create(struct net_device *dev)
INIT_LIST_HEAD(&port->vlans);
for (i = 0; i < MACVLAN_HASH_SIZE; i++)
INIT_HLIST_HEAD(&port->vlan_hash[i]);
rcu_assign_pointer(dev->macvlan_port, port);

err = netdev_rx_handler_register(dev, macvlan_handle_frame);
if (err) {
rcu_assign_pointer(dev->macvlan_port, NULL);
err = netdev_rx_handler_register(dev, macvlan_handle_frame, port);
if (err)
kfree(port);
}

dev->priv_flags |= IFF_MACVLAN_PORT;
return err;
}

Expand All @@ -551,10 +554,10 @@ static void macvlan_port_rcu_free(struct rcu_head *head)

static void macvlan_port_destroy(struct net_device *dev)
{
struct macvlan_port *port = dev->macvlan_port;
struct macvlan_port *port = macvlan_port_get(dev);

dev->priv_flags &= ~IFF_MACVLAN_PORT;
netdev_rx_handler_unregister(dev);
rcu_assign_pointer(dev->macvlan_port, NULL);
call_rcu(&port->rcu, macvlan_port_rcu_free);
}

Expand Down Expand Up @@ -633,12 +636,12 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
if (!tb[IFLA_ADDRESS])
random_ether_addr(dev->dev_addr);

if (lowerdev->macvlan_port == NULL) {
if (!macvlan_port_exists(lowerdev)) {
err = macvlan_port_create(lowerdev);
if (err < 0)
return err;
}
port = lowerdev->macvlan_port;
port = macvlan_port_get(lowerdev);

vlan->lowerdev = lowerdev;
vlan->dev = dev;
Expand Down Expand Up @@ -748,10 +751,11 @@ static int macvlan_device_event(struct notifier_block *unused,
struct macvlan_dev *vlan, *next;
struct macvlan_port *port;

port = dev->macvlan_port;
if (port == NULL)
if (!macvlan_port_exists(dev))
return NOTIFY_DONE;

port = macvlan_port_get(dev);

switch (event) {
case NETDEV_CHANGE:
list_for_each_entry(vlan, &port->vlans, list)
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/batman-adv/hard-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static int is_valid_iface(struct net_device *net_dev)
#endif

/* Device is being bridged */
/* if (net_dev->br_port != NULL)
/* if (net_dev->priv_flags & IFF_BRIDGE_PORT)
return 0; */

return 1;
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/if.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */
#define IFF_IN_NETPOLL 0x1000 /* whether we are processing netpoll */
#define IFF_DISABLE_NETPOLL 0x2000 /* disable netpoll at run-time */
#define IFF_MACVLAN_PORT 0x4000 /* device used as macvlan port */
#define IFF_BRIDGE_PORT 0x8000 /* device used as bridge port */

#define IF_GET_IFACE 0x0001 /* for querying only */
#define IF_GET_PROTO 0x0002
Expand Down
10 changes: 5 additions & 5 deletions trunk/include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,8 @@ struct net_device_ops {
unsigned short vid);
#ifdef CONFIG_NET_POLL_CONTROLLER
void (*ndo_poll_controller)(struct net_device *dev);
int (*ndo_netpoll_setup)(struct net_device *dev,
struct netpoll_info *info);
void (*ndo_netpoll_cleanup)(struct net_device *dev);
#endif
int (*ndo_set_vf_mac)(struct net_device *dev,
Expand Down Expand Up @@ -977,6 +979,7 @@ struct net_device {

struct netdev_queue rx_queue;
rx_handler_func_t *rx_handler;
void *rx_handler_data;

struct netdev_queue *_tx ____cacheline_aligned_in_smp;

Expand Down Expand Up @@ -1044,10 +1047,6 @@ struct net_device {
/* mid-layer private */
void *ml_priv;

/* bridge stuff */
struct net_bridge_port *br_port;
/* macvlan */
struct macvlan_port *macvlan_port;
/* GARP */
struct garp_port *garp_port;

Expand Down Expand Up @@ -1710,7 +1709,8 @@ static inline void napi_free_frags(struct napi_struct *napi)
}

extern int netdev_rx_handler_register(struct net_device *dev,
rx_handler_func_t *rx_handler);
rx_handler_func_t *rx_handler,
void *rx_handler_data);
extern void netdev_rx_handler_unregister(struct net_device *dev);

extern void netif_nit_deliver(struct sk_buff *skb);
Expand Down
24 changes: 19 additions & 5 deletions trunk/include/linux/netpoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ void netpoll_poll(struct netpoll *np);
void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
void netpoll_print_options(struct netpoll *np);
int netpoll_parse_options(struct netpoll *np, char *opt);
int __netpoll_setup(struct netpoll *np);
int netpoll_setup(struct netpoll *np);
int netpoll_trap(void);
void netpoll_set_trap(int trap);
void __netpoll_cleanup(struct netpoll *np);
void netpoll_cleanup(struct netpoll *np);
int __netpoll_rx(struct sk_buff *skb);
void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb);
Expand All @@ -57,25 +59,30 @@ void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb);
#ifdef CONFIG_NETPOLL
static inline bool netpoll_rx(struct sk_buff *skb)
{
struct netpoll_info *npinfo = skb->dev->npinfo;
struct netpoll_info *npinfo;
unsigned long flags;
bool ret = false;

rcu_read_lock_bh();
npinfo = rcu_dereference(skb->dev->npinfo);

if (!npinfo || (list_empty(&npinfo->rx_np) && !npinfo->rx_flags))
return false;
goto out;

spin_lock_irqsave(&npinfo->rx_lock, flags);
/* check rx_flags again with the lock held */
if (npinfo->rx_flags && __netpoll_rx(skb))
ret = true;
spin_unlock_irqrestore(&npinfo->rx_lock, flags);

out:
rcu_read_unlock_bh();
return ret;
}

static inline int netpoll_rx_on(struct sk_buff *skb)
{
struct netpoll_info *npinfo = skb->dev->npinfo;
struct netpoll_info *npinfo = rcu_dereference(skb->dev->npinfo);

return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags);
}
Expand All @@ -91,7 +98,6 @@ static inline void *netpoll_poll_lock(struct napi_struct *napi)
{
struct net_device *dev = napi->dev;

rcu_read_lock(); /* deal with race on ->npinfo */
if (dev && dev->npinfo) {
spin_lock(&napi->poll_lock);
napi->poll_owner = smp_processor_id();
Expand All @@ -108,7 +114,11 @@ static inline void netpoll_poll_unlock(void *have)
napi->poll_owner = -1;
spin_unlock(&napi->poll_lock);
}
rcu_read_unlock();
}

static inline int netpoll_tx_running(struct net_device *dev)
{
return irqs_disabled();
}

#else
Expand All @@ -134,6 +144,10 @@ static inline void netpoll_poll_unlock(void *have)
static inline void netpoll_netdev_init(struct net_device *dev)
{
}
static inline int netpoll_tx_running(struct net_device *dev)
{
return 0;
}
#endif

#endif
24 changes: 11 additions & 13 deletions trunk/include/net/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,17 @@ extern u32 __tcp_select_window(struct sock *sk);
*/
#define tcp_time_stamp ((__u32)(jiffies))

#define tcp_flag_byte(th) (((u_int8_t *)th)[13])

#define TCPHDR_FIN 0x01
#define TCPHDR_SYN 0x02
#define TCPHDR_RST 0x04
#define TCPHDR_PSH 0x08
#define TCPHDR_ACK 0x10
#define TCPHDR_URG 0x20
#define TCPHDR_ECE 0x40
#define TCPHDR_CWR 0x80

/* This is what the send packet queuing engine uses to pass
* TCP per-packet control information to the transmission
* code. We also store the host-order sequence numbers in
Expand All @@ -620,19 +631,6 @@ struct tcp_skb_cb {
__u32 end_seq; /* SEQ + FIN + SYN + datalen */
__u32 when; /* used to compute rtt's */
__u8 flags; /* TCP header flags. */

/* NOTE: These must match up to the flags byte in a
* real TCP header.
*/
#define TCPCB_FLAG_FIN 0x01
#define TCPCB_FLAG_SYN 0x02
#define TCPCB_FLAG_RST 0x04
#define TCPCB_FLAG_PSH 0x08
#define TCPCB_FLAG_ACK 0x10
#define TCPCB_FLAG_URG 0x20
#define TCPCB_FLAG_ECE 0x40
#define TCPCB_FLAG_CWR 0x80

__u8 sacked; /* State flags for SACK/FACK. */
#define TCPCB_SACKED_ACKED 0x01 /* SKB ACK'd by a SACK block */
#define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */
Expand Down
Loading

0 comments on commit 0172125

Please sign in to comment.