DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] I want to post my patch about examples/kni
@ 2015-08-03 21:39 EaseTheWorld Mr.
  2015-08-03 22:10 ` Thomas Monjalon
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: EaseTheWorld Mr. @ 2015-08-03 21:39 UTC (permalink / raw)
  To: dev

but I don't have smtp server... Can anybody help with this?

diff --git a/examples/kni/main.c b/examples/kni/main.c
index 6f74d8e..6d434ad 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -830,9 +830,9 @@ kni_free_kni(uint8_t port_id)
        if (port_id >= RTE_MAX_ETHPORTS || !p[port_id])
                return -1;

-       for (i = 0; i < p[i]->nb_kni; i++) {
-               rte_kni_release(p[i]->kni[i]);
-               p[i]->kni[i] = NULL;
+       for (i = 0; i < p[port_id]->nb_kni; i++) {
+               rte_kni_release(p[port_id]->kni[i]);
+               p[port_id]->kni[i] = NULL;
        }
        rte_eth_dev_stop(port_id);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] I want to post my patch about examples/kni
  2015-08-03 21:39 [dpdk-dev] I want to post my patch about examples/kni EaseTheWorld Mr.
@ 2015-08-03 22:10 ` Thomas Monjalon
  2015-08-04  2:08 ` [dpdk-dev] Could DPDK ring provide peek interface or any comments for this function? Yan, Liming (Nokia - CN/Hangzhou)
  2015-08-04  2:20 ` Yan, Liming (Nokia - CN/Hangzhou)
  2 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2015-08-03 22:10 UTC (permalink / raw)
  To: EaseTheWorld Mr.; +Cc: dev

2015-08-04 06:39, EaseTheWorld Mr.:
> but I don't have smtp server... Can anybody help with this?

Dear Mr EaseTheWorld,

It's a pleasure to ease your first contribution :)

You have to set your SMTP parameters in ~/.gitconfig.
Example for your gmail address:
[sendemail]
	suppressfrom = true
	chainreplyto = false
	confirm = always
	envelopesender = auto
	smtpuser = easetheworld@gmail.com
	smtpserver = smtp.gmail.com
	smtpserverport = 465
	smtpencryption = ssl

In order to ease acceptance of your patch, please comply with the
Developer's Certificate of Origin: use your real name and add a
Signed-off-by line.

You also need to clearly explain your patch and the bug which is fixed.

According to MAINTAINERS file, this patch should be
--to 'Helin Zhang <helin.zhang@intel.com>' --cc dev@dpdk.org

