* Re: [patch net-next-2.6 8/8] net: get rid of orig_dev parameter of packet handlers
From: Jiri Pirko @ 2011-03-05 15:15 UTC (permalink / raw)
To: Nicolas de Pesloüan
Cc: netdev, davem, shemminger, kaber, fubar, eric.dumazet, andy
In-Reply-To: <4D72512C.2060802@gmail.com>
Sat, Mar 05, 2011 at 04:05:16PM CET, nicolas.2p.debian@gmail.com wrote:
>Le 05/03/2011 11:29, Jiri Pirko a écrit :
>>Since orig_dev was used in af_packet (where it was replaced) and by
>>bonding ptype handlers (which are no longer with us) only, orig_dev
>>parameter is no longer needed -> toss it out
>>
>>Signed-off-by: Jiri Pirko<jpirko@redhat.com>
>
>[snip]
>>- new->deliver_no_wcard = old->deliver_no_wcard;
>
>deliver_no_wcard was removed from sk_buff in your #7 patch. Shouldn't
>the above line be part of the #7 patch?
Indeed, I wonder how if got here. Will repost to correct this.
>
>Except from this point,
>
>Reviewed-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
>
> Nicolas.
^ permalink raw reply
* Re: [patch net-next-2.6 4/8] bonding: wrap slave state work
From: Nicolas de Pesloüan @ 2011-03-05 15:21 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, davem, shemminger, kaber, fubar, eric.dumazet, andy
In-Reply-To: <1299320969-7951-5-git-send-email-jpirko@redhat.com>
Le 05/03/2011 11:29, Jiri Pirko a écrit :
> transfers slave->state into slave->backup (that it's going to transfer
> into bitfield. Introduce wrapper inlines to do the work with it.
>
> Signed-off-by: Jiri Pirko<jpirko@redhat.com>
> ---
> drivers/net/bonding/bond_3ad.c | 2 +-
> drivers/net/bonding/bond_main.c | 36 ++++++++++++++++++------------------
> drivers/net/bonding/bond_sysfs.c | 2 +-
> drivers/net/bonding/bonding.h | 31 ++++++++++++++++++++++++++-----
> 4 files changed, 46 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
> index 1024ae1..047af0b 100644
> --- a/drivers/net/bonding/bond_3ad.c
> +++ b/drivers/net/bonding/bond_3ad.c
> @@ -246,7 +246,7 @@ static inline void __enable_port(struct port *port)
> */
> static inline int __port_is_enabled(struct port *port)
> {
> - return port->slave->state == BOND_STATE_ACTIVE;
> + return bond_is_active_slave(port->slave);
> }
>
> /**
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 7923184..62020a7 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1872,7 +1872,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
> break;
> case BOND_MODE_TLB:
> case BOND_MODE_ALB:
> - new_slave->state = BOND_STATE_ACTIVE;
> + bond_set_active_slave(new_slave);
> bond_set_slave_inactive_flags(new_slave);
> bond_select_active_slave(bond);
> break;
> @@ -1880,7 +1880,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
> pr_debug("This slave is always active in trunk mode\n");
>
> /* always active in trunk mode */
> - new_slave->state = BOND_STATE_ACTIVE;
> + bond_set_active_slave(new_slave);
>
> /* In trunking mode there is little meaning to curr_active_slave
> * anyway (it holds no special properties of the bond device),
> @@ -1918,7 +1918,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
>
> pr_info("%s: enslaving %s as a%s interface with a%s link.\n",
> bond_dev->name, slave_dev->name,
> - new_slave->state == BOND_STATE_ACTIVE ? "n active" : " backup",
> + bond_is_active_slave(new_slave) ? "n active" : " backup",
> new_slave->link != BOND_LINK_DOWN ? "n up" : " down");
I would prefer the following, for the benefit of non native English readers:
pr_info("%s: enslaving %s as %s interface with %s link.\n",
bond_is_active_slave(new_slave) ? "an active" : "a backup",
new_slave->link != BOND_LINK_DOWN ? "an up" : "a down");
It can be in a follow-up patch.
>
> /* enslave is successful */
> @@ -2016,7 +2016,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
>
> pr_info("%s: releasing %s interface %s\n",
> bond_dev->name,
> - (slave->state == BOND_STATE_ACTIVE) ? "active" : "backup",
> + bond_is_active_slave(slave) ? "active" : "backup",
> slave_dev->name);
>
> oldcurrent = bond->curr_active_slave;
> @@ -2357,7 +2357,7 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in
> res = 0;
> strcpy(info->slave_name, slave->dev->name);
> info->link = slave->link;
> - info->state = slave->state;
> + info->state = bond_slave_state(slave);
> info->link_failure_count = slave->link_failure_count;
> break;
> }
> @@ -2396,7 +2396,7 @@ static int bond_miimon_inspect(struct bonding *bond)
> bond->dev->name,
> (bond->params.mode ==
> BOND_MODE_ACTIVEBACKUP) ?
> - ((slave->state == BOND_STATE_ACTIVE) ?
> + (bond_is_active_slave(slave) ?
> "active " : "backup ") : "",
> slave->dev->name,
> bond->params.downdelay * bond->params.miimon);
> @@ -2487,13 +2487,13 @@ static void bond_miimon_commit(struct bonding *bond)
>
> if (bond->params.mode == BOND_MODE_8023AD) {
> /* prevent it from being the active one */
> - slave->state = BOND_STATE_BACKUP;
> + bond_set_backup_slave(slave);
> } else if (bond->params.mode != BOND_MODE_ACTIVEBACKUP) {
> /* make it immediately active */
> - slave->state = BOND_STATE_ACTIVE;
> + bond_set_active_slave(slave);
> } else if (slave != bond->primary_slave) {
> /* prevent it from being the active one */
> - slave->state = BOND_STATE_BACKUP;
> + bond_set_backup_slave(slave);
> }
>
> bond_update_speed_duplex(slave);
> @@ -2871,7 +2871,7 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
> memcpy(&tip, arp_ptr, 4);
>
> pr_debug("bond_arp_rcv: %s %s/%d av %d sv %d sip %pI4 tip %pI4\n",
> - bond->dev->name, slave->dev->name, slave->state,
> + bond->dev->name, slave->dev->name, bond_slave_state(slave),
> bond->params.arp_validate, slave_do_arp_validate(bond, slave),
> &sip,&tip);
>
> @@ -2883,7 +2883,7 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
> * the active, through one switch, the router, then the other
> * switch before reaching the backup.
> */
> - if (slave->state == BOND_STATE_ACTIVE)
> + if (bond_is_active_slave(slave))
> bond_validate_arp(bond, slave, sip, tip);
> else
> bond_validate_arp(bond, slave, tip, sip);
> @@ -2945,7 +2945,7 @@ void bond_loadbalance_arp_mon(struct work_struct *work)
> slave->dev->last_rx + delta_in_ticks)) {
>
> slave->link = BOND_LINK_UP;
> - slave->state = BOND_STATE_ACTIVE;
> + bond_set_active_slave(slave);
>
> /* primary_slave has no meaning in round-robin
> * mode. the window of a slave being up and
> @@ -2978,7 +2978,7 @@ void bond_loadbalance_arp_mon(struct work_struct *work)
> slave->dev->last_rx + 2 * delta_in_ticks)) {
>
> slave->link = BOND_LINK_DOWN;
> - slave->state = BOND_STATE_BACKUP;
> + bond_set_backup_slave(slave);
>
> if (slave->link_failure_count< UINT_MAX)
> slave->link_failure_count++;
> @@ -3072,7 +3072,7 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks)
> * gives each slave a chance to tx/rx traffic
> * before being taken out
> */
> - if (slave->state == BOND_STATE_BACKUP&&
> + if (!bond_is_active_slave(slave)&&
> !bond->current_arp_slave&&
> !time_in_range(jiffies,
> slave_last_rx(bond, slave) - delta_in_ticks,
> @@ -3089,7 +3089,7 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks)
> * the bond has an IP address)
> */
> trans_start = dev_trans_start(slave->dev);
> - if ((slave->state == BOND_STATE_ACTIVE)&&
> + if (bond_is_active_slave(slave)&&
> (!time_in_range(jiffies,
> trans_start - delta_in_ticks,
> trans_start + 2 * delta_in_ticks) ||
> @@ -4446,7 +4446,7 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev
> bond_for_each_slave_from(bond, slave, i, start_at) {
> if (IS_UP(slave->dev)&&
> (slave->link == BOND_LINK_UP)&&
> - (slave->state == BOND_STATE_ACTIVE)) {
> + bond_is_active_slave(slave)) {
> res = bond_dev_queue_xmit(bond, skb, slave->dev);
> break;
> }
> @@ -4523,7 +4523,7 @@ static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev)
> bond_for_each_slave_from(bond, slave, i, start_at) {
> if (IS_UP(slave->dev)&&
> (slave->link == BOND_LINK_UP)&&
> - (slave->state == BOND_STATE_ACTIVE)) {
> + bond_is_active_slave(slave)) {
> res = bond_dev_queue_xmit(bond, skb, slave->dev);
> break;
> }
> @@ -4564,7 +4564,7 @@ static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev)
> bond_for_each_slave_from(bond, slave, i, start_at) {
> if (IS_UP(slave->dev)&&
> (slave->link == BOND_LINK_UP)&&
> - (slave->state == BOND_STATE_ACTIVE)) {
> + bond_is_active_slave(slave)) {
> if (tx_dev) {
> struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
> if (!skb2) {
> diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
> index 05e0ae5..344d23f 100644
> --- a/drivers/net/bonding/bond_sysfs.c
> +++ b/drivers/net/bonding/bond_sysfs.c
> @@ -1579,7 +1579,7 @@ static ssize_t bonding_store_slaves_active(struct device *d,
> }
>
> bond_for_each_slave(bond, slave, i) {
> - if (slave->state == BOND_STATE_BACKUP) {
> + if (!bond_is_active_slave(slave)) {
> if (new_value)
> slave->dev->priv_flags&= ~IFF_SLAVE_INACTIVE;
> else
> diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
> index ddee62f..8a3718b 100644
> --- a/drivers/net/bonding/bonding.h
> +++ b/drivers/net/bonding/bonding.h
> @@ -53,7 +53,7 @@
> (((slave)->dev->flags& IFF_UP)&& \
> netif_running((slave)->dev)&& \
> ((slave)->link == BOND_LINK_UP)&& \
> - ((slave)->state == BOND_STATE_ACTIVE))
> + bond_is_active_slave(slave))
>
>
> #define USES_PRIMARY(mode) \
> @@ -190,7 +190,8 @@ struct slave {
> unsigned long last_arp_rx;
> s8 link; /* one of BOND_LINK_XXXX */
> s8 new_link;
> - s8 state; /* one of BOND_STATE_XXXX */
> + u8 backup; /* indicates backup slave. Value corresponds with
> + BOND_STATE_ACTIVE and BOND_STATE_BACKUP */
> u32 original_mtu;
> u32 link_failure_count;
> u8 perm_hwaddr[ETH_ALEN];
> @@ -302,6 +303,26 @@ static inline bool bond_is_lb(const struct bonding *bond)
> bond->params.mode == BOND_MODE_ALB);
> }
>
> +static inline void bond_set_active_slave(struct slave *slave)
> +{
> + slave->backup = 0;
In the comment above, you said that the possible value for backup corresponds with BOND_STATE_ACTIVE
and BOND_STATE_BACKUP.
So, should be:
slave->backup = BOND_STATE_ACTIVE;
> +}
> +
> +static inline void bond_set_backup_slave(struct slave *slave)
> +{
> + slave->backup = 1;
slave->backup = BOND_STATE_BACKUP;
> +}
> +
> +static inline int bond_slave_state(struct slave *slave)
> +{
> + return slave->backup;
> +}
> +
> +static inline bool bond_is_active_slave(struct slave *slave)
> +{
> + return !bond_slave_state(slave);
> +}
> +
> #define BOND_PRI_RESELECT_ALWAYS 0
> #define BOND_PRI_RESELECT_BETTER 1
> #define BOND_PRI_RESELECT_FAILURE 2
> @@ -319,7 +340,7 @@ static inline bool bond_is_lb(const struct bonding *bond)
> static inline int slave_do_arp_validate(struct bonding *bond,
> struct slave *slave)
> {
> - return bond->params.arp_validate& (1<< slave->state);
> + return bond->params.arp_validate& (1<< bond_slave_state(slave));
> }
>
> static inline unsigned long slave_last_rx(struct bonding *bond,
> @@ -351,14 +372,14 @@ static inline void bond_set_slave_inactive_flags(struct slave *slave)
> {
> struct bonding *bond = netdev_priv(slave->dev->master);
> if (!bond_is_lb(bond))
> - slave->state = BOND_STATE_BACKUP;
> + bond_set_backup_slave(slave);
> if (!bond->params.all_slaves_active)
> slave->dev->priv_flags |= IFF_SLAVE_INACTIVE;
> }
>
> static inline void bond_set_slave_active_flags(struct slave *slave)
> {
> - slave->state = BOND_STATE_ACTIVE;
> + bond_set_active_slave(slave);
> slave->dev->priv_flags&= ~IFF_SLAVE_INACTIVE;
> }
>
^ permalink raw reply
* Re: [patch net-next-2.6] net: comment rx_handler results
From: Nicolas de Pesloüan @ 2011-03-05 15:27 UTC (permalink / raw)
To: Jiri Pirko
Cc: Ben Hutchings, netdev, davem, shemminger, kaber, fubar,
eric.dumazet, andy
In-Reply-To: <20110305151331.GE8573@psychotron.redhat.com>
Le 05/03/2011 16:13, Jiri Pirko a écrit :
>
> Signed-off-by: Jiri Pirko<jpirko@redhat.com>
> ---
> include/linux/netdevice.h | 12 ++++++++----
> 1 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 48a9638..26e03f9 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -391,10 +391,14 @@ enum gro_result {
> typedef enum gro_result gro_result_t;
>
> enum rx_handler_result {
> - RX_HANDLER_CONSUMED,
> - RX_HANDLER_ANOTHER,
> - RX_HANDLER_EXACT,
> - RX_HANDLER_PASS,
> + RX_HANDLER_CONSUMED, /* skb was consumed by rx_handler,
> + do not process it further. */
> + RX_HANDLER_ANOTHER, /* Do another round in receive path.
> + This is indicated in case skb->dev
> + was changed by rx_handler */
> + RX_HANDLER_EXACT, /* Force exact delivery, no wildcard */
> + RX_HANDLER_PASS, /* Do nothing, pass the skb as if
> + no rx_handler was called */
Changing skb->dev should always cause another_round.
So, RX_HANDLER_ANOTHER could be removed and replaced with a test for skb->dev change, with
RX_HANDER_EXACT and RX_HANDLER_PASS.
> + RX_HANDLER_CONSUMED, /* skb was consumed by rx_handler,
> + do not process it further. */
> + RX_HANDLER_EXACT, /* Force exact delivery, no wildcard */
> + RX_HANDLER_PASS, /* Do normal (wildcard and exact) delivery */
And any rx_handler returning RX_HANDLER_EXACT should cause exact delivery, even if possible next
rx_handlers return RX_HANDLER_PASS.
Nicolas.
^ permalink raw reply
* [patch net-next-2.6 7/8 v2] net: introduce rx_handler results and logic around that
From: Jiri Pirko @ 2011-03-05 15:31 UTC (permalink / raw)
To: netdev
Cc: davem, shemminger, kaber, fubar, eric.dumazet, nicolas.2p.debian,
andy
In-Reply-To: <1299320969-7951-8-git-send-email-jpirko@redhat.com>
This patch allows rx_handlers to better signalize what to do next to
it's caller. That makes skb->deliver_no_wcard no longer needed.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Reviewed-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
v1->v2:
moved __copy_skb_header hunk from 8/8 here
---
drivers/net/bonding/bond_main.c | 20 +++++++++++---------
drivers/net/macvlan.c | 11 ++++++-----
include/linux/netdevice.h | 9 ++++++++-
include/linux/skbuff.h | 5 +----
net/bridge/br_input.c | 25 +++++++++++++++----------
net/bridge/br_private.h | 2 +-
net/core/dev.c | 19 ++++++++++++-------
net/core/skbuff.c | 1 -
8 files changed, 54 insertions(+), 38 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 8ba7faa..ab56190 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1483,20 +1483,23 @@ static bool bond_should_deliver_exact_match(struct sk_buff *skb,
return false;
}
-static struct sk_buff *bond_handle_frame(struct sk_buff *skb)
+static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
{
+ struct sk_buff *skb = *pskb;
struct slave *slave;
struct net_device *bond_dev;
struct bonding *bond;
- skb = skb_share_check(skb, GFP_ATOMIC);
- if (unlikely(!skb))
- return NULL;
-
slave = bond_slave_get_rcu(skb->dev);
bond_dev = ACCESS_ONCE(slave->dev->master);
if (unlikely(!bond_dev))
- return skb;
+ return RX_HANDLER_PASS;
+
+ skb = skb_share_check(skb, GFP_ATOMIC);
+ if (unlikely(!skb))
+ return RX_HANDLER_CONSUMED;
+
+ *pskb = skb;
bond = netdev_priv(bond_dev);
@@ -1513,8 +1516,7 @@ static struct sk_buff *bond_handle_frame(struct sk_buff *skb)
}
if (bond_should_deliver_exact_match(skb, slave, bond)) {
- skb->deliver_no_wcard = 1;
- return skb;
+ return RX_HANDLER_EXACT;
}
skb->dev = bond_dev;
@@ -1527,7 +1529,7 @@ static struct sk_buff *bond_handle_frame(struct sk_buff *skb)
memcpy(dest, bond_dev->dev_addr, ETH_ALEN);
}
- return skb;
+ return RX_HANDLER_ANOTHER;
}
/* enslave device <slave> to bond device <master> */
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 6ed577b..ead9a8f 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -152,9 +152,10 @@ static void macvlan_broadcast(struct sk_buff *skb,
}
/* called under rcu_read_lock() from netif_receive_skb */
-static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
+static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
{
struct macvlan_port *port;
+ struct sk_buff *skb = *pskb;
const struct ethhdr *eth = eth_hdr(skb);
const struct macvlan_dev *vlan;
const struct macvlan_dev *src;
@@ -184,7 +185,7 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
*/
macvlan_broadcast(skb, port, src->dev,
MACVLAN_MODE_VEPA);
- return skb;
+ return RX_HANDLER_PASS;
}
if (port->passthru)
@@ -192,12 +193,12 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
else
vlan = macvlan_hash_lookup(port, eth->h_dest);
if (vlan == NULL)
- return skb;
+ return RX_HANDLER_PASS;
dev = vlan->dev;
if (unlikely(!(dev->flags & IFF_UP))) {
kfree_skb(skb);
- return NULL;
+ return RX_HANDLER_CONSUMED;
}
len = skb->len + ETH_HLEN;
skb = skb_share_check(skb, GFP_ATOMIC);
@@ -211,7 +212,7 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
out:
macvlan_count_rx(vlan, len, ret == NET_RX_SUCCESS, 0);
- return NULL;
+ return RX_HANDLER_CONSUMED;
}
static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 8be4056..ff386a4 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -390,7 +390,14 @@ enum gro_result {
};
typedef enum gro_result gro_result_t;
-typedef struct sk_buff *rx_handler_func_t(struct sk_buff *skb);
+enum rx_handler_result {
+ RX_HANDLER_CONSUMED,
+ RX_HANDLER_ANOTHER,
+ RX_HANDLER_EXACT,
+ RX_HANDLER_PASS,
+};
+typedef enum rx_handler_result rx_handler_result_t;
+typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb);
extern void __napi_schedule(struct napi_struct *n);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 31f02d0..24cfa62 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -388,10 +388,7 @@ struct sk_buff {
kmemcheck_bitfield_begin(flags2);
__u16 queue_mapping:16;
#ifdef CONFIG_IPV6_NDISC_NODETYPE
- __u8 ndisc_nodetype:2,
- deliver_no_wcard:1;
-#else
- __u8 deliver_no_wcard:1;
+ __u8 ndisc_nodetype:2;
#endif
__u8 ooo_okay:1;
kmemcheck_bitfield_end(flags2);
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 88e4aa9..e216079 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -139,21 +139,22 @@ static inline int is_link_local(const unsigned char *dest)
* Return NULL if skb is handled
* note: already called with rcu_read_lock
*/
-struct sk_buff *br_handle_frame(struct sk_buff *skb)
+rx_handler_result_t br_handle_frame(struct sk_buff **pskb)
{
struct net_bridge_port *p;
+ struct sk_buff *skb = *pskb;
const unsigned char *dest = eth_hdr(skb)->h_dest;
br_should_route_hook_t *rhook;
if (unlikely(skb->pkt_type == PACKET_LOOPBACK))
- return skb;
+ return RX_HANDLER_PASS;
if (!is_valid_ether_addr(eth_hdr(skb)->h_source))
goto drop;
skb = skb_share_check(skb, GFP_ATOMIC);
if (!skb)
- return NULL;
+ return RX_HANDLER_CONSUMED;
p = br_port_get_rcu(skb->dev);
@@ -167,10 +168,12 @@ struct sk_buff *br_handle_frame(struct sk_buff *skb)
goto forward;
if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev,
- NULL, br_handle_local_finish))
- return NULL; /* frame consumed by filter */
- else
- return skb; /* continue processing */
+ NULL, br_handle_local_finish)) {
+ return RX_HANDLER_CONSUMED; /* consumed by filter */
+ } else {
+ *pskb = skb;
+ return RX_HANDLER_PASS; /* continue processing */
+ }
}
forward:
@@ -178,8 +181,10 @@ forward:
case BR_STATE_FORWARDING:
rhook = rcu_dereference(br_should_route_hook);
if (rhook) {
- if ((*rhook)(skb))
- return skb;
+ if ((*rhook)(skb)) {
+ *pskb = skb;
+ return RX_HANDLER_PASS;
+ }
dest = eth_hdr(skb)->h_dest;
}
/* fall through */
@@ -194,5 +199,5 @@ forward:
drop:
kfree_skb(skb);
}
- return NULL;
+ return RX_HANDLER_CONSUMED;
}
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index f7afc36..19e2f46 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -379,7 +379,7 @@ extern void br_features_recompute(struct net_bridge *br);
/* br_input.c */
extern int br_handle_frame_finish(struct sk_buff *skb);
-extern struct sk_buff *br_handle_frame(struct sk_buff *skb);
+extern rx_handler_result_t br_handle_frame(struct sk_buff **pskb);
/* br_ioctl.c */
extern int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
diff --git a/net/core/dev.c b/net/core/dev.c
index 9f66de9..58daddb 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3121,6 +3121,7 @@ static int __netif_receive_skb(struct sk_buff *skb)
rx_handler_func_t *rx_handler;
struct net_device *orig_dev;
struct net_device *null_or_dev;
+ bool deliver_exact = false;
int ret = NET_RX_DROP;
__be16 type;
@@ -3173,18 +3174,22 @@ ncls:
rx_handler = rcu_dereference(skb->dev->rx_handler);
if (rx_handler) {
- struct net_device *prev_dev;
-
if (pt_prev) {
ret = deliver_skb(skb, pt_prev, orig_dev);
pt_prev = NULL;
}
- prev_dev = skb->dev;
- skb = rx_handler(skb);
- if (!skb)
+ switch (rx_handler(&skb)) {
+ case RX_HANDLER_CONSUMED:
goto out;
- if (skb->dev != prev_dev)
+ case RX_HANDLER_ANOTHER:
goto another_round;
+ case RX_HANDLER_EXACT:
+ deliver_exact = true;
+ case RX_HANDLER_PASS:
+ break;
+ default:
+ BUG();
+ }
}
if (vlan_tx_tag_present(skb)) {
@@ -3202,7 +3207,7 @@ ncls:
vlan_on_bond_hook(skb);
/* deliver only exact match when indicated */
- null_or_dev = skb->deliver_no_wcard ? skb->dev : NULL;
+ null_or_dev = deliver_exact ? skb->dev : NULL;
type = skb->protocol;
list_for_each_entry_rcu(ptype,
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 1eb526a..801dd08 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -523,7 +523,6 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
new->ip_summed = old->ip_summed;
skb_copy_queue_mapping(new, old);
new->priority = old->priority;
- new->deliver_no_wcard = old->deliver_no_wcard;
#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
new->ipvs_property = old->ipvs_property;
#endif
--
1.7.4
^ permalink raw reply related
* [patch net-next-2.6 8/8 v2] net: get rid of orig_dev parameter of packet handlers
From: Jiri Pirko @ 2011-03-05 15:32 UTC (permalink / raw)
To: netdev
Cc: davem, shemminger, kaber, fubar, eric.dumazet, nicolas.2p.debian,
andy
In-Reply-To: <1299320969-7951-9-git-send-email-jpirko@redhat.com>
Since orig_dev was used in af_packet (where it was replaced) and by
bonding ptype handlers (which are no longer with us) only, orig_dev
parameter is no longer needed -> toss it out
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Reviewed-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
v1->v2:
moved __copy_skb_header hunk to 7/8
---
drivers/block/aoe/aoenet.c | 2 +-
drivers/net/hamradio/bpqether.c | 4 ++--
drivers/net/pppoe.c | 4 ++--
drivers/net/wan/hdlc.c | 2 +-
drivers/net/wan/lapbether.c | 2 +-
drivers/scsi/fcoe/fcoe.c | 12 ++++--------
include/linux/netdevice.h | 3 +--
include/net/ax25.h | 3 ++-
include/net/datalink.h | 2 +-
include/net/ip.h | 2 +-
include/net/ipv6.h | 3 +--
include/net/irda/irda.h | 3 +--
include/net/llc.h | 8 +++-----
include/net/p8022.h | 3 +--
include/net/psnap.h | 3 +--
include/net/x25.h | 2 +-
net/802/p8022.c | 3 +--
net/802/psnap.c | 7 +++----
net/802/stp.c | 2 +-
net/8021q/vlan.h | 2 +-
net/8021q/vlan_dev.c | 2 +-
net/appletalk/aarp.c | 2 +-
net/appletalk/ddp.c | 6 +++---
net/ax25/ax25_in.c | 2 +-
net/batman-adv/hard-interface.c | 6 ++----
net/caif/caif_dev.c | 2 +-
net/can/af_can.c | 2 +-
net/core/dev.c | 26 ++++++++++++--------------
net/decnet/af_decnet.c | 2 +-
net/decnet/dn_route.c | 2 +-
net/dsa/tag_dsa.c | 2 +-
net/dsa/tag_edsa.c | 2 +-
net/dsa/tag_trailer.c | 2 +-
net/econet/af_econet.c | 2 +-
net/ieee802154/af_ieee802154.c | 2 +-
net/ipv4/arp.c | 2 +-
net/ipv4/ip_input.c | 2 +-
net/ipv4/ipconfig.c | 13 ++++++++-----
net/ipv6/ip6_input.c | 3 ++-
net/ipx/af_ipx.c | 3 ++-
net/irda/irlap_frame.c | 2 +-
net/llc/llc_core.c | 3 +--
net/llc/llc_input.c | 8 ++++----
net/packet/af_packet.c | 6 +++---
net/phonet/af_phonet.c | 3 +--
net/tipc/eth_media.c | 2 +-
net/x25/x25_dev.c | 2 +-
47 files changed, 85 insertions(+), 98 deletions(-)
diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c
index 4d3bc0d..c12e14b 100644
--- a/drivers/block/aoe/aoenet.c
+++ b/drivers/block/aoe/aoenet.c
@@ -99,7 +99,7 @@ aoenet_xmit(struct sk_buff_head *queue)
* (1) len doesn't include the header by default. I want this.
*/
static int
-aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt, struct net_device *orig_dev)
+aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt)
{
struct aoe_hdr *h;
u32 n;
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index 8931168..f17ca33 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -95,7 +95,7 @@ static char bcast_addr[6]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
static char bpq_eth_addr[6];
-static int bpq_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
+static int bpq_rcv(struct sk_buff *, struct net_device *, struct packet_type *);
static int bpq_device_event(struct notifier_block *, unsigned long, void *);
static struct packet_type bpq_packet_type __read_mostly = {
@@ -177,7 +177,7 @@ static inline int dev_is_ethdev(struct net_device *dev)
/*
* Receive an AX.25 frame via an ethernet interface.
*/
-static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype, struct net_device *orig_dev)
+static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype)
{
int len;
char * ptr;
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 78c0e3c..b99cdaa 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -419,7 +419,7 @@ abort_kfree:
*
***********************************************************************/
static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
struct pppoe_hdr *ph;
struct pppox_sock *po;
@@ -467,7 +467,7 @@ out:
*
***********************************************************************/
static int pppoe_disc_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
struct pppoe_hdr *ph;
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c
index 5d4bb61..0ac4f27 100644
--- a/drivers/net/wan/hdlc.c
+++ b/drivers/net/wan/hdlc.c
@@ -53,7 +53,7 @@ int hdlc_change_mtu(struct net_device *dev, int new_mtu)
}
static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *p, struct net_device *orig_dev)
+ struct packet_type *p)
{
struct hdlc_device *hdlc = dev_to_hdlc(dev);
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
index 7f5bb91..993d71a 100644
--- a/drivers/net/wan/lapbether.c
+++ b/drivers/net/wan/lapbether.c
@@ -86,7 +86,7 @@ static __inline__ int dev_is_ethdev(struct net_device *dev)
/*
* Receive a LAPB frame via an ethernet interface.
*/
-static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype, struct net_device *orig_dev)
+static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype)
{
int len, err;
struct lapbethdev *lapbeth;
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 3becc6a..d7442b6 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -70,7 +70,7 @@ DEFINE_PER_CPU(struct fcoe_percpu_s, fcoe_percpu);
static int fcoe_reset(struct Scsi_Host *);
static int fcoe_xmit(struct fc_lport *, struct fc_frame *);
static int fcoe_rcv(struct sk_buff *, struct net_device *,
- struct packet_type *, struct net_device *);
+ struct packet_type *);
static int fcoe_percpu_receive_thread(void *);
static void fcoe_clean_pending_queue(struct fc_lport *);
static void fcoe_percpu_clean(struct fc_lport *);
@@ -88,7 +88,7 @@ static struct fcoe_interface
*fcoe_hostlist_lookup_port(const struct net_device *);
static int fcoe_fip_recv(struct sk_buff *, struct net_device *,
- struct packet_type *, struct net_device *);
+ struct packet_type *);
static void fcoe_fip_send(struct fcoe_ctlr *, struct sk_buff *);
static void fcoe_update_src_mac(struct fc_lport *, u8 *);
@@ -465,14 +465,11 @@ static inline void fcoe_interface_put(struct fcoe_interface *fcoe)
* @skb: The receive skb
* @netdev: The associated net device
* @ptype: The packet_type structure which was used to register this handler
- * @orig_dev: The original net_device the the skb was received on.
- * (in case dev is a bond)
*
* Returns: 0 for success
*/
static int fcoe_fip_recv(struct sk_buff *skb, struct net_device *netdev,
- struct packet_type *ptype,
- struct net_device *orig_dev)
+ struct packet_type *ptype)
{
struct fcoe_interface *fcoe;
@@ -1228,7 +1225,6 @@ static int fcoe_cpu_callback(struct notifier_block *nfb,
* @skb: The received packet
* @netdev: The net device that the packet was received on
* @ptype: The packet type context
- * @olddev: The last device net device
*
* This routine is called by NET_RX_SOFTIRQ. It receives a packet, builds a
* FC frame and passes the frame to libfc.
@@ -1236,7 +1232,7 @@ static int fcoe_cpu_callback(struct notifier_block *nfb,
* Returns: 0 for success
*/
int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev,
- struct packet_type *ptype, struct net_device *olddev)
+ struct packet_type *ptype)
{
struct fc_lport *lport;
struct fcoe_rcv_info *fr;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ff386a4..48a9638 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1456,8 +1456,7 @@ struct packet_type {
struct net_device *dev; /* NULL is wildcarded here */
int (*func) (struct sk_buff *,
struct net_device *,
- struct packet_type *,
- struct net_device *);
+ struct packet_type *);
struct sk_buff *(*gso_segment)(struct sk_buff *skb,
u32 features);
int (*gso_send_check)(struct sk_buff *skb);
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 206d222..fcbe6d8 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -362,7 +362,8 @@ extern int ax25_protocol_is_registered(unsigned int);
/* ax25_in.c */
extern int ax25_rx_iframe(ax25_cb *, struct sk_buff *);
-extern int ax25_kiss_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
+extern int ax25_kiss_rcv(struct sk_buff *, struct net_device *,
+ struct packet_type *);
/* ax25_ip.c */
extern int ax25_hard_header(struct sk_buff *, struct net_device *,
diff --git a/include/net/datalink.h b/include/net/datalink.h
index deb7ca7..5797ba3 100644
--- a/include/net/datalink.h
+++ b/include/net/datalink.h
@@ -9,7 +9,7 @@ struct datalink_proto {
unsigned short header_length;
int (*rcvfunc)(struct sk_buff *, struct net_device *,
- struct packet_type *, struct net_device *);
+ struct packet_type *);
int (*request)(struct datalink_proto *, struct sk_buff *,
unsigned char *);
struct list_head node;
diff --git a/include/net/ip.h b/include/net/ip.h
index a4f6311..3b04c24 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -94,7 +94,7 @@ extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
__be32 saddr, __be32 daddr,
struct ip_options *opt);
extern int ip_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev);
+ struct packet_type *pt);
extern int ip_local_deliver(struct sk_buff *skb);
extern int ip_mr_input(struct sk_buff *skb);
extern int ip_output(struct sk_buff *skb);
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index d6d077d..990f90b 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -470,8 +470,7 @@ static __inline__ void ipv6_select_ident(struct frag_hdr *fhdr)
extern int ipv6_rcv(struct sk_buff *skb,
struct net_device *dev,
- struct packet_type *pt,
- struct net_device *orig_dev);
+ struct packet_type *pt);
extern int ip6_rcv_finish(struct sk_buff *skb);
diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h
index 3bed61d..2c6e25d 100644
--- a/include/net/irda/irda.h
+++ b/include/net/irda/irda.h
@@ -125,7 +125,6 @@ extern int irda_nl_register(void);
extern void irda_nl_unregister(void);
extern int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *ptype,
- struct net_device *orig_dev);
+ struct packet_type *ptype);
#endif /* NET_IRDA_H */
diff --git a/include/net/llc.h b/include/net/llc.h
index 5503b74..73bfea5 100644
--- a/include/net/llc.h
+++ b/include/net/llc.h
@@ -58,8 +58,7 @@ struct llc_sap {
atomic_t refcnt;
int (*rcv_func)(struct sk_buff *skb,
struct net_device *dev,
- struct packet_type *pt,
- struct net_device *orig_dev);
+ struct packet_type *pt);
struct llc_addr laddr;
struct list_head node;
spinlock_t sk_lock;
@@ -96,7 +95,7 @@ extern struct list_head llc_sap_list;
extern spinlock_t llc_sap_list_lock;
extern int llc_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev);
+ struct packet_type *pt);
extern int llc_mac_hdr_init(struct sk_buff *skb,
const unsigned char *sa, const unsigned char *da);
@@ -110,8 +109,7 @@ extern void llc_set_station_handler(void (*handler)(struct sk_buff *skb));
extern struct llc_sap *llc_sap_open(unsigned char lsap,
int (*rcv)(struct sk_buff *skb,
struct net_device *dev,
- struct packet_type *pt,
- struct net_device *orig_dev));
+ struct packet_type *pt));
static inline void llc_sap_hold(struct llc_sap *sap)
{
atomic_inc(&sap->refcnt);
diff --git a/include/net/p8022.h b/include/net/p8022.h
index 42e9fac..6d878ae 100644
--- a/include/net/p8022.h
+++ b/include/net/p8022.h
@@ -4,8 +4,7 @@ extern struct datalink_proto *
register_8022_client(unsigned char type,
int (*func)(struct sk_buff *skb,
struct net_device *dev,
- struct packet_type *pt,
- struct net_device *orig_dev));
+ struct packet_type *pt));
extern void unregister_8022_client(struct datalink_proto *proto);
extern struct datalink_proto *make_8023_client(void);
diff --git a/include/net/psnap.h b/include/net/psnap.h
index fe456c2..604bf4b 100644
--- a/include/net/psnap.h
+++ b/include/net/psnap.h
@@ -4,8 +4,7 @@
extern struct datalink_proto *
register_snap_client(const unsigned char *desc,
int (*rcvfunc)(struct sk_buff *, struct net_device *,
- struct packet_type *,
- struct net_device *orig_dev));
+ struct packet_type *));
extern void unregister_snap_client(struct datalink_proto *proto);
#endif
diff --git a/include/net/x25.h b/include/net/x25.h
index a06119a..3f1c0df2 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -202,7 +202,7 @@ extern void x25_kill_by_neigh(struct x25_neigh *);
/* x25_dev.c */
extern void x25_send_frame(struct sk_buff *, struct x25_neigh *);
-extern int x25_lapb_receive_frame(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
+extern int x25_lapb_receive_frame(struct sk_buff *, struct net_device *, struct packet_type *);
extern void x25_establish_link(struct x25_neigh *);
extern void x25_terminate_link(struct x25_neigh *);
diff --git a/net/802/p8022.c b/net/802/p8022.c
index 7f353c4..4ab1339 100644
--- a/net/802/p8022.c
+++ b/net/802/p8022.c
@@ -36,8 +36,7 @@ static int p8022_request(struct datalink_proto *dl, struct sk_buff *skb,
struct datalink_proto *register_8022_client(unsigned char type,
int (*func)(struct sk_buff *skb,
struct net_device *dev,
- struct packet_type *pt,
- struct net_device *orig_dev))
+ struct packet_type *pt))
{
struct datalink_proto *proto;
diff --git a/net/802/psnap.c b/net/802/psnap.c
index 21cde8f..e74b48e 100644
--- a/net/802/psnap.c
+++ b/net/802/psnap.c
@@ -47,7 +47,7 @@ static struct datalink_proto *find_snap_client(const unsigned char *desc)
* A SNAP packet has arrived
*/
static int snap_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
int rc = 1;
struct datalink_proto *proto;
@@ -64,7 +64,7 @@ static int snap_rcv(struct sk_buff *skb, struct net_device *dev,
/* Pass the frame on. */
skb->transport_header += 5;
skb_pull_rcsum(skb, 5);
- rc = proto->rcvfunc(skb, dev, &snap_packet_type, orig_dev);
+ rc = proto->rcvfunc(skb, dev, &snap_packet_type);
}
rcu_read_unlock();
@@ -126,8 +126,7 @@ module_exit(snap_exit);
struct datalink_proto *register_snap_client(const unsigned char *desc,
int (*rcvfunc)(struct sk_buff *,
struct net_device *,
- struct packet_type *,
- struct net_device *))
+ struct packet_type *))
{
struct datalink_proto *proto = NULL;
diff --git a/net/802/stp.c b/net/802/stp.c
index 978c30b..dec1f88 100644
--- a/net/802/stp.c
+++ b/net/802/stp.c
@@ -30,7 +30,7 @@ static DEFINE_MUTEX(stp_proto_mutex);
/* Called under rcu_read_lock from LLC */
static int stp_pdu_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
const struct ethhdr *eh = eth_hdr(skb);
const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index 5687c9b..6f8941e 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -76,7 +76,7 @@ static inline struct vlan_dev_info *vlan_dev_info(const struct net_device *dev)
/* found in vlan_dev.c */
int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *ptype, struct net_device *orig_dev);
+ struct packet_type *ptype);
void vlan_dev_set_ingress_priority(const struct net_device *dev,
u32 skb_prio, u16 vlan_prio);
int vlan_dev_set_egress_priority(const struct net_device *dev,
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index be73753..6e396b9 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -138,7 +138,7 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
*
*/
int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *ptype, struct net_device *orig_dev)
+ struct packet_type *ptype)
{
struct vlan_hdr *vhdr;
struct vlan_pcpu_stats *rx_stats;
diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c
index 50dce79..996f366 100644
--- a/net/appletalk/aarp.c
+++ b/net/appletalk/aarp.c
@@ -715,7 +715,7 @@ static void __aarp_resolved(struct aarp_entry **list, struct aarp_entry *a,
* frame. We currently only support Ethernet.
*/
static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
struct elapaarp *ea = aarp_hdr(skb);
int hash, ret = 0;
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index c410b93..61b4983 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1425,7 +1425,7 @@ drop:
* layer. [ie ARPHRD_ETHERTALK]
*/
static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
struct ddpehdr *ddp;
struct sock *sock;
@@ -1522,7 +1522,7 @@ out:
* header and append a long one.
*/
static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
if (!net_eq(dev_net(dev), &init_net))
goto freeit;
@@ -1568,7 +1568,7 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
}
skb_reset_transport_header(skb);
- return atalk_rcv(skb, dev, pt, orig_dev);
+ return atalk_rcv(skb, dev, pt);
freeit:
kfree_skb(skb);
return 0;
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index 9bb7765..f6f94e6 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -436,7 +436,7 @@ free:
* Receive an AX.25 frame via a SLIP interface.
*/
int ax25_kiss_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *ptype, struct net_device *orig_dev)
+ struct packet_type *ptype)
{
skb_orphan(skb);
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index f2131f4..08579b0 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -37,8 +37,7 @@ static DEFINE_SPINLOCK(if_list_lock);
static int batman_skb_recv(struct sk_buff *skb,
struct net_device *dev,
- struct packet_type *ptype,
- struct net_device *orig_dev);
+ struct packet_type *ptype);
static void hardif_free_rcu(struct rcu_head *rcu)
{
@@ -556,8 +555,7 @@ out:
/* receive a packet with the batman ethertype coming on a hard
* interface */
static int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *ptype,
- struct net_device *orig_dev)
+ struct packet_type *ptype)
{
struct bat_priv *bat_priv;
struct batman_packet *batman_packet;
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c
index a42a408..9f016f0 100644
--- a/net/caif/caif_dev.c
+++ b/net/caif/caif_dev.c
@@ -165,7 +165,7 @@ static int modemcmd(struct cflayer *layr, enum caif_modemcmd ctrl)
* On error, returns non-zero and releases the skb.
*/
static int receive(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pkttype, struct net_device *orig_dev)
+ struct packet_type *pkttype)
{
struct net *net;
struct cfpkt *pkt;
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 702be5a..ad32de5 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -616,7 +616,7 @@ static int can_rcv_filter(struct dev_rcv_lists *d, struct sk_buff *skb)
}
static int can_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
struct dev_rcv_lists *d;
struct can_frame *cf = (struct can_frame *)skb->data;
diff --git a/net/core/dev.c b/net/core/dev.c
index 58daddb..c71bd18 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1534,11 +1534,10 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
EXPORT_SYMBOL_GPL(dev_forward_skb);
static inline int deliver_skb(struct sk_buff *skb,
- struct packet_type *pt_prev,
- struct net_device *orig_dev)
+ struct packet_type *pt_prev)
{
atomic_inc(&skb->users);
- return pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
+ return pt_prev->func(skb, skb->dev, pt_prev);
}
/*
@@ -1561,7 +1560,7 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
(ptype->af_packet_priv == NULL ||
(struct sock *)ptype->af_packet_priv != skb->sk)) {
if (pt_prev) {
- deliver_skb(skb2, pt_prev, skb->dev);
+ deliver_skb(skb2, pt_prev);
pt_prev = ptype;
continue;
}
@@ -1594,7 +1593,7 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
}
}
if (pt_prev)
- pt_prev->func(skb2, skb->dev, pt_prev, skb->dev);
+ pt_prev->func(skb2, skb->dev, pt_prev);
rcu_read_unlock();
}
@@ -3025,8 +3024,7 @@ static int ing_filter(struct sk_buff *skb, struct netdev_queue *rxq)
}
static inline struct sk_buff *handle_ing(struct sk_buff *skb,
- struct packet_type **pt_prev,
- int *ret, struct net_device *orig_dev)
+ struct packet_type **pt_prev, int *ret)
{
struct netdev_queue *rxq = rcu_dereference(skb->dev->ingress_queue);
@@ -3034,7 +3032,7 @@ static inline struct sk_buff *handle_ing(struct sk_buff *skb,
goto out;
if (*pt_prev) {
- *ret = deliver_skb(skb, *pt_prev, orig_dev);
+ *ret = deliver_skb(skb, *pt_prev);
*pt_prev = NULL;
}
@@ -3160,13 +3158,13 @@ another_round:
list_for_each_entry_rcu(ptype, &ptype_all, list) {
if (!ptype->dev || ptype->dev == skb->dev) {
if (pt_prev)
- ret = deliver_skb(skb, pt_prev, orig_dev);
+ ret = deliver_skb(skb, pt_prev);
pt_prev = ptype;
}
}
#ifdef CONFIG_NET_CLS_ACT
- skb = handle_ing(skb, &pt_prev, &ret, orig_dev);
+ skb = handle_ing(skb, &pt_prev, &ret);
if (!skb)
goto out;
ncls:
@@ -3175,7 +3173,7 @@ ncls:
rx_handler = rcu_dereference(skb->dev->rx_handler);
if (rx_handler) {
if (pt_prev) {
- ret = deliver_skb(skb, pt_prev, orig_dev);
+ ret = deliver_skb(skb, pt_prev);
pt_prev = NULL;
}
switch (rx_handler(&skb)) {
@@ -3194,7 +3192,7 @@ ncls:
if (vlan_tx_tag_present(skb)) {
if (pt_prev) {
- ret = deliver_skb(skb, pt_prev, orig_dev);
+ ret = deliver_skb(skb, pt_prev);
pt_prev = NULL;
}
if (vlan_hwaccel_do_receive(&skb)) {
@@ -3216,13 +3214,13 @@ ncls:
(ptype->dev == null_or_dev || ptype->dev == skb->dev ||
ptype->dev == orig_dev)) {
if (pt_prev)
- ret = deliver_skb(skb, pt_prev, orig_dev);
+ ret = deliver_skb(skb, pt_prev);
pt_prev = ptype;
}
}
if (pt_prev) {
- ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
+ ret = pt_prev->func(skb, skb->dev, pt_prev);
} else {
atomic_long_inc(&skb->dev->rx_dropped);
kfree_skb(skb);
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 2af15b1..1421721 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -2106,7 +2106,7 @@ static struct notifier_block dn_dev_notifier = {
.notifier_call = dn_device_event,
};
-extern int dn_route_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
+extern int dn_route_rcv(struct sk_buff *, struct net_device *, struct packet_type *);
static struct packet_type dn_dix_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_DNA_RT),
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 484fdbf..20abc79 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -588,7 +588,7 @@ static int dn_route_ptp_hello(struct sk_buff *skb)
return NET_RX_SUCCESS;
}
-int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
+int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
{
struct dn_skb_cb *cb;
unsigned char flags = 0;
diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c
index 98dfe80..56b686e 100644
--- a/net/dsa/tag_dsa.c
+++ b/net/dsa/tag_dsa.c
@@ -77,7 +77,7 @@ out_free:
}
static int dsa_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
struct dsa_switch_tree *dst = dev->dsa_ptr;
struct dsa_switch *ds;
diff --git a/net/dsa/tag_edsa.c b/net/dsa/tag_edsa.c
index 6f38332..474a955 100644
--- a/net/dsa/tag_edsa.c
+++ b/net/dsa/tag_edsa.c
@@ -90,7 +90,7 @@ out_free:
}
static int edsa_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
struct dsa_switch_tree *dst = dev->dsa_ptr;
struct dsa_switch *ds;
diff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c
index d6d7d0a..f8f36ad 100644
--- a/net/dsa/tag_trailer.c
+++ b/net/dsa/tag_trailer.c
@@ -67,7 +67,7 @@ netdev_tx_t trailer_xmit(struct sk_buff *skb, struct net_device *dev)
}
static int trailer_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
struct dsa_switch_tree *dst = dev->dsa_ptr;
struct dsa_switch *ds;
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index 0c28263..edeea09 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -1052,7 +1052,7 @@ release:
* Receive an Econet frame from a device.
*/
-static int econet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
+static int econet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
{
struct ec_framehdr *hdr;
struct sock *sk = NULL;
diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c
index 6df6ecf..68d5bce 100644
--- a/net/ieee802154/af_ieee802154.c
+++ b/net/ieee802154/af_ieee802154.c
@@ -299,7 +299,7 @@ static const struct net_proto_family ieee802154_family_ops = {
};
static int ieee802154_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
if (!netif_running(dev))
return -ENODEV;
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index fa9988d..53a8f14 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -974,7 +974,7 @@ static void parp_redo(struct sk_buff *skb)
*/
static int arp_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
struct arphdr *arp;
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index d7b2b09..639b69b 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -372,7 +372,7 @@ drop:
/*
* Main IP Receive routine.
*/
-int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
+int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
{
struct iphdr *iph;
u32 len;
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 2b09775..5669509 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -438,7 +438,8 @@ static int __init ic_defaults(void)
#ifdef IPCONFIG_RARP
-static int ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev);
+static int ic_rarp_recv(struct sk_buff *skb, struct net_device *dev,
+ struct packet_type *pt);
static struct packet_type rarp_packet_type __initdata = {
.type = cpu_to_be16(ETH_P_RARP),
@@ -458,8 +459,8 @@ static inline void __init ic_rarp_cleanup(void)
/*
* Process received RARP packet.
*/
-static int __init
-ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
+static int __init ic_rarp_recv(struct sk_buff *skb, struct net_device *dev,
+ struct packet_type *pt)
{
struct arphdr *rarp;
unsigned char *rarp_ptr;
@@ -600,7 +601,8 @@ struct bootp_pkt { /* BOOTP packet format */
#define DHCPRELEASE 7
#define DHCPINFORM 8
-static int ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev);
+static int ic_bootp_recv(struct sk_buff *skb, struct net_device *dev
+ struct packet_type *pt);
static struct packet_type bootp_packet_type __initdata = {
.type = cpu_to_be16(ETH_P_IP),
@@ -893,7 +895,8 @@ static void __init ic_do_bootp_ext(u8 *ext)
/*
* Receive BOOTP reply.
*/
-static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
+static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev,
+ struct packet_type *pt)
{
struct bootp_pkt *b;
struct iphdr *h;
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index a83e920..dd72591 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -55,7 +55,8 @@ inline int ip6_rcv_finish( struct sk_buff *skb)
return dst_input(skb);
}
-int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
+int ipv6_rcv(struct sk_buff *skb, struct net_device *dev,
+ struct packet_type *pt)
{
struct ipv6hdr *hdr;
u32 pkt_len;
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index da3d21c..614e207 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -1665,7 +1665,8 @@ static unsigned int ipx_datagram_poll(struct file *file, struct socket *sock,
return rc;
}
-static int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
+static int ipx_rcv(struct sk_buff *skb, struct net_device *dev,
+ struct packet_type *pt)
{
/* NULL here for pt means the packet was looped back */
struct ipx_interface *intrfc;
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c
index 688222c..7850321 100644
--- a/net/irda/irlap_frame.c
+++ b/net/irda/irlap_frame.c
@@ -1306,7 +1306,7 @@ static void irlap_recv_test_frame(struct irlap_cb *self, struct sk_buff *skb,
* Jean II
*/
int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *ptype, struct net_device *orig_dev)
+ struct packet_type *ptype)
{
struct irlap_info info;
struct irlap_cb *self;
diff --git a/net/llc/llc_core.c b/net/llc/llc_core.c
index 2bb0ddf..dfeda38 100644
--- a/net/llc/llc_core.c
+++ b/net/llc/llc_core.c
@@ -91,8 +91,7 @@ struct llc_sap *llc_sap_find(unsigned char sap_value)
struct llc_sap *llc_sap_open(unsigned char lsap,
int (*func)(struct sk_buff *skb,
struct net_device *dev,
- struct packet_type *pt,
- struct net_device *orig_dev))
+ struct packet_type *pt))
{
struct llc_sap *sap = NULL;
diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c
index 058f1e9..d884e23 100644
--- a/net/llc/llc_input.c
+++ b/net/llc/llc_input.c
@@ -143,13 +143,13 @@ static inline int llc_fixup_skb(struct sk_buff *skb)
* data now), it queues this frame in the connection's backlog.
*/
int llc_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
struct llc_sap *sap;
struct llc_pdu_sn *pdu;
int dest;
int (*rcv)(struct sk_buff *, struct net_device *,
- struct packet_type *, struct net_device *);
+ struct packet_type *);
if (!net_eq(dev_net(dev), &init_net))
goto drop;
@@ -184,14 +184,14 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev,
dest = llc_pdu_type(skb);
if (unlikely(!dest || !llc_type_handlers[dest - 1])) {
if (rcv)
- rcv(skb, dev, pt, orig_dev);
+ rcv(skb, dev, pt);
else
kfree_skb(skb);
} else {
if (rcv) {
struct sk_buff *cskb = skb_clone(skb, GFP_ATOMIC);
if (cskb)
- rcv(cskb, dev, pt, orig_dev);
+ rcv(cskb, dev, pt);
}
llc_type_handlers[dest - 1](sap, skb);
}
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index b34294e..85e2493 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -350,7 +350,7 @@ static const struct proto_ops packet_ops;
static const struct proto_ops packet_ops_spkt;
static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
struct sock *sk;
struct sockaddr_pkt *spkt;
@@ -557,7 +557,7 @@ static inline unsigned int run_filter(const struct sk_buff *skb,
*/
static int packet_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
struct sock *sk;
struct sockaddr_ll *sll;
@@ -667,7 +667,7 @@ drop:
}
static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
struct sock *sk;
struct packet_sock *po;
diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c
index 30cc676..2fb5bf2 100644
--- a/net/phonet/af_phonet.c
+++ b/net/phonet/af_phonet.c
@@ -372,8 +372,7 @@ static int send_reset_indications(struct sk_buff *rskb)
* On error, returns non-zero and releases the skb.
*/
static int phonet_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pkttype,
- struct net_device *orig_dev)
+ struct packet_type *pkttype)
{
struct net *net = dev_net(dev);
struct phonethdr *ph;
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c
index b69092e..21c8fe4 100644
--- a/net/tipc/eth_media.c
+++ b/net/tipc/eth_media.c
@@ -100,7 +100,7 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
*/
static int recv_msg(struct sk_buff *buf, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
+ struct packet_type *pt)
{
struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv;
diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c
index 9005f6d..4b049ec 100644
--- a/net/x25/x25_dev.c
+++ b/net/x25/x25_dev.c
@@ -92,7 +92,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb)
}
int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *ptype, struct net_device *orig_dev)
+ struct packet_type *ptype)
{
struct sk_buff *nskb;
struct x25_neigh *nb;
--
1.7.4
^ permalink raw reply related
* Re: [patch net-next-2.6] net: comment rx_handler results
From: Jiri Pirko @ 2011-03-05 15:37 UTC (permalink / raw)
To: Nicolas de Pesloüan
Cc: Ben Hutchings, netdev, davem, shemminger, kaber, fubar,
eric.dumazet, andy
In-Reply-To: <4D725678.2020706@gmail.com>
Sat, Mar 05, 2011 at 04:27:52PM CET, nicolas.2p.debian@gmail.com wrote:
>Le 05/03/2011 16:13, Jiri Pirko a écrit :
>>
>>Signed-off-by: Jiri Pirko<jpirko@redhat.com>
>>---
>> include/linux/netdevice.h | 12 ++++++++----
>> 1 files changed, 8 insertions(+), 4 deletions(-)
>>
>>diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>>index 48a9638..26e03f9 100644
>>--- a/include/linux/netdevice.h
>>+++ b/include/linux/netdevice.h
>>@@ -391,10 +391,14 @@ enum gro_result {
>> typedef enum gro_result gro_result_t;
>>
>> enum rx_handler_result {
>>- RX_HANDLER_CONSUMED,
>>- RX_HANDLER_ANOTHER,
>>- RX_HANDLER_EXACT,
>>- RX_HANDLER_PASS,
>>+ RX_HANDLER_CONSUMED, /* skb was consumed by rx_handler,
>>+ do not process it further. */
>>+ RX_HANDLER_ANOTHER, /* Do another round in receive path.
>>+ This is indicated in case skb->dev
>>+ was changed by rx_handler */
>>+ RX_HANDLER_EXACT, /* Force exact delivery, no wildcard */
>>+ RX_HANDLER_PASS, /* Do nothing, pass the skb as if
>>+ no rx_handler was called */
>
>Changing skb->dev should always cause another_round.
Not if you reinject the skb.
>
>So, RX_HANDLER_ANOTHER could be removed and replaced with a test for
>skb->dev change, with RX_HANDER_EXACT and RX_HANDLER_PASS.
That was there before. Needs extra variable and I think this way, via
results the code is much easier to read.
>
>> + RX_HANDLER_CONSUMED, /* skb was consumed by rx_handler,
>> + do not process it further. */
>> + RX_HANDLER_EXACT, /* Force exact delivery, no wildcard */
>> + RX_HANDLER_PASS, /* Do normal (wildcard and exact) delivery */
>
>And any rx_handler returning RX_HANDLER_EXACT should cause exact
>delivery, even if possible next rx_handlers return RX_HANDLER_PASS.
When rx_handler returns RX_HANDLER_EXACT, there will bo no other call to
any rx_handler (that is the case only when RX_HANDLER_ANOTHER is
returned)
>
> Nicolas.
^ permalink raw reply
* Re: [patch net-next-2.6] net: comment rx_handler results
From: Nicolas de Pesloüan @ 2011-03-05 15:50 UTC (permalink / raw)
To: Jiri Pirko
Cc: Ben Hutchings, netdev, davem, shemminger, kaber, fubar,
eric.dumazet, andy
In-Reply-To: <20110305153704.GI8573@psychotron.redhat.com>
Le 05/03/2011 16:37, Jiri Pirko a écrit :
> Sat, Mar 05, 2011 at 04:27:52PM CET, nicolas.2p.debian@gmail.com wrote:
>> Le 05/03/2011 16:13, Jiri Pirko a écrit :
>>>
>>> Signed-off-by: Jiri Pirko<jpirko@redhat.com>
>>> ---
>>> include/linux/netdevice.h | 12 ++++++++----
>>> 1 files changed, 8 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>>> index 48a9638..26e03f9 100644
>>> --- a/include/linux/netdevice.h
>>> +++ b/include/linux/netdevice.h
>>> @@ -391,10 +391,14 @@ enum gro_result {
>>> typedef enum gro_result gro_result_t;
>>>
>>> enum rx_handler_result {
>>> - RX_HANDLER_CONSUMED,
>>> - RX_HANDLER_ANOTHER,
>>> - RX_HANDLER_EXACT,
>>> - RX_HANDLER_PASS,
>>> + RX_HANDLER_CONSUMED, /* skb was consumed by rx_handler,
>>> + do not process it further. */
>>> + RX_HANDLER_ANOTHER, /* Do another round in receive path.
>>> + This is indicated in case skb->dev
>>> + was changed by rx_handler */
>>> + RX_HANDLER_EXACT, /* Force exact delivery, no wildcard */
>>> + RX_HANDLER_PASS, /* Do nothing, pass the skb as if
>>> + no rx_handler was called */
>>
>> Changing skb->dev should always cause another_round.
>
> Not if you reinject the skb.
>
>>
>> So, RX_HANDLER_ANOTHER could be removed and replaced with a test for
>> skb->dev change, with RX_HANDER_EXACT and RX_HANDLER_PASS.
>
> That was there before. Needs extra variable and I think this way, via
> results the code is much easier to read.
>
>>
>>> + RX_HANDLER_CONSUMED, /* skb was consumed by rx_handler,
>>> + do not process it further. */
>>> + RX_HANDLER_EXACT, /* Force exact delivery, no wildcard */
>>> + RX_HANDLER_PASS, /* Do normal (wildcard and exact) delivery */
>>
>> And any rx_handler returning RX_HANDLER_EXACT should cause exact
>> delivery, even if possible next rx_handlers return RX_HANDLER_PASS.
>
> When rx_handler returns RX_HANDLER_EXACT, there will bo no other call to
> any rx_handler (that is the case only when RX_HANDLER_ANOTHER is
> returned)
I agree, but we clearly need a kernel-doc that explain in more detail the expected behavior of every
return values.
Some examples, showing some normal and some stacking setups, would help, I think. One more follow-up
patch...
Reviewed-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
Nicolas.
^ permalink raw reply
* Re: [PATCH] net: mac80211: fix compilation warning
From: Larry Finger @ 2011-03-05 16:30 UTC (permalink / raw)
To: Jovi Zhang
Cc: Ben Hutchings, John W. Linville, Johannes Berg, David S. Miller,
open list:NETWORKING [WIREL..., open list:NETWORKING [GENERAL],
open list
In-Reply-To: <AANLkTimnSvBKSL6_d3RxufxUL_C9wCM+Fz66_B5Sc0KE@mail.gmail.com>
On 03/05/2011 07:52 AM, Jovi Zhang wrote:
> On Sat, Mar 5, 2011 at 8:31 PM, Ben Hutchings<bhutchings@solarflare.com> wrote:
>> On Wed, 2011-03-02 at 18:32 -0500, bookjovi@gmail.com wrote:
>>> From: Jovi Zhang<bookjovi@gmail.com>
>>>
>>> this commit fix compilation warning as following:
>>> net/mac80211/tx.c:1753: warning: unused variable mppath
>> [...]
>>
>> You clearly didn't try building this with CONFIG_MAC80211_MESH enabled.
>>
> Sorry, indeed, maybe should be like this:
>
> +#ifdef CONFIG_MAC80211_MESH
> struct mesh_path *mppath = NULL;
> +#endif
Linville likes "struct mesh_path *mppath __maybe_unused = NULL;" over the ifdef
form.
Larry
^ permalink raw reply
* Re: [patch net-next-2.6 1/8] af_packet: use skb->skb_iif instead of orig_dev->ifindex
From: Changli Gao @ 2011-03-05 16:34 UTC (permalink / raw)
To: Jiri Pirko
Cc: netdev, davem, shemminger, kaber, fubar, eric.dumazet,
nicolas.2p.debian, andy
In-Reply-To: <1299313794-5218-2-git-send-email-jpirko@redhat.com>
On Sat, Mar 5, 2011 at 4:29 PM, Jiri Pirko <jpirko@redhat.com> wrote:
> Since skb_iif has the desired value (ifindex of physical device actually
> received the traffic) use that instead.
>
It isn't true for the packets returned from a ifb pseudo NIC.
f.e.:
eth0 -(redirect)-> ifb0 ->
skb->skb_iff is ifb0->ifindex.
orig_dev = skb->dev = eth0.
However, these packets aren't processed by af_packet, so there isn't
any problem.
Reviewed-by: Changli Gao <xiaosuo@gmail.com>
--
Regards,
Changli Gao(xiaosuo@gmail.com)
^ permalink raw reply
* Re: [patch net-next-2.6 7/8] net: introduce rx_handler results and logic around that
From: Changli Gao @ 2011-03-05 16:45 UTC (permalink / raw)
To: Jiri Pirko
Cc: netdev, davem, shemminger, kaber, fubar, eric.dumazet,
nicolas.2p.debian, andy
In-Reply-To: <1299313794-5218-8-git-send-email-jpirko@redhat.com>
On Sat, Mar 5, 2011 at 4:29 PM, Jiri Pirko <jpirko@redhat.com> wrote:
>
> -typedef struct sk_buff *rx_handler_func_t(struct sk_buff *skb);
> +enum rx_handler_result {
> + RX_HANDLER_CONSUMED,
> + RX_HANDLER_ANOTHER,
> + RX_HANDLER_EXACT,
> + RX_HANDLER_PASS,
> +};
Why not extend the macros NET_RX_SUCCESS and NET_RX_DROP? Then the
callers of __netif_receive_skb() may get the right congestion info
from its return value.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
^ permalink raw reply
* Re: [patch net-next-2.6 8/8 v2] net: get rid of orig_dev parameter of packet handlers
From: Nicolas de Pesloüan @ 2011-03-05 16:56 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, davem, shemminger, kaber, fubar, eric.dumazet, andy
In-Reply-To: <20110305153247.GH8573@psychotron.redhat.com>
Le 05/03/2011 16:32, Jiri Pirko a écrit :
> Since orig_dev was used in af_packet (where it was replaced) and by
> bonding ptype handlers (which are no longer with us) only, orig_dev
> parameter is no longer needed -> toss it out
>
> Signed-off-by: Jiri Pirko<jpirko@redhat.com>
> Reviewed-by: Nicolas de Pesloüan<nicolas.2p.debian@free.fr>
>
[snip]
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 58daddb..c71bd18 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
[snip]
> @@ -3216,13 +3214,13 @@ ncls:
> (ptype->dev == null_or_dev || ptype->dev == skb->dev ||
> ptype->dev == orig_dev)) {
> if (pt_prev)
> - ret = deliver_skb(skb, pt_prev, orig_dev);
> + ret = deliver_skb(skb, pt_prev);
> pt_prev = ptype;
> }
> }
>
> if (pt_prev) {
> - ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
> + ret = pt_prev->func(skb, skb->dev, pt_prev);
> } else {
> atomic_long_inc(&skb->dev->rx_dropped);
> kfree_skb(skb);
This part does not properly apply on top of current net-next-2.6.
Line 3216 is currently
(ptype->dev == null_or_dev || ptype->dev == skb->dev)) {
Nicolas.
^ permalink raw reply
* Re: EPT: Misconfiguration
From: Ruben Kerkhof @ 2011-03-05 18:57 UTC (permalink / raw)
To: Avi Kivity; +Cc: Marcelo Tosatti, kvm, netdev
In-Reply-To: <4D6A2B91.5020100@redhat.com>
On Sun, Feb 27, 2011 at 11:46, Avi Kivity <avi@redhat.com> wrote:
>
> Copying netdev: looks like memory corruption in the networking stack.
>
> Archive link: http://www.spinics.net/lists/kvm/msg50651.html (for the
> attachment).
There's now only a single guest running on this host (Ubuntu Maverick).
I've also upgraded the host kernel to 2.6.38-rc6, and this just
happened (after a day or so):
2011-03-05T19:41:58.328866+01:00 phy005 kernel: [85271.656862] BUG
kmalloc-2048 (Not tainted): Object padding overwritten
2011-03-05T19:41:58.328870+01:00 phy005 kernel: [85271.656864]
-----------------------------------------------------------------------------
2011-03-05T19:41:58.328875+01:00 phy005 kernel: [85271.656866]
2011-03-05T19:41:58.328885+01:00 phy005 kernel: [85271.656870] INFO:
0xffff880c0d52a960-0xffff880c0d52a967. First byte 0x0 instead of 0x5a
2011-03-05T19:41:58.328890+01:00 phy005 kernel: [85271.656880] INFO:
Allocated in __netdev_alloc_skb+0x1f/0x3b age=16039 cpu=5 pid=0
2011-03-05T19:41:58.328894+01:00 phy005 kernel: [85271.656886] INFO:
Freed in skb_release_data+0xa5/0xaa age=0 cpu=5 pid=1766
2011-03-05T19:41:58.328898+01:00 phy005 kernel: [85271.656890] INFO:
Slab 0xffffea002a2ea0c0 objects=15 used=13 fp=0xffff880c0d52a120
flags=0xc00000000040c1
2011-03-05T19:41:58.328902+01:00 phy005 kernel: [85271.656894] INFO:
Object 0xffff880c0d52a120 @offset=8480 fp=0xffff880c0d52d2d0
2011-03-05T19:41:58.328905+01:00 phy005 kernel: [85271.656895]
2011-03-05T19:41:58.328909+01:00 phy005 kernel: [85271.656897] Bytes
b4 0xffff880c0d52a110: 14 89 12 05 01 00 00 00 5a 5a 5a 5a 5a 5a 5a
5a ........ZZZZZZZZ
2011-03-05T19:41:58.328913+01:00 phy005 kernel: [85271.656909]
Object 0xffff880c0d52a120: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b
6b 6b kkkkkkkkkkkkkkkk
We have a quite complex network stack, two interfaces (igb) attached
to bond0, with on top two bridges and on that two vlans.
The guest is running a vpn and an IPv6 tunnel.
Let me know if more info is needed.
Kind regards,
Ruben
^ permalink raw reply
* Possible regression in __netif_receive_skb() between 2.6.38-rc7 and net-next-2.6
From: Nicolas de Pesloüan @ 2011-03-05 21:30 UTC (permalink / raw)
To: netdev@vger.kernel.org
Cc: Jiri Pirko, David Miller, Stephen Hemminger, Jay Vosburgh,
Patrick Mc Hardy, Eric Dumazet, Andy Gospodarek
Hi,
Comparing __netif_receive_skb() between 2.6.38-rc7 and net-next-2.6, I noticed an important
difference: The ptype_base loop used to deliver to orig_dev and this is not true anymore.
[Note that this is unrelated to Jiri's today's patch that remove the orig_dev parameter to protocol
handler].
Imagine the following simple setup:
eth0 -> bond0
- A packet handler registered on eth0, with ptype->type == NULL will receive the packet, because it
will be delivered in the ptype_all loop, which is inside the another_round loop.
- The same packet handler, registered on eth0, but with ptype->type != NULL won't receive the
packet, because the ptype_base loop doesn't deliver to orig_dev anymore.
I think this can lead to a regression for user space: an application using af_packet to listen to
eth0 will receive the packet flow if the registered protocol is NULL, but won't receive anything if
the registered protocol is not NULL.
Can someone confirm?
Nicolas.
^ permalink raw reply
* Re: [patch net-next-2.6 8/8 v2] net: get rid of orig_dev parameter of packet handlers
From: Jiri Pirko @ 2011-03-05 22:07 UTC (permalink / raw)
To: Nicolas de Pesloüan
Cc: netdev, davem, shemminger, kaber, fubar, eric.dumazet, andy
In-Reply-To: <4D726B38.4040403@gmail.com>
Sat, Mar 05, 2011 at 05:56:24PM CET, nicolas.2p.debian@gmail.com wrote:
>Le 05/03/2011 16:32, Jiri Pirko a écrit :
>>Since orig_dev was used in af_packet (where it was replaced) and by
>>bonding ptype handlers (which are no longer with us) only, orig_dev
>>parameter is no longer needed -> toss it out
>>
>>Signed-off-by: Jiri Pirko<jpirko@redhat.com>
>>Reviewed-by: Nicolas de Pesloüan<nicolas.2p.debian@free.fr>
>>
>[snip]
>
>>diff --git a/net/core/dev.c b/net/core/dev.c
>>index 58daddb..c71bd18 100644
>>--- a/net/core/dev.c
>>+++ b/net/core/dev.c
>[snip]
>>@@ -3216,13 +3214,13 @@ ncls:
>> (ptype->dev == null_or_dev || ptype->dev == skb->dev ||
>> ptype->dev == orig_dev)) {
>> if (pt_prev)
>>- ret = deliver_skb(skb, pt_prev, orig_dev);
>>+ ret = deliver_skb(skb, pt_prev);
>> pt_prev = ptype;
>> }
>> }
>>
>> if (pt_prev) {
>>- ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
>>+ ret = pt_prev->func(skb, skb->dev, pt_prev);
>> } else {
>> atomic_long_inc(&skb->dev->rx_dropped);
>> kfree_skb(skb);
>
>This part does not properly apply on top of current net-next-2.6.
>
>Line 3216 is currently
>
> (ptype->dev == null_or_dev || ptype->dev == skb->dev)) {
>
> Nicolas.
depends on "net: allow handlers to be processed for orig_dev" which is a
regression fixer
^ permalink raw reply
* Re: Possible regression in __netif_receive_skb() between 2.6.38-rc7 and net-next-2.6
From: Jiri Pirko @ 2011-03-05 22:09 UTC (permalink / raw)
To: Nicolas de Pesloüan
Cc: netdev@vger.kernel.org, David Miller, Stephen Hemminger,
Jay Vosburgh, Patrick Mc Hardy, Eric Dumazet, Andy Gospodarek
In-Reply-To: <4D72AB79.3000605@gmail.com>
Sat, Mar 05, 2011 at 10:30:33PM CET, nicolas.2p.debian@gmail.com wrote:
>Hi,
>
>Comparing __netif_receive_skb() between 2.6.38-rc7 and net-next-2.6,
>I noticed an important difference: The ptype_base loop used to
>deliver to orig_dev and this is not true anymore.
I believe this is adressed by submitted patch " net: allow handlers to
be processed for orig_dev"
>
>[Note that this is unrelated to Jiri's today's patch that remove the
>orig_dev parameter to protocol handler].
>
>Imagine the following simple setup:
>
>eth0 -> bond0
>
>- A packet handler registered on eth0, with ptype->type == NULL will
>receive the packet, because it will be delivered in the ptype_all
>loop, which is inside the another_round loop.
>- The same packet handler, registered on eth0, but with ptype->type
>!= NULL won't receive the packet, because the ptype_base loop doesn't
>deliver to orig_dev anymore.
>
>I think this can lead to a regression for user space: an application
>using af_packet to listen to eth0 will receive the packet flow if the
>registered protocol is NULL, but won't receive anything if the
>registered protocol is not NULL.
>
>Can someone confirm?
>
> Nicolas.
^ permalink raw reply
* Re: [patch net-next-2.6 8/8 v2] net: get rid of orig_dev parameter of packet handlers
From: Nicolas de Pesloüan @ 2011-03-05 22:18 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, davem, shemminger, kaber, fubar, eric.dumazet, andy
In-Reply-To: <20110305220752.GJ8573@psychotron.redhat.com>
Le 05/03/2011 23:07, Jiri Pirko a écrit :
> Sat, Mar 05, 2011 at 05:56:24PM CET, nicolas.2p.debian@gmail.com wrote:
>> Le 05/03/2011 16:32, Jiri Pirko a écrit :
>>> Since orig_dev was used in af_packet (where it was replaced) and by
>>> bonding ptype handlers (which are no longer with us) only, orig_dev
>>> parameter is no longer needed -> toss it out
>>>
>>> Signed-off-by: Jiri Pirko<jpirko@redhat.com>
>>> Reviewed-by: Nicolas de Pesloüan<nicolas.2p.debian@free.fr>
>>>
>> [snip]
>>
>>> diff --git a/net/core/dev.c b/net/core/dev.c
>>> index 58daddb..c71bd18 100644
>>> --- a/net/core/dev.c
>>> +++ b/net/core/dev.c
>> [snip]
>>> @@ -3216,13 +3214,13 @@ ncls:
>>> (ptype->dev == null_or_dev || ptype->dev == skb->dev ||
>>> ptype->dev == orig_dev)) {
>>> if (pt_prev)
>>> - ret = deliver_skb(skb, pt_prev, orig_dev);
>>> + ret = deliver_skb(skb, pt_prev);
>>> pt_prev = ptype;
>>> }
>>> }
>>>
>>> if (pt_prev) {
>>> - ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
>>> + ret = pt_prev->func(skb, skb->dev, pt_prev);
>>> } else {
>>> atomic_long_inc(&skb->dev->rx_dropped);
>>> kfree_skb(skb);
>>
>> This part does not properly apply on top of current net-next-2.6.
>>
>> Line 3216 is currently
>>
>> (ptype->dev == null_or_dev || ptype->dev == skb->dev)) {
>>
>> Nicolas.
>
>
> depends on "net: allow handlers to be processed for orig_dev" which is a
> regression fixer
>
You are right. I reviewed this patch. :-)
^ permalink raw reply
* [stable-2.6.32.y] ixgbe: fix for 82599 erratum on Header Splitting
From: Jeff Kirsher @ 2011-03-05 23:14 UTC (permalink / raw)
To: gregkh; +Cc: Don Skidmore, stable, netdev, Jeff Kirsher
From: Don Skidmore <donald.c.skidmore@intel.com>
We have found a hardware erratum on 82599 hardware that can lead to
unpredictable behavior when Header Splitting mode is enabled. So
we are no longer enabling this feature on affected hardware.
This is an updated version of the following commit which applies to the stable
linux-2.6.32.y tree:
commit a124339ad28389093ed15eca990d39c51c5736cc
Author: Don Skidmore <donald.c.skidmore@intel.com>
Date: Tue Jan 18 22:53:47 2011 +0000
ixgbe: fix for 82599 erratum on Header Splitting
Please aaply this for the .32 longterm tree.
Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com>
Tested-by: Stephen Ko <stephen.s.ko@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ixgbe/ixgbe_main.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index a873c5d..67d1d97 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2131,6 +2131,10 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
/* Decide whether to use packet split mode or not */
adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED;
+ /* Disable packet split due to 82599 erratum #45 */
+ if (hw->mac.type == ixgbe_mac_82599EB)
+ adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED;
+
/* Set the RX buffer length according to the mode */
if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) {
rx_buf_len = IXGBE_RX_HDR_SIZE;
--
1.7.4
^ permalink raw reply related
* [patch v2 ] IPVS: Conditionally include sysctl code
From: Simon Horman @ 2011-03-05 23:45 UTC (permalink / raw)
To: netdev, netfilter-devel, netfilter, lvs-devel
Cc: Julian Anastasov, Hans Schillstrom
In the case where CONFIG_SYSCTL is undefined related
control code in IPVS is unnecessary. This patch series
attempts to make the inclusion of all such code
conditional on CONFIG_SYSCTL.
The first 4 patches in this series is Julian's series
"[PATCH 0/4] ipvs: changes for stats" which are required
for many of the subsequent changes.
The changes are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/horms/lvs-test-2.6.git config-sysctl2
At this point I would like to merge both Julian's patches
and my changes.
If this series is successful I will examine what if any similar
changes are appropriate for the case where CONFIG_PROC_FS is undefined.
Julian Anastasov (4):
ipvs: move struct netns_ipvs
ipvs: reorganize tot_stats
ipvs: zero percpu stats
ipvs: remove unused seqcount stats
Simon Horman (14):
IPVS: Add ip_vs_route_me_harder()
IPVS: Add sysctl_snat_reroute()
IPVS: Add sysctl_nat_icmp_send()
IPVS: Add {sysctl_sync_threshold,period}()
IPVS: Add sysctl_sync_ver()
IPVS: Add sysctl_expire_nodest_conn()
IPVS: Add expire_quiescent_template()
IPVS: Conditinally use sysctl_lblc{r}_expiration
IPVS: ip_vs_todrop() becomes a noop when CONFIG_SYSCTL is undefined
IPVS: Conditional ip_vs_conntrack_enabled()
IPVS: Minimise ip_vs_leave when CONFIG_SYSCTL is undefined
IPVS: Conditionally define and use ip_vs_lblc{r}_table
IPVS: Add __ip_vs_control_{init,cleanup}_sysctl()
IPVS: Conditionally include sysctl members of struct netns_ipvs
include/net/ip_vs.h | 189 ++++++++++++++++++++++++++++++++++---
include/net/net_namespace.h | 2 +-
include/net/netns/ip_vs.h | 143 ----------------------------
net/netfilter/ipvs/ip_vs_conn.c | 13 ++-
net/netfilter/ipvs/ip_vs_core.c | 104 +++++++++++++--------
net/netfilter/ipvs/ip_vs_ctl.c | 158 ++++++++++++++++++++-----------
net/netfilter/ipvs/ip_vs_est.c | 3 +-
net/netfilter/ipvs/ip_vs_lblc.c | 31 +++++--
net/netfilter/ipvs/ip_vs_lblcr.c | 35 +++++--
net/netfilter/ipvs/ip_vs_sync.c | 8 +-
10 files changed, 404 insertions(+), 282 deletions(-)
delete mode 100644 include/net/netns/ip_vs.h
^ permalink raw reply
* [PATCH 01/18] ipvs: move struct netns_ipvs
From: Simon Horman @ 2011-03-05 23:45 UTC (permalink / raw)
To: netdev, netfilter-devel, netfilter, lvs-devel
Cc: Julian Anastasov, Hans Schillstrom, Simon Horman
In-Reply-To: <1299368760-14271-1-git-send-email-horms@verge.net.au>
From: Julian Anastasov <ja@ssi.bg>
Remove include/net/netns/ip_vs.h because it depends on
structures from include/net/ip_vs.h. As ipvs is pointer in
struct net it is better to move struct netns_ipvs into
include/net/ip_vs.h, so that we can easily use other structures
in struct netns_ipvs.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
include/net/ip_vs.h | 122 ++++++++++++++++++++++++++++++++++++
include/net/net_namespace.h | 2 +-
include/net/netns/ip_vs.h | 143 -------------------------------------------
3 files changed, 123 insertions(+), 144 deletions(-)
delete mode 100644 include/net/netns/ip_vs.h
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index e74da41e..7280661 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -803,6 +803,128 @@ struct ip_vs_app {
void (*timeout_change)(struct ip_vs_app *app, int flags);
};
+/* IPVS in network namespace */
+struct netns_ipvs {
+ int gen; /* Generation */
+ /*
+ * Hash table: for real service lookups
+ */
+ #define IP_VS_RTAB_BITS 4
+ #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS)
+ #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1)
+
+ struct list_head rs_table[IP_VS_RTAB_SIZE];
+ /* ip_vs_app */
+ struct list_head app_list;
+ struct mutex app_mutex;
+ struct lock_class_key app_key; /* mutex debuging */
+
+ /* ip_vs_proto */
+ #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */
+ struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE];
+ /* ip_vs_proto_tcp */
+#ifdef CONFIG_IP_VS_PROTO_TCP
+ #define TCP_APP_TAB_BITS 4
+ #define TCP_APP_TAB_SIZE (1 << TCP_APP_TAB_BITS)
+ #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1)
+ struct list_head tcp_apps[TCP_APP_TAB_SIZE];
+ spinlock_t tcp_app_lock;
+#endif
+ /* ip_vs_proto_udp */
+#ifdef CONFIG_IP_VS_PROTO_UDP
+ #define UDP_APP_TAB_BITS 4
+ #define UDP_APP_TAB_SIZE (1 << UDP_APP_TAB_BITS)
+ #define UDP_APP_TAB_MASK (UDP_APP_TAB_SIZE - 1)
+ struct list_head udp_apps[UDP_APP_TAB_SIZE];
+ spinlock_t udp_app_lock;
+#endif
+ /* ip_vs_proto_sctp */
+#ifdef CONFIG_IP_VS_PROTO_SCTP
+ #define SCTP_APP_TAB_BITS 4
+ #define SCTP_APP_TAB_SIZE (1 << SCTP_APP_TAB_BITS)
+ #define SCTP_APP_TAB_MASK (SCTP_APP_TAB_SIZE - 1)
+ /* Hash table for SCTP application incarnations */
+ struct list_head sctp_apps[SCTP_APP_TAB_SIZE];
+ spinlock_t sctp_app_lock;
+#endif
+ /* ip_vs_conn */
+ atomic_t conn_count; /* connection counter */
+
+ /* ip_vs_ctl */
+ struct ip_vs_stats *tot_stats; /* Statistics & est. */
+ struct ip_vs_cpu_stats __percpu *cpustats; /* Stats per cpu */
+ seqcount_t *ustats_seq; /* u64 read retry */
+
+ int num_services; /* no of virtual services */
+ /* 1/rate drop and drop-entry variables */
+ struct delayed_work defense_work; /* Work handler */
+ int drop_rate;
+ int drop_counter;
+ atomic_t dropentry;
+ /* locks in ctl.c */
+ spinlock_t dropentry_lock; /* drop entry handling */
+ spinlock_t droppacket_lock; /* drop packet handling */
+ spinlock_t securetcp_lock; /* state and timeout tables */
+ rwlock_t rs_lock; /* real services table */
+ /* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */
+ struct lock_class_key ctl_key; /* ctl_mutex debuging */
+ /* Trash for destinations */
+ struct list_head dest_trash;
+ /* Service counters */
+ atomic_t ftpsvc_counter;
+ atomic_t nullsvc_counter;
+
+ /* sys-ctl struct */
+ struct ctl_table_header *sysctl_hdr;
+ struct ctl_table *sysctl_tbl;
+ /* sysctl variables */
+ int sysctl_amemthresh;
+ int sysctl_am_droprate;
+ int sysctl_drop_entry;
+ int sysctl_drop_packet;
+ int sysctl_secure_tcp;
+#ifdef CONFIG_IP_VS_NFCT
+ int sysctl_conntrack;
+#endif
+ int sysctl_snat_reroute;
+ int sysctl_sync_ver;
+ int sysctl_cache_bypass;
+ int sysctl_expire_nodest_conn;
+ int sysctl_expire_quiescent_template;
+ int sysctl_sync_threshold[2];
+ int sysctl_nat_icmp_send;
+
+ /* ip_vs_lblc */
+ int sysctl_lblc_expiration;
+ struct ctl_table_header *lblc_ctl_header;
+ struct ctl_table *lblc_ctl_table;
+ /* ip_vs_lblcr */
+ int sysctl_lblcr_expiration;
+ struct ctl_table_header *lblcr_ctl_header;
+ struct ctl_table *lblcr_ctl_table;
+ /* ip_vs_est */
+ struct list_head est_list; /* estimator list */
+ spinlock_t est_lock;
+ struct timer_list est_timer; /* Estimation timer */
+ /* ip_vs_sync */
+ struct list_head sync_queue;
+ spinlock_t sync_lock;
+ struct ip_vs_sync_buff *sync_buff;
+ spinlock_t sync_buff_lock;
+ struct sockaddr_in sync_mcast_addr;
+ struct task_struct *master_thread;
+ struct task_struct *backup_thread;
+ int send_mesg_maxlen;
+ int recv_mesg_maxlen;
+ volatile int sync_state;
+ volatile int master_syncid;
+ volatile int backup_syncid;
+ /* multicast interface name */
+ char master_mcast_ifn[IP_VS_IFNAME_MAXLEN];
+ char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
+ /* net name space ptr */
+ struct net *net; /* Needed by timer routines */
+};
/*
* IPVS core functions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index b3b4a34..3ae4919 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -20,7 +20,6 @@
#include <net/netns/conntrack.h>
#endif
#include <net/netns/xfrm.h>
-#include <net/netns/ip_vs.h>
struct proc_dir_entry;
struct net_device;
@@ -28,6 +27,7 @@ struct sock;
struct ctl_table_header;
struct net_generic;
struct sock;
+struct netns_ipvs;
#define NETDEV_HASHBITS 8
diff --git a/include/net/netns/ip_vs.h b/include/net/netns/ip_vs.h
deleted file mode 100644
index 259ebac..0000000
--- a/include/net/netns/ip_vs.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * IP Virtual Server
- * Data structure for network namspace
- *
- */
-
-#ifndef IP_VS_H_
-#define IP_VS_H_
-
-#include <linux/list.h>
-#include <linux/mutex.h>
-#include <linux/list_nulls.h>
-#include <linux/ip_vs.h>
-#include <asm/atomic.h>
-#include <linux/in.h>
-
-struct ip_vs_stats;
-struct ip_vs_sync_buff;
-struct ctl_table_header;
-
-struct netns_ipvs {
- int gen; /* Generation */
- /*
- * Hash table: for real service lookups
- */
- #define IP_VS_RTAB_BITS 4
- #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS)
- #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1)
-
- struct list_head rs_table[IP_VS_RTAB_SIZE];
- /* ip_vs_app */
- struct list_head app_list;
- struct mutex app_mutex;
- struct lock_class_key app_key; /* mutex debuging */
-
- /* ip_vs_proto */
- #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */
- struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE];
- /* ip_vs_proto_tcp */
-#ifdef CONFIG_IP_VS_PROTO_TCP
- #define TCP_APP_TAB_BITS 4
- #define TCP_APP_TAB_SIZE (1 << TCP_APP_TAB_BITS)
- #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1)
- struct list_head tcp_apps[TCP_APP_TAB_SIZE];
- spinlock_t tcp_app_lock;
-#endif
- /* ip_vs_proto_udp */
-#ifdef CONFIG_IP_VS_PROTO_UDP
- #define UDP_APP_TAB_BITS 4
- #define UDP_APP_TAB_SIZE (1 << UDP_APP_TAB_BITS)
- #define UDP_APP_TAB_MASK (UDP_APP_TAB_SIZE - 1)
- struct list_head udp_apps[UDP_APP_TAB_SIZE];
- spinlock_t udp_app_lock;
-#endif
- /* ip_vs_proto_sctp */
-#ifdef CONFIG_IP_VS_PROTO_SCTP
- #define SCTP_APP_TAB_BITS 4
- #define SCTP_APP_TAB_SIZE (1 << SCTP_APP_TAB_BITS)
- #define SCTP_APP_TAB_MASK (SCTP_APP_TAB_SIZE - 1)
- /* Hash table for SCTP application incarnations */
- struct list_head sctp_apps[SCTP_APP_TAB_SIZE];
- spinlock_t sctp_app_lock;
-#endif
- /* ip_vs_conn */
- atomic_t conn_count; /* connection counter */
-
- /* ip_vs_ctl */
- struct ip_vs_stats *tot_stats; /* Statistics & est. */
- struct ip_vs_cpu_stats __percpu *cpustats; /* Stats per cpu */
- seqcount_t *ustats_seq; /* u64 read retry */
-
- int num_services; /* no of virtual services */
- /* 1/rate drop and drop-entry variables */
- struct delayed_work defense_work; /* Work handler */
- int drop_rate;
- int drop_counter;
- atomic_t dropentry;
- /* locks in ctl.c */
- spinlock_t dropentry_lock; /* drop entry handling */
- spinlock_t droppacket_lock; /* drop packet handling */
- spinlock_t securetcp_lock; /* state and timeout tables */
- rwlock_t rs_lock; /* real services table */
- /* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */
- struct lock_class_key ctl_key; /* ctl_mutex debuging */
- /* Trash for destinations */
- struct list_head dest_trash;
- /* Service counters */
- atomic_t ftpsvc_counter;
- atomic_t nullsvc_counter;
-
- /* sys-ctl struct */
- struct ctl_table_header *sysctl_hdr;
- struct ctl_table *sysctl_tbl;
- /* sysctl variables */
- int sysctl_amemthresh;
- int sysctl_am_droprate;
- int sysctl_drop_entry;
- int sysctl_drop_packet;
- int sysctl_secure_tcp;
-#ifdef CONFIG_IP_VS_NFCT
- int sysctl_conntrack;
-#endif
- int sysctl_snat_reroute;
- int sysctl_sync_ver;
- int sysctl_cache_bypass;
- int sysctl_expire_nodest_conn;
- int sysctl_expire_quiescent_template;
- int sysctl_sync_threshold[2];
- int sysctl_nat_icmp_send;
-
- /* ip_vs_lblc */
- int sysctl_lblc_expiration;
- struct ctl_table_header *lblc_ctl_header;
- struct ctl_table *lblc_ctl_table;
- /* ip_vs_lblcr */
- int sysctl_lblcr_expiration;
- struct ctl_table_header *lblcr_ctl_header;
- struct ctl_table *lblcr_ctl_table;
- /* ip_vs_est */
- struct list_head est_list; /* estimator list */
- spinlock_t est_lock;
- struct timer_list est_timer; /* Estimation timer */
- /* ip_vs_sync */
- struct list_head sync_queue;
- spinlock_t sync_lock;
- struct ip_vs_sync_buff *sync_buff;
- spinlock_t sync_buff_lock;
- struct sockaddr_in sync_mcast_addr;
- struct task_struct *master_thread;
- struct task_struct *backup_thread;
- int send_mesg_maxlen;
- int recv_mesg_maxlen;
- volatile int sync_state;
- volatile int master_syncid;
- volatile int backup_syncid;
- /* multicast interface name */
- char master_mcast_ifn[IP_VS_IFNAME_MAXLEN];
- char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
- /* net name space ptr */
- struct net *net; /* Needed by timer routines */
-};
^ permalink raw reply related
* [PATCH 02/18] ipvs: reorganize tot_stats
From: Simon Horman @ 2011-03-05 23:45 UTC (permalink / raw)
To: netdev, netfilter-devel, netfilter, lvs-devel
Cc: Julian Anastasov, Hans Schillstrom, Simon Horman
In-Reply-To: <1299368760-14271-1-git-send-email-horms@verge.net.au>
From: Julian Anastasov <ja@ssi.bg>
The global tot_stats contains cpustats field just like the
stats for dest and svc, so better use it to simplify the usage
in estimation_timer. As tot_stats is registered as estimator
we can remove the special ip_vs_read_cpu_stats call for
tot_stats. Fix ip_vs_read_cpu_stats to be called under
stats lock because it is still used as synchronization between
estimation timer and user context (the stats readers).
Also, make sure ip_vs_stats_percpu_show reads properly
the u64 stats from user context.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
include/net/ip_vs.h | 3 +-
net/netfilter/ipvs/ip_vs_core.c | 6 ++--
net/netfilter/ipvs/ip_vs_ctl.c | 45 ++++++++++++++++++++------------------
net/netfilter/ipvs/ip_vs_est.c | 3 +-
4 files changed, 29 insertions(+), 28 deletions(-)
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 7280661..f17841d 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -851,8 +851,7 @@ struct netns_ipvs {
atomic_t conn_count; /* connection counter */
/* ip_vs_ctl */
- struct ip_vs_stats *tot_stats; /* Statistics & est. */
- struct ip_vs_cpu_stats __percpu *cpustats; /* Stats per cpu */
+ struct ip_vs_stats tot_stats; /* Statistics & est. */
seqcount_t *ustats_seq; /* u64 read retry */
int num_services; /* no of virtual services */
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 2d1f932..6f4940e 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -132,7 +132,7 @@ ip_vs_in_stats(struct ip_vs_conn *cp, struct sk_buff *skb)
s->ustats.inbytes += skb->len;
u64_stats_update_end(&s->syncp);
- s = this_cpu_ptr(ipvs->cpustats);
+ s = this_cpu_ptr(ipvs->tot_stats.cpustats);
s->ustats.inpkts++;
u64_stats_update_begin(&s->syncp);
s->ustats.inbytes += skb->len;
@@ -162,7 +162,7 @@ ip_vs_out_stats(struct ip_vs_conn *cp, struct sk_buff *skb)
s->ustats.outbytes += skb->len;
u64_stats_update_end(&s->syncp);
- s = this_cpu_ptr(ipvs->cpustats);
+ s = this_cpu_ptr(ipvs->tot_stats.cpustats);
s->ustats.outpkts++;
u64_stats_update_begin(&s->syncp);
s->ustats.outbytes += skb->len;
@@ -183,7 +183,7 @@ ip_vs_conn_stats(struct ip_vs_conn *cp, struct ip_vs_service *svc)
s = this_cpu_ptr(svc->stats.cpustats);
s->ustats.conns++;
- s = this_cpu_ptr(ipvs->cpustats);
+ s = this_cpu_ptr(ipvs->tot_stats.cpustats);
s->ustats.conns++;
}
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index f0369d6..a2a67ad 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -1481,7 +1481,7 @@ static int ip_vs_zero_all(struct net *net)
}
}
- ip_vs_zero_stats(net_ipvs(net)->tot_stats);
+ ip_vs_zero_stats(&net_ipvs(net)->tot_stats);
return 0;
}
@@ -1963,7 +1963,7 @@ static const struct file_operations ip_vs_info_fops = {
static int ip_vs_stats_show(struct seq_file *seq, void *v)
{
struct net *net = seq_file_single_net(seq);
- struct ip_vs_stats *tot_stats = net_ipvs(net)->tot_stats;
+ struct ip_vs_stats *tot_stats = &net_ipvs(net)->tot_stats;
/* 01234567 01234567 01234567 0123456701234567 0123456701234567 */
seq_puts(seq,
@@ -2007,7 +2007,8 @@ static const struct file_operations ip_vs_stats_fops = {
static int ip_vs_stats_percpu_show(struct seq_file *seq, void *v)
{
struct net *net = seq_file_single_net(seq);
- struct ip_vs_stats *tot_stats = net_ipvs(net)->tot_stats;
+ struct ip_vs_stats *tot_stats = &net_ipvs(net)->tot_stats;
+ struct ip_vs_cpu_stats *cpustats = tot_stats->cpustats;
int i;
/* 01234567 01234567 01234567 0123456701234567 0123456701234567 */
@@ -2017,11 +2018,20 @@ static int ip_vs_stats_percpu_show(struct seq_file *seq, void *v)
"CPU Conns Packets Packets Bytes Bytes\n");
for_each_possible_cpu(i) {
- struct ip_vs_cpu_stats *u = per_cpu_ptr(net->ipvs->cpustats, i);
+ struct ip_vs_cpu_stats *u = per_cpu_ptr(cpustats, i);
+ unsigned int start;
+ __u64 inbytes, outbytes;
+
+ do {
+ start = u64_stats_fetch_begin_bh(&u->syncp);
+ inbytes = u->ustats.inbytes;
+ outbytes = u->ustats.outbytes;
+ } while (u64_stats_fetch_retry_bh(&u->syncp, start));
+
seq_printf(seq, "%3X %8X %8X %8X %16LX %16LX\n",
- i, u->ustats.conns, u->ustats.inpkts,
- u->ustats.outpkts, (__u64)u->ustats.inbytes,
- (__u64)u->ustats.outbytes);
+ i, u->ustats.conns, u->ustats.inpkts,
+ u->ustats.outpkts, (__u64)inbytes,
+ (__u64)outbytes);
}
spin_lock_bh(&tot_stats->lock);
@@ -3505,17 +3515,12 @@ int __net_init __ip_vs_control_init(struct net *net)
atomic_set(&ipvs->nullsvc_counter, 0);
/* procfs stats */
- ipvs->tot_stats = kzalloc(sizeof(struct ip_vs_stats), GFP_KERNEL);
- if (ipvs->tot_stats == NULL) {
- pr_err("%s(): no memory.\n", __func__);
- return -ENOMEM;
- }
- ipvs->cpustats = alloc_percpu(struct ip_vs_cpu_stats);
- if (!ipvs->cpustats) {
+ ipvs->tot_stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats);
+ if (!ipvs->tot_stats.cpustats) {
pr_err("%s() alloc_percpu failed\n", __func__);
goto err_alloc;
}
- spin_lock_init(&ipvs->tot_stats->lock);
+ spin_lock_init(&ipvs->tot_stats.lock);
proc_net_fops_create(net, "ip_vs", 0, &ip_vs_info_fops);
proc_net_fops_create(net, "ip_vs_stats", 0, &ip_vs_stats_fops);
@@ -3563,7 +3568,7 @@ int __net_init __ip_vs_control_init(struct net *net)
goto err_dup;
}
#endif
- ip_vs_new_estimator(net, ipvs->tot_stats);
+ ip_vs_new_estimator(net, &ipvs->tot_stats);
ipvs->sysctl_tbl = tbl;
/* Schedule defense work */
INIT_DELAYED_WORK(&ipvs->defense_work, defense_work_handler);
@@ -3571,9 +3576,8 @@ int __net_init __ip_vs_control_init(struct net *net)
return 0;
err_dup:
- free_percpu(ipvs->cpustats);
+ free_percpu(ipvs->tot_stats.cpustats);
err_alloc:
- kfree(ipvs->tot_stats);
return -ENOMEM;
}
@@ -3582,7 +3586,7 @@ static void __net_exit __ip_vs_control_cleanup(struct net *net)
struct netns_ipvs *ipvs = net_ipvs(net);
ip_vs_trash_cleanup(net);
- ip_vs_kill_estimator(net, ipvs->tot_stats);
+ ip_vs_kill_estimator(net, &ipvs->tot_stats);
cancel_delayed_work_sync(&ipvs->defense_work);
cancel_work_sync(&ipvs->defense_work.work);
#ifdef CONFIG_SYSCTL
@@ -3591,8 +3595,7 @@ static void __net_exit __ip_vs_control_cleanup(struct net *net)
proc_net_remove(net, "ip_vs_stats_percpu");
proc_net_remove(net, "ip_vs_stats");
proc_net_remove(net, "ip_vs");
- free_percpu(ipvs->cpustats);
- kfree(ipvs->tot_stats);
+ free_percpu(ipvs->tot_stats.cpustats);
}
static struct pernet_operations ipvs_control_ops = {
diff --git a/net/netfilter/ipvs/ip_vs_est.c b/net/netfilter/ipvs/ip_vs_est.c
index 88bd716..b3751cf 100644
--- a/net/netfilter/ipvs/ip_vs_est.c
+++ b/net/netfilter/ipvs/ip_vs_est.c
@@ -101,13 +101,12 @@ static void estimation_timer(unsigned long arg)
struct netns_ipvs *ipvs;
ipvs = net_ipvs(net);
- ip_vs_read_cpu_stats(&ipvs->tot_stats->ustats, ipvs->cpustats);
spin_lock(&ipvs->est_lock);
list_for_each_entry(e, &ipvs->est_list, list) {
s = container_of(e, struct ip_vs_stats, est);
- ip_vs_read_cpu_stats(&s->ustats, s->cpustats);
spin_lock(&s->lock);
+ ip_vs_read_cpu_stats(&s->ustats, s->cpustats);
n_conns = s->ustats.conns;
n_inpkts = s->ustats.inpkts;
n_outpkts = s->ustats.outpkts;
--
1.7.2.3
^ permalink raw reply related
* [PATCH 05/18] IPVS: Add ip_vs_route_me_harder()
From: Simon Horman @ 2011-03-05 23:45 UTC (permalink / raw)
To: netdev, netfilter-devel, netfilter, lvs-devel
Cc: Julian Anastasov, Hans Schillstrom, Simon Horman
In-Reply-To: <1299368760-14271-1-git-send-email-horms@verge.net.au>
Add ip_vs_route_me_harder() to avoid repeating the same code twice.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
net/netfilter/ipvs/ip_vs_core.c | 48 +++++++++++++++++---------------------
1 files changed, 22 insertions(+), 26 deletions(-)
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 6f4940e..299c7f3 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -631,6 +631,24 @@ static inline int ip_vs_gather_frags_v6(struct sk_buff *skb, u_int32_t user)
}
#endif
+static int ip_vs_route_me_harder(int af, struct sk_buff *skb)
+{
+ struct netns_ipvs *ipvs = net_ipvs(skb_net(skb));
+
+#ifdef CONFIG_IP_VS_IPV6
+ if (af == AF_INET6) {
+ if (ipvs->sysctl_snat_reroute && ip6_route_me_harder(skb) != 0)
+ return 1;
+ } else
+#endif
+ if ((ipvs->sysctl_snat_reroute ||
+ skb_rtable(skb)->rt_flags & RTCF_LOCAL) &&
+ ip_route_me_harder(skb, RTN_LOCAL) != 0)
+ return 1;
+
+ return 0;
+}
+
/*
* Packet has been made sufficiently writable in caller
* - inout: 1=in->out, 0=out->in
@@ -737,7 +755,6 @@ static int handle_response_icmp(int af, struct sk_buff *skb,
struct ip_vs_protocol *pp,
unsigned int offset, unsigned int ihl)
{
- struct netns_ipvs *ipvs;
unsigned int verdict = NF_DROP;
if (IP_VS_FWD_METHOD(cp) != 0) {
@@ -759,8 +776,6 @@ static int handle_response_icmp(int af, struct sk_buff *skb,
if (!skb_make_writable(skb, offset))
goto out;
- ipvs = net_ipvs(skb_net(skb));
-
#ifdef CONFIG_IP_VS_IPV6
if (af == AF_INET6)
ip_vs_nat_icmp_v6(skb, pp, cp, 1);
@@ -768,16 +783,8 @@ static int handle_response_icmp(int af, struct sk_buff *skb,
#endif
ip_vs_nat_icmp(skb, pp, cp, 1);
-#ifdef CONFIG_IP_VS_IPV6
- if (af == AF_INET6) {
- if (ipvs->sysctl_snat_reroute && ip6_route_me_harder(skb) != 0)
- goto out;
- } else
-#endif
- if ((ipvs->sysctl_snat_reroute ||
- skb_rtable(skb)->rt_flags & RTCF_LOCAL) &&
- ip_route_me_harder(skb, RTN_LOCAL) != 0)
- goto out;
+ if (ip_vs_route_me_harder(af, skb))
+ goto out;
/* do the statistics and put it back */
ip_vs_out_stats(cp, skb);
@@ -985,7 +992,6 @@ handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
struct ip_vs_conn *cp, int ihl)
{
struct ip_vs_protocol *pp = pd->pp;
- struct netns_ipvs *ipvs;
IP_VS_DBG_PKT(11, af, pp, skb, 0, "Outgoing packet");
@@ -1021,18 +1027,8 @@ handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
* if it came from this machine itself. So re-compute
* the routing information.
*/
- ipvs = net_ipvs(skb_net(skb));
^ permalink raw reply related
* [PATCH 07/18] IPVS: Add sysctl_nat_icmp_send()
From: Simon Horman @ 2011-03-05 23:45 UTC (permalink / raw)
To: netdev, netfilter-devel, netfilter, lvs-devel
Cc: Julian Anastasov, Hans Schillstrom, Simon Horman
In-Reply-To: <1299368760-14271-1-git-send-email-horms@verge.net.au>
In preparation for not including sysctl_nat_icmp_send in
struct netns_ipvs when CONFIG_SYCTL is not defined.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
net/netfilter/ipvs/ip_vs_core.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 1d8a2a2..c9b8372 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -607,9 +607,16 @@ static int sysctl_snat_reroute(struct sk_buff *skb)
return ipvs->sysctl_snat_reroute;
}
+static int sysctl_nat_icmp_send(struct net *net)
+{
+ struct netns_ipvs *ipvs = net_ipvs(net);
+ return ipvs->sysctl_nat_icmp_send;
+}
+
#else
static int sysctl_snat_reroute(struct sk_buff *skb) { return 0; }
+static int sysctl_nat_icmp_send(struct net *net) { return 0; }
#endif
@@ -1074,7 +1081,6 @@ ip_vs_out(unsigned int hooknum, struct sk_buff *skb, int af)
struct ip_vs_protocol *pp;
struct ip_vs_proto_data *pd;
struct ip_vs_conn *cp;
- struct netns_ipvs *ipvs;
EnterFunction(11);
@@ -1149,11 +1155,10 @@ ip_vs_out(unsigned int hooknum, struct sk_buff *skb, int af)
* Check if the packet belongs to an existing entry
*/
cp = pp->conn_out_get(af, skb, &iph, iph.len, 0);
- ipvs = net_ipvs(net);
if (likely(cp))
return handle_response(af, skb, pd, cp, iph.len);
- if (ipvs->sysctl_nat_icmp_send &&
+ if (sysctl_nat_icmp_send(net) &&
(pp->protocol == IPPROTO_TCP ||
pp->protocol == IPPROTO_UDP ||
pp->protocol == IPPROTO_SCTP)) {
--
1.7.2.3
^ permalink raw reply related
* [PATCH 09/18] IPVS: Add sysctl_sync_ver()
From: Simon Horman @ 2011-03-05 23:45 UTC (permalink / raw)
To: netdev, netfilter-devel, netfilter, lvs-devel
Cc: Julian Anastasov, Hans Schillstrom, Simon Horman
In-Reply-To: <1299368760-14271-1-git-send-email-horms@verge.net.au>
In preparation for not including sysctl_sync_ver in
struct netns_ipvs when CONFIG_SYCTL is not defined.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
include/net/ip_vs.h | 11 +++++++++++
net/netfilter/ipvs/ip_vs_sync.c | 4 ++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 4975524..29cbe39 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -910,6 +910,7 @@ struct netns_ipvs {
#define DEFAULT_SYNC_THRESHOLD 3
#define DEFAULT_SYNC_PERIOD 50
+#define DEFAULT_SYNC_VER 1
#ifdef CONFIG_SYSCTL
@@ -923,6 +924,11 @@ static inline int sysctl_sync_period(struct netns_ipvs *ipvs)
return ipvs->sysctl_sync_threshold[1];
}
+static inline int sysctl_sync_ver(struct netns_ipvs *ipvs)
+{
+ return ipvs->sysctl_sync_ver;
+}
+
#else
static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs)
@@ -935,6 +941,11 @@ static inline int sysctl_sync_period(struct netns_ipvs *ipvs)
return DEFAULT_SYNC_PERIOD;
}
+static inline int sysctl_sync_ver(struct netns_ipvs *ipvs)
+{
+ return DEFAULT_SYNC_VER;
+}
+
#endif
/*
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index d037763..175d8ee 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -394,7 +394,7 @@ void ip_vs_sync_switch_mode(struct net *net, int mode)
if (!(ipvs->sync_state & IP_VS_STATE_MASTER))
return;
- if (mode == ipvs->sysctl_sync_ver || !ipvs->sync_buff)
+ if (mode == sysctl_sync_ver(ipvs) || !ipvs->sync_buff)
return;
spin_lock_bh(&ipvs->sync_buff_lock);
@@ -521,7 +521,7 @@ void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp)
unsigned int len, pe_name_len, pad;
/* Handle old version of the protocol */
- if (ipvs->sysctl_sync_ver == 0) {
+ if (sysctl_sync_ver(ipvs) == 0) {
ip_vs_sync_conn_v0(net, cp);
return;
}
--
1.7.2.3
^ permalink raw reply related
* [PATCH 10/18] IPVS: Add sysctl_expire_nodest_conn()
From: Simon Horman @ 2011-03-05 23:45 UTC (permalink / raw)
To: netdev, netfilter-devel, netfilter, lvs-devel
Cc: Julian Anastasov, Hans Schillstrom, Simon Horman
In-Reply-To: <1299368760-14271-1-git-send-email-horms@verge.net.au>
In preparation for not including sysctl_expire_nodest_conn in
struct netns_ipvs when CONFIG_SYCTL is not defined.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
net/netfilter/ipvs/ip_vs_core.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 6a0053d..d418bc6 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -613,10 +613,16 @@ static int sysctl_nat_icmp_send(struct net *net)
return ipvs->sysctl_nat_icmp_send;
}
+static int sysctl_expire_nodest_conn(struct netns_ipvs *ipvs)
+{
+ return ipvs->sysctl_expire_nodest_conn;
+}
+
#else
static int sysctl_snat_reroute(struct sk_buff *skb) { return 0; }
static int sysctl_nat_icmp_send(struct net *net) { return 0; }
+static int sysctl_expire_nodest_conn(struct netns_ipvs *ipvs) { return 0; }
#endif
@@ -1583,7 +1589,7 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af)
if (cp->dest && !(cp->dest->flags & IP_VS_DEST_F_AVAILABLE)) {
/* the destination server is not available */
- if (ipvs->sysctl_expire_nodest_conn) {
+ if (sysctl_expire_nodest_conn(ipvs)) {
/* try to expire the connection immediately */
ip_vs_conn_expire_now(cp);
}
--
1.7.2.3
^ permalink raw reply related
* [PATCH 11/18] IPVS: Add expire_quiescent_template()
From: Simon Horman @ 2011-03-05 23:45 UTC (permalink / raw)
To: netdev, netfilter-devel, netfilter, lvs-devel
Cc: Julian Anastasov, Hans Schillstrom, Simon Horman
In-Reply-To: <1299368760-14271-1-git-send-email-horms@verge.net.au>
In preparation for not including sysctl_expire_quiescent_template in
struct netns_ipvs when CONFIG_SYCTL is not defined.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
net/netfilter/ipvs/ip_vs_conn.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index 9c2a517..f289306 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -680,6 +680,16 @@ static inline void ip_vs_unbind_dest(struct ip_vs_conn *cp)
atomic_dec(&dest->refcnt);
}
+static int expire_quiescent_template(struct netns_ipvs *ipvs,
+ struct ip_vs_dest *dest)
+{
+#ifdef CONFIG_SYSCTL
+ return ipvs->sysctl_expire_quiescent_template &&
+ (atomic_read(&dest->weight) == 0);
+#else
+ return 0;
+#endif
+}
/*
* Checking if the destination of a connection template is available.
@@ -696,8 +706,7 @@ int ip_vs_check_template(struct ip_vs_conn *ct)
*/
if ((dest == NULL) ||
!(dest->flags & IP_VS_DEST_F_AVAILABLE) ||
- (ipvs->sysctl_expire_quiescent_template &&
- (atomic_read(&dest->weight) == 0))) {
+ expire_quiescent_template(ipvs, dest)) {
IP_VS_DBG_BUF(9, "check_template: dest not available for "
"protocol %s s:%s:%d v:%s:%d "
"-> d:%s:%d\n",
--
1.7.2.3
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox