From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Antonio Quartulli <antonio@meshcoding.com>, davem@davemloft.net
Cc: netdev@vger.kernel.org, Antonio Quartulli <antonio@open-mesh.com>,
Jamal Hadi Salim <jhs@mojatatu.com>
Subject: Re: [PATCH] skbedit: allow the user to specify bitmask for mark
Date: Mon, 21 Jul 2014 16:04:55 +0400 [thread overview]
Message-ID: <53CD01E7.50004@cogentembedded.com> (raw)
In-Reply-To: <1405931720-24383-1-git-send-email-antonio@meshcoding.com>
Hello.
On 21-07-2014 12:35, Antonio Quartulli wrote:
> From: Antonio Quartulli <antonio@open-mesh.com>
> The user may want to use only some bits of the skb mark in
> his skbedit rules because the remaining part might be used by
> something else.
> Introduce the "mask" parameter to the skbedit actor in order
> to implement such functionality.
> When the mask is specified, only those bits selected by the
> latter are altered really changed by the actor, while the
> rest is left untouched.
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
[...]
> diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
> index fcfeeaf..5fca32b 100644
> --- a/net/sched/act_skbedit.c
> +++ b/net/sched/act_skbedit.c
> @@ -43,8 +43,12 @@ static int tcf_skbedit(struct sk_buff *skb, const struct tc_action *a,
> if (d->flags & SKBEDIT_F_QUEUE_MAPPING &&
> skb->dev->real_num_tx_queues > d->queue_mapping)
> skb_set_queue_mapping(skb, d->queue_mapping);
> - if (d->flags & SKBEDIT_F_MARK)
> - skb->mark = d->mark;
> + if (d->flags & SKBEDIT_F_MARK) {
> + /* unset all the bits in the mask */
> + skb->mark = skb->mark & ~d->mask;
Why not 'skb->mark &= ~d->mask;'?
> + /* assign the mark value for the masked bit only */
> + skb->mark |= d->mark & d->mask;
> + }
>
> spin_unlock(&d->tcf_lock);
> return d->tcf_action;
[...]
WBR, Sergei
next prev parent reply other threads:[~2014-07-21 12:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-21 8:35 [PATCH] skbedit: allow the user to specify bitmask for mark Antonio Quartulli
2014-07-21 10:43 ` Jamal Hadi Salim
2014-07-21 12:04 ` Sergei Shtylyov [this message]
2014-07-21 12:08 ` Antonio Quartulli
2014-07-21 12:31 ` Eric Dumazet
2014-07-21 12:45 ` Antonio Quartulli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53CD01E7.50004@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=antonio@meshcoding.com \
--cc=antonio@open-mesh.com \
--cc=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.