Thanks

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] Could DPDK ring provide peek interface or any comments for this function?
  2015-08-03 21:39 [dpdk-dev] I want to post my patch about examples/kni EaseTheWorld Mr.
  2015-08-03 22:10 ` Thomas Monjalon
@ 2015-08-04  2:08 ` Yan, Liming (Nokia - CN/Hangzhou)
  2015-08-04  2:20 ` Yan, Liming (Nokia - CN/Hangzhou)
  2 siblings, 0 replies; 7+ messages in thread
From: Yan, Liming (Nokia - CN/Hangzhou) @ 2015-08-04  2:08 UTC (permalink / raw)
  To: dev

Hi,
   As we see, DPDK ring has mainly the enqueue/dequeue APIs for SINGLE/MULTI producer/consumer.  I have a requirement in work to take a peek on the top object in the ring. I don't want to consume it, just check the reference of the object.  How could this be supported?   Or any alternative solution for my requirement?  Thanks.
   I wrote my own simple peek interface but it's not MC-safe. I think it's better if DPDK can support it officially.  


 /**
+ * Just take a peek on the top object from a ring but not consume it.
+ * Note: This interface is MC and multi-thread not safe.
+ *       It can only be used for ring with RING_F_SC_DEQ attribute.
+ *
+ * @param r
+ *   A pointer to the ring structure.
+ * @param obj_p
+ *   A pointer to a void * pointer (object) that will be filled.
+ * @return
+ *   - 0: Success, object is peeked.
+ *   - -ENOENT: Not entries in the ring.
+ *   - - EPERM: Operation not permitted/supported
+ */
+static inline int __attribute__((always_inline))
+rte_ring_peek(const struct rte_ring *r, void **obj_p)
+{
+	uint32_t cons_head, prod_tail;
+
+	if (r->cons.sc_dequeue) {
+		cons_head = r->cons.head;
+		prod_tail = r->prod.tail;
+
+		if (prod_tail - cons_head == 0) {
+			return -ENOENT;
+		}
+		*obj_p = r->ring[cons_head & r->prod.mask];
+	} else {
+		return -EPERM;
+	}
+	return 0;
+}
+
+/**


--------^_^--------
Best Regards
Yan Limin



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] Could DPDK ring provide peek interface or any comments for this function?
  2015-08-03 21:39 [dpdk-dev] I want to post my patch about examples/kni EaseTheWorld Mr.
  2015-08-03 22:10 ` Thomas Monjalon
  2015-08-04  2:08 ` [dpdk-dev] Could DPDK ring provide peek interface or any comments for this function? Yan, Liming (Nokia - CN/Hangzhou)
@ 2015-08-04  2:20 ` Yan, Liming (Nokia - CN/Hangzhou)
  2015-08-04 12:57   ` Olivier MATZ
  2 siblings, 1 reply; 7+ messages in thread
From: Yan, Liming (Nokia - CN/Hangzhou) @ 2015-08-04  2:20 UTC (permalink / raw)
  To: dev

Hi,
   As we see, DPDK ring has mainly the enqueue/dequeue APIs for SINGLE/MULTI producer/consumer.  I have a requirement in work to take a peek on the top object in the ring. I don't want to consume it, just check the reference of the object.  How could this be supported?   Or any alternative solution for my requirement?  Thanks.
   I wrote my own simple peek interface but it's not MC-safe. I think it's better if DPDK can support it officially.  


 /**
+ * Just take a peek on the top object from a ring but not consume it.
+ * Note: This interface is MC and multi-thread not safe.
+ *       It can only be used for ring with RING_F_SC_DEQ attribute.
+ *
+ * @param r
+ *   A pointer to the ring structure.
+ * @param obj_p
+ *   A pointer to a void * pointer (object) that will be filled.
+ * @return
+ *   - 0: Success, object is peeked.
+ *   - -ENOENT: Not entries in the ring.
+ *   - - EPERM: Operation not permitted/supported
+ */
+static inline int __attribute__((always_inline))
+rte_ring_peek(const struct rte_ring *r, void **obj_p)
+{
+	uint32_t cons_head, prod_tail;
+
+	if (r->cons.sc_dequeue) {
+		cons_head = r->cons.head;
+		prod_tail = r->prod.tail;
+
+		if (prod_tail - cons_head == 0) {
+			return -ENOENT;
+		}
+		*obj_p = r->ring[cons_head & r->prod.mask];
+	} else {
+		return -EPERM;
+	}
+	return 0;
+}
+
+/**


--------^_^--------
Best Regards
Yan Limin



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] Could DPDK ring provide peek interface or any comments for this function?
  2015-08-04  2:20 ` Yan, Liming (Nokia - CN/Hangzhou)
