DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ixgbe: prevent duplicate callback on list
@ 2016-10-19 22:23 E. Scott Daniels
  2016-10-19 22:23 ` E. Scott Daniels
  0 siblings, 1 reply; 7+ messages in thread
From: E. Scott Daniels @ 2016-10-19 22:23 UTC (permalink / raw)
  To: helin.zhang, bernard.iremonger; +Cc: dev, az5157, E. Scott Daniels

If rte_eth_dev_callback_register() is invoked with parameters
which match a callback struct that is already on the list, an
attempt is made to add that same struct onto the tail of the
list. Adding a struct which is already on the list will have
undesired results.

This is an edge case, but I think it should be corrected;
patch prevents the attempt to add a struct which is already
on the list.

E. Scott Daniels (1):
  net/ixgbe: prevent duplicate callback on list

 lib/librte_ether/rte_ethdev.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

-- 
1.9.1

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

* [dpdk-dev] [PATCH] net/ixgbe: prevent duplicate callback on list
  2016-10-19 22:23 [dpdk-dev] [PATCH] net/ixgbe: prevent duplicate callback on list E. Scott Daniels
@ 2016-10-19 22:23 ` E. Scott Daniels
  2016-10-20  1:39   ` Lu, Wenzhuo
  0 siblings, 1 reply; 7+ messages in thread
From: E. Scott Daniels @ 2016-10-19 22:23 UTC (permalink / raw)
  To: helin.zhang, bernard.iremonger; +Cc: dev, az5157, E. Scott Daniels

This change prevents the attempt to add a structure which is
already on the callback list. If a struct with matching
parameters is found on the list, then no action is taken. If
a struct with matching parameters is found on the list, then
no action is taken.

Signed-off-by: E. Scott Daniels <daniels@research.att.com>
---
 lib/librte_ether/rte_ethdev.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 0d9d9c1..fde8112 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2449,14 +2449,15 @@ rte_eth_dev_callback_register(uint8_t port_id,
 	}
 
 	/* create a new callback. */
-	if (user_cb == NULL)
+	if (user_cb == NULL) {
 		user_cb = rte_zmalloc("INTR_USER_CALLBACK",
 					sizeof(struct rte_eth_dev_callback), 0);
-	if (user_cb != NULL) {
-		user_cb->cb_fn = cb_fn;
-		user_cb->cb_arg = cb_arg;
-		user_cb->event = event;
-		TAILQ_INSERT_TAIL(&(dev->link_intr_cbs), user_cb, next);
+		if (user_cb != NULL) {
+			user_cb->cb_fn = cb_fn;
+			user_cb->cb_arg = cb_arg;
+			user_cb->event = event;
+			TAILQ_INSERT_TAIL(&(dev->link_intr_cbs), user_cb, next);
+		}
 	}
 
 	rte_spinlock_unlock(&rte_eth_dev_cb_lock);
-- 
1.9.1

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

* Re: [dpdk-dev] [PATCH] net/ixgbe: prevent duplicate callback on list
  2016-10-19 22:23 ` E. Scott Daniels
@ 2016-10-20  1:39   ` Lu, Wenzhuo
  2016-10-20  2:11     ` Scott Daniels
  0 siblings, 1 reply; 7+ messages in thread
From: Lu, Wenzhuo @ 2016-10-20  1:39 UTC (permalink / raw)
  To: E. Scott Daniels, Zhang, Helin, Iremonger, Bernard; +Cc: dev, az5157

Hi Scott,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of E. Scott Daniels
> Sent: Thursday, October 20, 2016 6:23 AM
> To: Zhang, Helin; Iremonger, Bernard
> Cc: dev@dpdk.org; az5157@att.com; E. Scott Daniels
> Subject: [dpdk-dev] [PATCH] net/ixgbe: prevent duplicate callback on list
> 
> This change prevents the attempt to add a structure which is already on the
> callback list. If a struct with matching parameters is found on the list, then no
> action is taken. If a struct with matching parameters is found on the list, then no
> action is taken.
> 
> Signed-off-by: E. Scott Daniels <daniels@research.att.com>
I think the fix itself is good.  But 2 things,
1, normally we don't create a cover letter for a patch set which only has one patch. Just sending the patch itself is enough.
2, ' net/ixgbe: ' in the title is used to describe the component. So the title should be ' lib/ether: prevent duplicate callback on list'.
Thanks.

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

* Re: [dpdk-dev] [PATCH] net/ixgbe: prevent duplicate callback on list
  2016-10-20  1:39   ` Lu, Wenzhuo
@ 2016-10-20  2:11     ` Scott Daniels
  2016-10-20  2:19       ` Lu, Wenzhuo
  0 siblings, 1 reply; 7+ messages in thread
From: Scott Daniels @ 2016-10-20  2:11 UTC (permalink / raw)
  To: Lu, Wenzhuo; +Cc: Zhang, Helin, Iremonger, Bernard, dev, ZELEZNIAK, ALEX



On Wed, 19 Oct 2016, Lu, Wenzhuo wrote:

> Hi Scott,
>
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of E. Scott Daniels
>> Sent: Thursday, October 20, 2016 6:23 AM
>> To: Zhang, Helin; Iremonger, Bernard
>> Cc: dev@dpdk.org; az5157@att.com; E. Scott Daniels
>> Subject: [dpdk-dev] [PATCH] net/ixgbe: prevent duplicate callback on list
>>
>> This change prevents the attempt to add a structure which is already on the
>> callback list. If a struct with matching parameters is found on the list, then no
>> action is taken. If a struct with matching parameters is found on the list, then no
>> action is taken.
>>
>> Signed-off-by: E. Scott Daniels <daniels@research.att.com>
> I think the fix itself is good.  But 2 things,
> 1, normally we don't create a cover letter for a patch set which only has one patch. Just sending the patch itself is enough.
> 2, ' net/ixgbe: ' in the title is used to describe the component. So the title should be ' lib/ether: prevent duplicate callback on list'.
> Thanks.

Thanks for the advice.  My mistake on the component.  Is there an easy way 
to fix, or does it make sense just to nack this and I'll submit one with 
the correct component.

Scott

>
>

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

* Re: [dpdk-dev] [PATCH] net/ixgbe: prevent duplicate callback on list
  2016-10-20  2:11     ` Scott Daniels
@ 2016-10-20  2:19       ` Lu, Wenzhuo
  2016-10-20  2:31         ` Scott Daniels
  0 siblings, 1 reply; 7+ messages in thread
From: Lu, Wenzhuo @ 2016-10-20  2:19 UTC (permalink / raw)
  To: Scott Daniels; +Cc: Zhang, Helin, Iremonger, Bernard, dev, ZELEZNIAK, ALEX

Hi Scott,

> -----Original Message-----
> From: Scott Daniels [mailto:daniels@research.att.com]
> Sent: Thursday, October 20, 2016 10:11 AM
> To: Lu, Wenzhuo
> Cc: Zhang, Helin; Iremonger, Bernard; dev@dpdk.org; ZELEZNIAK, ALEX
> Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: prevent duplicate callback on list
> 
> 
> 
> On Wed, 19 Oct 2016, Lu, Wenzhuo wrote:
> 
> > Hi Scott,
> >
> >> -----Original Message-----
> >> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of E. Scott Daniels
> >> Sent: Thursday, October 20, 2016 6:23 AM
> >> To: Zhang, Helin; Iremonger, Bernard
> >> Cc: dev@dpdk.org; az5157@att.com; E. Scott Daniels
> >> Subject: [dpdk-dev] [PATCH] net/ixgbe: prevent duplicate callback on
> >> list
> >>
> >> This change prevents the attempt to add a structure which is already
> >> on the callback list. If a struct with matching parameters is found
> >> on the list, then no action is taken. If a struct with matching
> >> parameters is found on the list, then no action is taken.
> >>
> >> Signed-off-by: E. Scott Daniels <daniels@research.att.com>
> > I think the fix itself is good.  But 2 things, 1, normally we don't
> > create a cover letter for a patch set which only has one patch. Just sending the
> patch itself is enough.
> > 2, ' net/ixgbe: ' in the title is used to describe the component. So the title
> should be ' lib/ether: prevent duplicate callback on list'.
> > Thanks.
> 
> Thanks for the advice.  My mistake on the component.  Is there an easy way to
> fix, or does it make sense just to nack this and I'll submit one with the correct
> component.
No need to NACK it. You can send a V2 with the correct component. And I think you can add my ack in the V2.
Acked-by: Wenzhuo Lu <Wenzhuo.lu@intel.com>

BTW, I forgot to mention that as it's a fix. We always add a Fixes tag in the commit log. You can find the example from other one's mails :)

> 
> Scott
> 
> >
> >

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

* Re: [dpdk-dev] [PATCH] net/ixgbe: prevent duplicate callback on list
  2016-10-20  2:19       ` Lu, Wenzhuo
@ 2016-10-20  2:31         ` Scott Daniels
  2016-10-20 13:35           ` Scott Daniels
  0 siblings, 1 reply; 7+ messages in thread
From: Scott Daniels @ 2016-10-20  2:31 UTC (permalink / raw)
  To: Lu, Wenzhuo; +Cc: Zhang, Helin, Iremonger, Bernard, dev, ZELEZNIAK, ALEX



On Wed, 19 Oct 2016, Lu, Wenzhuo wrote:

> Hi Scott,
>
>> -----Original Message-----
>> From: Scott Daniels [mailto:daniels@research.att.com]
>> Sent: Thursday, October 20, 2016 10:11 AM
>> To: Lu, Wenzhuo
>> Cc: Zhang, Helin; Iremonger, Bernard; dev@dpdk.org; ZELEZNIAK, ALEX
>> Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: prevent duplicate callback on list
>>
>>
>>
>> On Wed, 19 Oct 2016, Lu, Wenzhuo wrote:
>>
>>> Hi Scott,
>>>
>>>> -----Original Message-----
>>>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of E. Scott Daniels
>>>> Sent: Thursday, October 20, 2016 6:23 AM
>>>> To: Zhang, Helin; Iremonger, Bernard
>>>> Cc: dev@dpdk.org; az5157@att.com; E. Scott Daniels
>>>> Subject: [dpdk-dev] [PATCH] net/ixgbe: prevent duplicate callback on
>>>> list
>>>>
>>>> This change prevents the attempt to add a structure which is already
>>>> on the callback list. If a struct with matching parameters is found
>>>> on the list, then no action is taken. If a struct with matching
>>>> parameters is found on the list, then no action is taken.
>>>>
>>>> Signed-off-by: E. Scott Daniels <daniels@research.att.com>
>>> I think the fix itself is good.  But 2 things, 1, normally we don't
>>> create a cover letter for a patch set which only has one patch. Just sending the
>> patch itself is enough.
>>> 2, ' net/ixgbe: ' in the title is used to describe the component. So the title
>> should be ' lib/ether: prevent duplicate callback on list'.
>>> Thanks.
>>
>> Thanks for the advice.  My mistake on the component.  Is there an easy way to
>> fix, or does it make sense just to nack this and I'll submit one with the correct
>> component.
> No need to NACK it. You can send a V2 with the correct component. And I think you can add my ack in the V2.
> Acked-by: Wenzhuo Lu <Wenzhuo.lu@intel.com>
>
> BTW, I forgot to mention that as it's a fix. We always add a Fixes tag in the commit log. You can find the example from other one's mails :)

Will do.  The patch checker was squaking about the fixes tag and I remvoed 
it :( So, I need to figure out what it didn't like about it and I'll fix 
with a V2 and add your ack. Getting late here tonight, so tomorrow.

Thanks
Scott


>

>>
>> Scott
>>
>>>
>>>
>

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

* Re: [dpdk-dev] [PATCH] net/ixgbe: prevent duplicate callback on list
  2016-10-20  2:31         ` Scott Daniels
