Dear Avi,

Yes, if you decide to drop b1, set next1 / error1 in the obvious way. 

The macros vlib_validate_buffer_enqueue_x[2|4] sort out the various incorrect 
speculative enqueue / 2 or 4 pkts going to different successor node cases. 
Simply set (nextN, errorN) as desired and let the boilerplate code deal with 
it... 

D. 

-----Original Message-----
From: Avi Cohen (A) <avi.co...@huawei.com> 
Sent: Wednesday, March 7, 2018 9:02 AM
To: Dave Barach (dbarach) <dbar...@cisco.com>; vpp-dev@lists.fd.io
Subject: RE: [vpp-dev] VPP - mechanism to drop packets

Thank you Dave - this is very helpful
Please see comments inline 

> -----Original Message-----
> From: vpp-dev@lists.fd.io [mailto:vpp-dev@lists.fd.io] On Behalf Of 
> Dave Barach
> Sent: Wednesday, 07 March, 2018 3:20 PM
> To: vpp-dev@lists.fd.io
> Subject: Re: [vpp-dev] VPP - mechanism to drop packets
> 
> Add an arc from your node to the "error-drop" node, set next0 = 
> MYNODE_NEXT_ERROR and b0->error = node->errors[SOME_ERROR].
> 
[Avi Cohen (A)]
I'm using the standard loop - this is with the next0 and next1 - this mean that 
we are processing  2 pkts within a single stage of the loop - correct ?
In this case if I want to drop both pkts I have to set the next1 to    
NEXT_ERROR as well correct ?

> Please use the standard dual/single - or quad/single - loop code 
> pattern to walk the incoming vector of buffer indices. You will hate 
> your life if you try to code the vector-walk from first principles. 
> It's not impossible, but I it will be a waste of your time / a bunch of 
> needless aggravation.
> 
> b0->sw_if_index[VLIB_TX] is interpreted in a couple of different ways. 
> b0->"ip4/6-
> lookup" interprets it as a fib index. "interface-output" interprets it 
> as a [tx] hardware interface ID.
> 
> I'm not sure what you're trying to do, but if it involves an ip 
> lookup, do NOT set
> b0->sw_if_index[VLIB_TX]. Let the fib code do its job, and send pkts 
> b0->to either
> the input nodes - if mandatory input checks / ttl decrement have not 
> been performed - or to the lookup stage if e.g. you've rewritten the 
> ip header(s) in some fashion.
[Avi Cohen (A)]
I'm implementing my fwding function and I want to bypass the IP-lookup And 
maybe do some rewrite and then to interface-output

Best Regards
Avi
> 
> HTH... Dave
> 
> -----Original Message-----
> From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of Avi Cohen 
> (A)
> Sent: Wednesday, March 7, 2018 6:38 AM
> To: vpp-dev@lists.fd.io
> Subject: [vpp-dev] VPP - mechanism to drop packets
> 
> Hi,
> I'm implementing a simple policy plugin , below is the pseudo-code
> 
> Go over the packets vector
> While (there are packets to process )
> {
> Check if a packet match a specific rule
>   If yes - set the out-interface for the packet to be transmitted
>   Else - drop packet
> }
> 
> 2 Question -
> 1. is there  any function/mechanism that implements a drop ? or any 
> filed in the packet's metadata for drop marking ?
> 2. Regarding the set tx out interface - I see that I can set the 
> sw_if_index[VLIB_TX] - so the packet will be later transmitted through 
> this interface - is this correct ?
> 
> Best Regards
> Avi
> 
> 
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Links:

You receive all messages sent to this group.

View/Reply Online (#8449): https://lists.fd.io/g/vpp-dev/message/8449
View All Messages In Topic (4): https://lists.fd.io/g/vpp-dev/topic/14153536
Mute This Topic: https://lists.fd.io/mt/14153536/21656
New Topic: https://lists.fd.io/g/vpp-dev/post

Change Your Subscription: https://lists.fd.io/g/vpp-dev/editsub/21656
Group Home: https://lists.fd.io/g/vpp-dev
Contact Group Owner: vpp-dev+ow...@lists.fd.io
Terms of Service: https://lists.fd.io/static/tos
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to