@ 2015-08-04 12:57   ` Olivier MATZ
  2015-08-04 16:14     ` Stephen Hemminger
  2015-08-05  3:08     ` Yan, Liming (Nokia - CN/Hangzhou)
  0 siblings, 2 replies; 7+ messages in thread
From: Olivier MATZ @ 2015-08-04 12:57 UTC (permalink / raw)
  To: Yan, Liming (Nokia - CN/Hangzhou), dev

Hi,


On 08/04/2015 04:20 AM, Yan, Liming (Nokia - CN/Hangzhou) wrote:
> Hi,
>     As we see, DPDK ring has mainly the enqueue/dequeue APIs for SINGLE/MULTI producer/consumer.  I have a requirement in work to take a peek on the top object in the ring. I don't want to consume it, just check the reference of the object.  How could this be supported?   Or any alternative solution for my requirement?  Thanks.
>     I wrote my own simple peek interface but it's not MC-safe. I think it's better if DPDK can support it officially.

I think it's a good idea. I think we could avoid a test by using
the same naming convention than other functions applying to single
consumer rings.

I'm not sure the function is safe on mc rings: the pointer returned
via peek() should not be accessed while another core dequeues the
object and modify/free it.


A simplified version would be something like that:


/**
  * Peek one object from a single-consumer ring
  *
  * The returned object is not dequeued. This function does not work
  * on a multi-consumers ring.
  *
  * @param r
  *   A pointer to the ring structure.
  * @param obj_p
  *   A pointer to a void * pointer (object) that will be filled.
  * @return
  *   - 0: Success; objects dequeued.
  *   - -ENOENT: Not enough entries in the ring to peek
  */
static inline int
rte_ring_sc_peek(struct rte_ring *r, void **obj_p)
{
	if (unlikely(rte_ring_empty(r)))
		return -ENOENT;
	*obj_p = r->ring[r->cons.head & r->prod.mask];
	return 0;
}


Regards,
Olivier


>
>
>   /**
> + * Just take a peek on the top object from a ring but not consume it.
> + * Note: This interface is MC and multi-thread not safe.
> + *       It can only be used for ring with RING_F_SC_DEQ attribute.
> + *
> + * @param r
> + *   A pointer to the ring structure.
> + * @param obj_p
> + *   A pointer to a void * pointer (object) that will be filled.
> + * @return
> + *   - 0: Success, object is peeked.
> + *   - -ENOENT: Not entries in the ring.
> + *   - - EPERM: Operation not permitted/supported
> + */
> +static inline int __attribute__((always_inline))
> +rte_ring_peek(const struct rte_ring *r, void **obj_p)
> +{
> +	uint32_t cons_head, prod_tail;
> +
> +	if (r->cons.sc_dequeue) {
> +		cons_head = r->cons.head;
> +		prod_tail = r->prod.tail;
> +
> +		if (prod_tail - cons_head == 0) {
> +			return -ENOENT;
> +		}
> +		*obj_p = r->ring[cons_head & r->prod.mask];
> +	} else {
> +		return -EPERM;
> +	}
> +	return 0;
> +}
> +
> +/**
>
>
> --------^_^--------
> Best Regards
> Yan Limin
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] Could DPDK ring provide peek interface or any comments for this function?
  2015-08-04 12:57   ` Olivier MATZ
@ 2015-08-04 16:14     ` Stephen Hemminger
  2015-08-05  3:08     ` Yan, Liming (Nokia - CN/Hangzhou)
  1 sibling, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2015-08-04 16:14 UTC (permalink / raw)
  To: Olivier MATZ; +Cc: dev

On Tue, 04 Aug 2015 14:57:16 +0200
Olivier MATZ <olivier.matz@6wind.com> wrote:

> Hi,
> 
> 
> On 08/04/2015 04:20 AM, Yan, Liming (Nokia - CN/Hangzhou) wrote:
> > Hi,
> >     As we see, DPDK ring has mainly the enqueue/dequeue APIs for SINGLE/MULTI producer/consumer.  I have a requirement in work to take a peek on the top object in the ring. I don't want to consume it, just check the reference of the object.  How could this be supported?   Or any alternative solution for my requirement?  Thanks.
> >     I wrote my own simple peek interface but it's not MC-safe. I think it's better if DPDK can support it officially.
> 
> I think it's a good idea. I think we could avoid a test by using
> the same naming convention than other functions applying to single
> consumer rings.
> 
> I'm not sure the function is safe on mc rings: the pointer returned
> via peek() should not be accessed while another core dequeues the
> object and modify/free it.

It is not possible for peek to be SMP safe. Another consumer could remove
item from ring and  free at any time.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] Could DPDK ring provide peek interface or any comments for this function?
  2015-08-04 12:57   ` Olivier MATZ
  2015-08-04 16:14     ` Stephen Hemminger
