Dave, That was it. Thank you!
Regards, Stan > -----Original Message----- > From: Dave Barach (dbarach) [mailto:dbar...@cisco.com] > Sent: Monday, June 12, 2017 8:04 AM > To: Ratliff, Stanley <sratl...@idirect.net>; vpp-dev@lists.fd.io > Subject: RE: Plugin question > > From the code snippet you sent, I'm guessing that you forgot to unwind the > speculative enqueue at the top of the loop. That never ends well. Examine > the XXX_enqueue_x1 macro in detail, and you'll see that it increments > n_left_to_next and decrements to_next in the missed speculation case. You > need to do that or the wheels will fall off. > > Absent a detailed description of what your code intends to do, it seems like > you could write a new graph node to do whatever you mean by "queue > privately for more processing." At that point, none of the above would be > necessary. > > Thanks... Dave > > -----Original Message----- > From: vpp-dev-boun...@lists.fd.io [mailto:vpp-dev-boun...@lists.fd.io] On > Behalf Of Ratliff, Stanley > Sent: Sunday, June 11, 2017 10:24 PM > To: vpp-dev@lists.fd.io > Subject: [vpp-dev] Plugin question > > Hello, > > I'm trying to write a VPP plugin. This plugin needs to be able to consume > packets from a vector - e.g., my plugin gets a frame with 10 buffers, and > when I pass the frame along via vlib_put_next_frame (if that's the right > call), > there would be only 9 buffers in the frame. Actually, I need to consume > anywhere from 0 to all of the buffers passed in. > > My question is how you do that? What I'm currently doing looks something > like this: > > static uword > my_node_fn (vlib_main_t * vm, > vlib_node_runtime_t * node, > vlib_frame_t * frame) > { > u32 n_left_from, * from, * to_next; > u32 number_enqueued; > to_next = NULL; > from = vlib_frame_vector_args (frame); > n_left_from = frame->n_vectors; > next_index = node->cached_next_index; > > while (n_left_from > 0) { > > u32 n_left_to_next; > > vlib_get_next_frame (vm, node, next_index, > to_next, n_left_to_next); > > number_enqueued = 0; > > while (n_left_from > 0 && n_left_to_next > 0) { > > u32 bi0; > vlib_buffer_t * b0; > u32 next0 = MY_NEXT_LOOKUP; > //ethernet_header_t *en0; > bi0 = from[0]; > from += 1; > n_left_from -= 1; > n_left_to_next -= 1; > b0 = vlib_get_buffer (vm, bi0); > > . > . > . My processing to determine whether the packet should be > . consumed or not. > . > > if (packet should be consumed) { > Queue privately for more processing. > } else { > /* enqueue b0 to the current next frame */ > to_next[0] = bi0; > to_next += 1; > vlib_validate_buffer_enqueue_x1 (vm, node, next_index, > to_next, n_left_to_next, > bi0, next0); > number_enqueued++; > } > } > if (number_enqueued) > frame->n_vectors = number_queued; > vlib_put_next_frame (vm, node, next_index, n_left_to_next); > } > } > > > But, that approach is causing a SIGSEGV in vpp_main. Does anyone have a > recommendation or a pointer for me? I'd greatly appreciate an assist. I also > need a way to inject new traffic into the stream, but it looks like there's an > example in the flowperpacket plugin. > > Regards, > Stan > > > Stan Ratliff | Architect, Applied Research VT iDirect | 13861 Sunrise > Valley > Drive, Suite 300, Herndon, VA 20171, USA > T: +1 703 544-8520 | F: +1 222 123-4567 sratl...@idirect.net | > www.idirect.net Connect with iDirect: Twitter.com/iDirect | > Facebook.com/iDirect > > > > ========================================================== > ========================================================== > ======================== > This electronic message and any files transmitted with it contains information > from iDirect, which may be privileged, proprietary and/or confidential. It is > intended solely for the use of the individual or entity to whom they are > addressed. If you are not the original recipient or the person responsible for > delivering the email to the intended recipient, be advised that you have > received this email in error, and that any use, dissemination, forwarding, > printing, or copying of this email is strictly prohibited. If you received > this > email in error, please delete it and immediately notify the sender. > _______________________________________________ > vpp-dev mailing list > vpp-dev@lists.fd.io > https://urldefense.proofpoint.com/v2/url?u=https- > 3A__lists.fd.io_mailman_listinfo_vpp- > 2Ddev&d=DwIFAg&c=LlUvidvlhStGUSxQl0giOA&r=QzgCKlK- > eUsbLW5r8KZAL9L_yqNON1dbKtMa- > Wbxna8&m=28J4Ef5LE84_JtnqKjh0By5pJOaZ4wZFY3Ct747FkeM&s=L_1- > QPolVJItXmyXf_TNTDuTOs0eb-LIIvdKl_PqB9o&e= ============================================================================================================================================ This electronic message and any files transmitted with it contains information from iDirect, which may be privileged, proprietary and/or confidential. It is intended solely for the use of the individual or entity to whom they are addressed. If you are not the original recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error, and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you received this email in error, please delete it and immediately notify the sender. _______________________________________________ vpp-dev mailing list vpp-dev@lists.fd.io https://lists.fd.io/mailman/listinfo/vpp-dev