All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Vadai <amir@vadai.me>
To: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	netdev@vger.kernel.org, Or Gerlitz <ogerlitz@mellanox.com>
Subject: Re: [PATCH iproute2 net 3/8] tc/pedit: Introduce 'add' operation
Date: Mon, 24 Apr 2017 10:52:03 +0300	[thread overview]
Message-ID: <20170424075203.GA3265@office.localdomain> (raw)
In-Reply-To: <f358025b-2618-3f22-b593-2e4e70fb7a79@mojatatu.com>

On Sun, Apr 23, 2017 at 01:44:51PM -0400, Jamal Hadi Salim wrote:
> 
> Thanks for the excellent work.
> 
> On 17-04-23 08:53 AM, Amir Vadai wrote:
> > This command could be useful to increase/decrease fields value.
> > 
> 
> Does this contradict the "retain" feature? Example rule to
> retain the second nibble but set the first to 0xA
> (essentially it X-ORs):
> tc filter add dev lo parent ffff: protocol ip prio 10 \
> u32 match ip dst 127.0.0.1/32 flowid 1:1 \
> action pedit munge offset 0 u8 set 0x0A retain 0xF0

You mean, for example increasing a single nible in an ipv4 address?
If so, then it should work:
# tc filter add dev veth0 parent ffff:  u32 \
    match ip dport 23 0xffff \
		action pedit ex \
		  munge ip src add 1.0.0.0 retain 0xff000000

# tc -s filter show dev veth0 parent ffff:
filter protocol all pref 49151 u32
filter protocol all pref 49151 u32 fh 801: ht divisor 1
filter protocol all pref 49151 u32 fh 801::800 order 2048 key ht 801 bkt 0 terminal flowid ???  (rule hit 0 success 0)
  match 00000017/0000ffff at 20 (success 0 )
	action order 1:  pedit action pass keys 1
 	 index 48 ref 1 bind 1 installed 1 sec used 1 sec
	 key #0  at ipv4+12: add 01000000 mask 00ffffff
 	Action statistics:
	Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
	backlog 0b 0p requeues 0

> 
> Mostly curious about hardware handling.
As to hardware handling, Or did the implementation so he will answer
better. AFAIK, current implementation doesn't allow partial field
setting/adding, so such a rule can't be offloaded. I think it is only to
make things simple and because there was no use case for that.
To my knowledge, hardware should support such thing if needed.

Amir

> 
> cheers,
> jamal
> 

  reply	other threads:[~2017-04-24  7:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-23 12:53 [PATCH iproute2 net 0/8] tc/act_pedit: Support offset relative to conventional header Amir Vadai
2017-04-23 12:53 ` [PATCH iproute2 net 1/8] tc/pedit: Fix a typo in pedit usage message Amir Vadai
2017-04-23 12:53 ` [PATCH iproute2 net 2/8] tc/pedit: Extend pedit to specify offset relative to mac/transport headers Amir Vadai
2017-05-01 16:21   ` Stephen Hemminger
2017-04-23 12:53 ` [PATCH iproute2 net 3/8] tc/pedit: Introduce 'add' operation Amir Vadai
2017-04-23 17:44   ` Jamal Hadi Salim
2017-04-24  7:52     ` Amir Vadai [this message]
2017-04-24 11:04       ` Or Gerlitz
2017-04-23 12:53 ` [PATCH iproute2 net 4/8] tc/pedit: p_ip: introduce editing ttl header Amir Vadai
2017-04-23 12:53 ` [PATCH iproute2 net 5/8] tc/pedit: Support fields bigger than 32 bits Amir Vadai
2017-04-23 12:53 ` [PATCH iproute2 net 6/8] tc/pedit: p_eth: ETH header editor Amir Vadai
2017-04-23 12:53 ` [PATCH iproute2 net 7/8] tc/pedit: p_tcp: introduce pedit tcp support Amir Vadai
2017-04-23 12:53 ` [PATCH iproute2 net 8/8] tc/pedit: p_udp: introduce pedit udp support Amir Vadai
2017-05-01 16:26 ` [PATCH iproute2 net 0/8] tc/act_pedit: Support offset relative to conventional header Stephen Hemminger
2017-05-03  6:27   ` Amir Vadai

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=20170424075203.GA3265@office.localdomain \
    --to=amir@vadai.me \
    --cc=jhs@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=stephen@networkplumber.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.