[PKT_SCHED]: Convert tc action functions to single skb pointers
tcf_action_exec only gets a single skb pointer and doesn't own the skb, but passes double skb pointers (to a local variable) to the action functions. Change to use single skb pointers everywhere. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
538e43a4bd
commit
f43c5a0df3
|
@ -63,7 +63,7 @@ struct tc_action_ops
|
||||||
__u32 type; /* TBD to match kind */
|
__u32 type; /* TBD to match kind */
|
||||||
__u32 capab; /* capabilities includes 4 bit version */
|
__u32 capab; /* capabilities includes 4 bit version */
|
||||||
struct module *owner;
|
struct module *owner;
|
||||||
int (*act)(struct sk_buff **, struct tc_action *, struct tcf_result *);
|
int (*act)(struct sk_buff *, struct tc_action *, struct tcf_result *);
|
||||||
int (*get_stats)(struct sk_buff *, struct tc_action *);
|
int (*get_stats)(struct sk_buff *, struct tc_action *);
|
||||||
int (*dump)(struct sk_buff *, struct tc_action *,int , int);
|
int (*dump)(struct sk_buff *, struct tc_action *,int , int);
|
||||||
int (*cleanup)(struct tc_action *, int bind);
|
int (*cleanup)(struct tc_action *, int bind);
|
||||||
|
|
|
@ -165,7 +165,7 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action *act,
|
||||||
while ((a = act) != NULL) {
|
while ((a = act) != NULL) {
|
||||||
repeat:
|
repeat:
|
||||||
if (a->ops && a->ops->act) {
|
if (a->ops && a->ops->act) {
|
||||||
ret = a->ops->act(&skb, a, res);
|
ret = a->ops->act(skb, a, res);
|
||||||
if (TC_MUNGED & skb->tc_verd) {
|
if (TC_MUNGED & skb->tc_verd) {
|
||||||
/* copied already, allow trampling */
|
/* copied already, allow trampling */
|
||||||
skb->tc_verd = SET_TC_OK2MUNGE(skb->tc_verd);
|
skb->tc_verd = SET_TC_OK2MUNGE(skb->tc_verd);
|
||||||
|
|
|
@ -135,10 +135,9 @@ tcf_gact_cleanup(struct tc_action *a, int bind)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tcf_gact(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res)
|
tcf_gact(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res)
|
||||||
{
|
{
|
||||||
struct tcf_gact *p = PRIV(a, gact);
|
struct tcf_gact *p = PRIV(a, gact);
|
||||||
struct sk_buff *skb = *pskb;
|
|
||||||
int action = TC_ACT_SHOT;
|
int action = TC_ACT_SHOT;
|
||||||
|
|
||||||
spin_lock(&p->lock);
|
spin_lock(&p->lock);
|
||||||
|
|
|
@ -201,11 +201,10 @@ tcf_ipt_cleanup(struct tc_action *a, int bind)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tcf_ipt(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res)
|
tcf_ipt(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res)
|
||||||
{
|
{
|
||||||
int ret = 0, result = 0;
|
int ret = 0, result = 0;
|
||||||
struct tcf_ipt *p = PRIV(a, ipt);
|
struct tcf_ipt *p = PRIV(a, ipt);
|
||||||
struct sk_buff *skb = *pskb;
|
|
||||||
|
|
||||||
if (skb_cloned(skb)) {
|
if (skb_cloned(skb)) {
|
||||||
if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
|
if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
|
||||||
|
@ -222,6 +221,9 @@ tcf_ipt(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res)
|
||||||
worry later - danger - this API seems to have changed
|
worry later - danger - this API seems to have changed
|
||||||
from earlier kernels */
|
from earlier kernels */
|
||||||
|
|
||||||
|
/* iptables targets take a double skb pointer in case the skb
|
||||||
|
* needs to be replaced. We don't own the skb, so this must not
|
||||||
|
* happen. The pskb_expand_head above should make sure of this */
|
||||||
ret = p->t->u.kernel.target->target(&skb, skb->dev, NULL,
|
ret = p->t->u.kernel.target->target(&skb, skb->dev, NULL,
|
||||||
p->hook, p->t->data, NULL);
|
p->hook, p->t->data, NULL);
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
|
|
|
@ -158,12 +158,11 @@ tcf_mirred_cleanup(struct tc_action *a, int bind)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tcf_mirred(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res)
|
tcf_mirred(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res)
|
||||||
{
|
{
|
||||||
struct tcf_mirred *p = PRIV(a, mirred);
|
struct tcf_mirred *p = PRIV(a, mirred);
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
struct sk_buff *skb2 = NULL;
|
struct sk_buff *skb2 = NULL;
|
||||||
struct sk_buff *skb = *pskb;
|
|
||||||
u32 at = G_TC_AT(skb->tc_verd);
|
u32 at = G_TC_AT(skb->tc_verd);
|
||||||
|
|
||||||
spin_lock(&p->lock);
|
spin_lock(&p->lock);
|
||||||
|
|
|
@ -130,10 +130,9 @@ tcf_pedit_cleanup(struct tc_action *a, int bind)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tcf_pedit(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res)
|
tcf_pedit(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res)
|
||||||
{
|
{
|
||||||
struct tcf_pedit *p = PRIV(a, pedit);
|
struct tcf_pedit *p = PRIV(a, pedit);
|
||||||
struct sk_buff *skb = *pskb;
|
|
||||||
int i, munged = 0;
|
int i, munged = 0;
|
||||||
u8 *pptr;
|
u8 *pptr;
|
||||||
|
|
||||||
|
|
|
@ -284,11 +284,10 @@ static int tcf_act_police_cleanup(struct tc_action *a, int bind)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tcf_act_police(struct sk_buff **pskb, struct tc_action *a,
|
static int tcf_act_police(struct sk_buff *skb, struct tc_action *a,
|
||||||
struct tcf_result *res)
|
struct tcf_result *res)
|
||||||
{
|
{
|
||||||
psched_time_t now;
|
psched_time_t now;
|
||||||
struct sk_buff *skb = *pskb;
|
|
||||||
struct tcf_police *p = PRIV(a);
|
struct tcf_police *p = PRIV(a);
|
||||||
long toks;
|
long toks;
|
||||||
long ptoks = 0;
|
long ptoks = 0;
|
||||||
|
|
|
@ -44,9 +44,8 @@ static DEFINE_RWLOCK(simp_lock);
|
||||||
#include <net/pkt_act.h>
|
#include <net/pkt_act.h>
|
||||||
#include <net/act_generic.h>
|
#include <net/act_generic.h>
|
||||||
|
|
||||||
static int tcf_simp(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res)
|
static int tcf_simp(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res)
|
||||||
{
|
{
|
||||||
struct sk_buff *skb = *pskb;
|
|
||||||
struct tcf_defact *p = PRIV(a, defact);
|
struct tcf_defact *p = PRIV(a, defact);
|
||||||
|
|
||||||
spin_lock(&p->lock);
|
spin_lock(&p->lock);
|
||||||
|
|
Loading…
Reference in New Issue