@ 2015-08-05  3:08     ` Yan, Liming (Nokia - CN/Hangzhou)
  1 sibling, 0 replies; 7+ messages in thread
From: Yan, Liming (Nokia - CN/Hangzhou) @ 2015-08-05  3:08 UTC (permalink / raw)
  To: ext Olivier MATZ, dev


> -----Original Message-----
> From: ext Olivier MATZ [mailto:olivier.matz@6wind.com]
> Sent: Tuesday, August 04, 2015 8:57 PM
> To: Yan, Liming (Nokia - CN/Hangzhou); dev@dpdk.org
> Subject: Re: [dpdk-dev] Could DPDK ring provide peek interface or any
> comments for this function?
> 
> Hi,
> 
> 
> On 08/04/2015 04:20 AM, Yan, Liming (Nokia - CN/Hangzhou) wrote:
> > Hi,
> >     As we see, DPDK ring has mainly the enqueue/dequeue APIs for
> SINGLE/MULTI producer/consumer.  I have a requirement in work to take a
> peek on the top object in the ring. I don't want to consume it, just
> check the reference of the object.  How could this be supported?   Or
> any alternative solution for my requirement?  Thanks.
> >     I wrote my own simple peek interface but it's not MC-safe. I
> think it's better if DPDK can support it officially.
> 
> I think it's a good idea. I think we could avoid a test by using
> the same naming convention than other functions applying to single
> consumer rings.
> 
> I'm not sure the function is safe on mc rings: the pointer returned
> via peek() should not be accessed while another core dequeues the
> object and modify/free it.
> 
[limiyan wrote] 
Seems it's good for sc-ring.  Could this be promoted into formal DPDK?  
For mc-ring peek, at least I think it's quite complicated even if we use something like ref_count and delayed free.

> 
> A simplified version would be something like that:
> 
> 
> /**
>   * Peek one object from a single-consumer ring
>   *
>   * The returned object is not dequeued. This function does not work
>   * on a multi-consumers ring.
>   *
>   * @param r
>   *   A pointer to the ring structure.
>   * @param obj_p
>   *   A pointer to a void * pointer (object) that will be filled.
>   * @return
>   *   - 0: Success; objects dequeued.
>   *   - -ENOENT: Not enough entries in the ring to peek
>   */
> static inline int
> rte_ring_sc_peek(struct rte_ring *r, void **obj_p)
> {
> 	if (unlikely(rte_ring_empty(r)))
> 		return -ENOENT;
> 	*obj_p = r->ring[r->cons.head & r->prod.mask];
> 	return 0;
> }
> 
> 
> Regards,
> Olivier
> 
> 
> >
> >
> >   /**
> > + * Just take a peek on the top object from a ring but not consume it.
> > + * Note: This interface is MC and multi-thread not safe.
> > + *       It can only be used for ring with RING_F_SC_DEQ attribute.
> > + *
> > + * @param r
> > + *   A pointer to the ring structure.
> > + * @param obj_p
> > + *   A pointer to a void * pointer (object) that will be filled.
> > + * @return
> > + *   - 0: Success, object is peeked.
> > + *   - -ENOENT: Not entries in the ring.
> > + *   - - EPERM: Operation not permitted/supported
> > + */
> > +static inline int __attribute__((always_inline))
> > +rte_ring_peek(const struct rte_ring *r, void **obj_p)
> > +{
> > +	uint32_t cons_head, prod_tail;
> > +
> > +	if (r->cons.sc_dequeue) {
> > +		cons_head = r->cons.head;
> > +		prod_tail = r->prod.tail;
> > +
> > +		if (prod_tail - cons_head == 0) {
> > +			return -ENOENT;
> > +		}
> > +		*obj_p = r->ring[cons_head & r->prod.mask];
> > +	} else {
> > +		return -EPERM;
> > +	}
> > +	return 0;
> > +}
> > +
> > +/**
> >
> >
> > --------^_^--------
> > Best Regards
> > Yan Limin
> >
> >


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-08-05  3:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-03 21:39 [dpdk-dev] I want to post my patch about examples/kni EaseTheWorld Mr.
2015-08-03 22:10 ` Thomas Monjalon
2015-08-04  2:08 ` [dpdk-dev] Could DPDK ring provide peek interface or any comments for this function? Yan, Liming (Nokia - CN/Hangzhou)
2015-08-04  2:20 ` Yan, Liming (Nokia - CN/Hangzhou)
2015-08-04 12:57   ` Olivier MATZ
2015-08-04 16:14     ` Stephen Hemminger
2015-08-05  3:08     ` Yan, Liming (Nokia - CN/Hangzhou)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).