@ 2016-10-20 13:35           ` Scott Daniels
  0 siblings, 0 replies; 7+ messages in thread
From: Scott Daniels @ 2016-10-20 13:35 UTC (permalink / raw)
  To: Lu, Wenzhuo; +Cc: Zhang, Helin, Iremonger, Bernard, dev, ZELEZNIAK, ALEX



On Wed, 19 Oct 2016, DANIELS, EDWARD S (EDWARD) wrote:

> *** Security Advisory: This Message Originated Outside of AT&T ***.
> Reference http://cso.att.com/EmailSecurity/IDSP.html for more information.
>
>
>
> On Wed, 19 Oct 2016, Lu, Wenzhuo wrote:
>
>> Hi Scott,
>>
>>> -----Original Message-----
>>> From: Scott Daniels [mailto:daniels@research.att.com]
>>> Sent: Thursday, October 20, 2016 10:11 AM
>>> To: Lu, Wenzhuo
>>> Cc: Zhang, Helin; Iremonger, Bernard; dev@dpdk.org; ZELEZNIAK, ALEX
>>> Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: prevent duplicate callback on list
>>>
>>>
>>>
>>> On Wed, 19 Oct 2016, Lu, Wenzhuo wrote:
>>>
>>>> Hi Scott,
>>>>
>>>>> -----Original Message-----
>>>>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of E. Scott Daniels
>>>>> Sent: Thursday, October 20, 2016 6:23 AM
>>>>> To: Zhang, Helin; Iremonger, Bernard
>>>>> Cc: dev@dpdk.org; az5157@att.com; E. Scott Daniels
>>>>> Subject: [dpdk-dev] [PATCH] net/ixgbe: prevent duplicate callback on
>>>>> list
>>>>>
>>>>> This change prevents the attempt to add a structure which is already
>>>>> on the callback list. If a struct with matching parameters is found
>>>>> on the list, then no action is taken. If a struct with matching
>>>>> parameters is found on the list, then no action is taken.
>>>>>
>>>>> Signed-off-by: E. Scott Daniels <daniels@research.att.com>
>>>> I think the fix itself is good.  But 2 things, 1, normally we don't
>>>> create a cover letter for a patch set which only has one patch. Just sending the
>>> patch itself is enough.
>>>> 2, ' net/ixgbe: ' in the title is used to describe the component. So the title
>>> should be ' lib/ether: prevent duplicate callback on list'.
>>>> Thanks.
>>>
>>> Thanks for the advice.  My mistake on the component.  Is there an easy way to
>>> fix, or does it make sense just to nack this and I'll submit one with the correct
>>> component.
>> No need to NACK it. You can send a V2 with the correct component. And I think you can add my ack in the V2.
>> Acked-by: Wenzhuo Lu <Wenzhuo.lu@intel.com>
>>
>> BTW, I forgot to mention that as it's a fix. We always add a Fixes tag in the commit log. You can find the example from other one's mails :)
>
> Will do.  The patch checker was squaking about the fixes tag and I remvoed
> it :( So, I need to figure out what it didn't like about it and I'll fix
> with a V2 and add your ack. Getting late here tonight, so tomorrow.
>
> Thanks
> Scott

V2 created, but with the change to the component the subject is different:
  [PATCH v2] lib/ether: prevent duplicate callback on list


>
>
>>
>
>>>
>>> Scott
>>>
>>>>
>>>>
>>
>

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

end of thread, other threads:[~2016-10-20 13:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-19 22:23 [dpdk-dev] [PATCH] net/ixgbe: prevent duplicate callback on list E. Scott Daniels
2016-10-19 22:23 ` E. Scott Daniels
2016-10-20  1:39   ` Lu, Wenzhuo
2016-10-20  2:11     ` Scott Daniels
2016-10-20  2:19       ` Lu, Wenzhuo
2016-10-20  2:31         ` Scott Daniels
2016-10-20 13:35           ` Scott Daniels

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).