ethdev: additional parameter in RX callback
PATCH 1/1 ethdev: additional parameter in RX callback
This patch is a minor extension to the recent patchset for RX/TX callbacks based on feedback from users implementing solutions based on it.
The patch adds a new parameter to the RX callback to pass in the number of available RX packets in addition to the number of dequeued packets. This provides the RX callback functions with additional information that can be used to decide how packets from a burst are handled.
The TX callback doesn't require this additional parameter so the RX and TX callbacks no longer have the same function parameters. As such the single RX/TX callback has been refactored into two separate callbacks.
Since this is an API change we hope it can be included in 2.0.0 to avoid changing the API in a subsequent release.
John McNamara (1):
ethdev: added additional packet count parameter to RX callbacks
examples/rxtx_callbacks/main.c | 3 +- lib/librte_ether/rte_ethdev.c | 8 ++-- lib/librte_ether/rte_ethdev.h | 74 ++++++++++++++++++++++++++-------------- 3 files changed, 54 insertions(+), 31 deletions(-)
Signature · 1 line
1.7.4.1
PATCH 1/1 ethdev: added additional packet count parameter to RX callbacks
In reply to a message not in the archiveAdded a parameter to the RX callback to pass in the number of available RX packets in addition to the number of dequeued packets. This provides the RX callback functions with additional information that can be used to decide how packets from a burst are handled.
The TX callback doesn't require this additional parameter so the RX and TX callbacks no longer have the same function parameters. As such the single RX/TX callback has been refactored into two separate callbacks.
--- examples/rxtx_callbacks/main.c | 3 +- lib/librte_ether/rte_ethdev.c | 8 ++-- lib/librte_ether/rte_ethdev.h | 74 ++++++++++++++++++++++++++-------------- 3 files changed, 54 insertions(+), 31 deletions(-)
examples/rxtx_callbacks/main.c +2 -1
@@ -61,7 +61,8 @@ static struct {static uint16_t add_timestamps(uint8_t port __rte_unused, uint16_t qidx __rte_unused, - struct rte_mbuf **pkts, uint16_t nb_pkts, void *_ __rte_unused) +struct rte_mbuf **pkts,uint16_t nb_pkts, + uint16_t max_pkts __rte_unused, void *_ __rte_unused) {unsigned i;uint64_t now =rte_rdtsc ();
lib/librte_ether/rte_ethdev.c +4 -4
@@ -3533,7 +3533,7 @@ rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type,void *rte_eth_add_rx_callback (uint8_t port_id,uint16_t queue_id, -rte_rxtx_callback_fn fn,void *user_param) +rte_rx_callback_fn fn,void *user_param) {#ifndef RTE_ETHDEV_RXTX_CALLBACKS rte_errno =ENOTSUP ;
@@ -3553,7 +3553,7 @@ rte_eth_add_rx_callback(uint8_t port_id, uint16_t queue_id,return NULL ; } - cb->fn = fn; + cb->fn.rx = fn; cb->param = user_param; cb->next = rte_eth_devices[port_id].post_rx_burst_cbs[queue_id]; rte_eth_devices[port_id].post_rx_burst_cbs[queue_id] = cb;
@@ -3562,7 +3562,7 @@ rte_eth_add_rx_callback(uint8_t port_id, uint16_t queue_id,void *rte_eth_add_tx_callback (uint8_t port_id,uint16_t queue_id, -rte_rxtx_callback_fn fn,void *user_param) +rte_tx_callback_fn fn,void *user_param) {#ifndef RTE_ETHDEV_RXTX_CALLBACKS rte_errno =ENOTSUP ;
@@ -3582,7 +3582,7 @@ rte_eth_add_tx_callback(uint8_t port_id, uint16_t queue_id,return NULL ; } - cb->fn = fn; + cb->fn.tx = fn; cb->param = user_param; cb->next = rte_eth_devices[port_id].pre_tx_burst_cbs[queue_id]; rte_eth_devices[port_id].pre_tx_burst_cbs[queue_id] = cb;
lib/librte_ether/rte_ethdev.h +48 -26
137 lines not on this page · raw message
Signature · 1 line
1.7.4.1
Quoted 17 lines · John McNamara
This patch is a minor extension to the recent patchset for RX/TX callbacks based on feedback from users implementing solutions based on it.
The patch adds a new parameter to the RX callback to pass in the number of available RX packets in addition to the number of dequeued packets. This provides the RX callback functions with additional information that can be used to decide how packets from a burst are handled.
The TX callback doesn't require this additional parameter so the RX and TX callbacks no longer have the same function parameters. As such the single RX/TX callback has been refactored into two separate callbacks.
Since this is an API change we hope it can be included in 2.0.0 to avoid changing the API in a subsequent release.
Quoted 12 lines
John McNamara (1):
ethdev: added additional packet count parameter to RX callbacksexamples/rxtx_callbacks/main.c | 3 +- lib/librte_ether/rte_ethdev.c | 8 ++-- lib/librte_ether/rte_ethdev.h | 74 ++++++++++++++++++++++++++-------------- 3 files changed, 54 insertions(+), 31 deletions(-)Signature · 1 line
1.7.4.1
Well, we're well past the new feature phase of this cycle, so I would say NACK. I would also suggest that you don't need to modify ABI to accomodate this feature. Instead just document the pkts array to be terminated by a reserved value, so that the callback can determine its size dynamically. You could alternatively create a new api call that allows you to retrieve that information from the context of the callback.
Neil
Quoted 11 lines
-----Original Message-----
From: Neil Horman [mailto:[email protected]]
Sent: Thursday, March 12, 2015 7:16 PM
To: Mcnamara, John
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] ethdev: additional parameter in RX callback
Quoted 2 lines
Well, we're well past the new feature phase of this cycle, so I would say NACK.
Hi Neil,
This is more of a bug fix than a feature request.
In retrospect it was a mistake not to have the same function declaration in the callbacks as in the rte_eth_XX_burst functions since it was likely that the callbacks would need access to the same information.
This patch is trying to fix that error before it is set in stone.
John
Quoted 32 lines · Neil Horman
Quoted 17 lines · John McNamara
This patch is a minor extension to the recent patchset for RX/TX callbacks based on feedback from users implementing solutions based on it.
The patch adds a new parameter to the RX callback to pass in the number of available RX packets in addition to the number of dequeued packets. This provides the RX callback functions with additional information that can be used to decide how packets from a burst are handled.
The TX callback doesn't require this additional parameter so the RX and TX callbacks no longer have the same function parameters. As such the single RX/TX callback has been refactored into two separate callbacks.
Since this is an API change we hope it can be included in 2.0.0 to avoid changing the API in a subsequent release.
Quoted 12 lines
John McNamara (1):
ethdev: added additional packet count parameter to RX callbacksexamples/rxtx_callbacks/main.c | 3 +- lib/librte_ether/rte_ethdev.c | 8 ++-- lib/librte_ether/rte_ethdev.h | 74 ++++++++++++++++++++++++++-------------- 3 files changed, 54 insertions(+), 31 deletions(-)Signature · 1 line
1.7.4.1
Quoted 9 lines
Well, we're well past the new feature phase of this cycle, so I would say NACK. I would also suggest that you don't need to modify ABI to accomodate this feature. Instead just document the pkts array to be terminated by a reserved value, so that the callback can determine its size dynamically. You could alternatively create a new api call that allows you to retrieve that information from the context of the callback.
Neil
Yes, I would agree we are past the new feature phase. However, given that we are making a change to the API, and a fairly small change too - adding one extra parameter - we think that the benefit of including this now outweighs any risk of merging the patch. It seems a bit crazy to ship a release with a new API and then immediately change the API straight after release. Is it not better to take the received feedback on the API and fix/improve it pre-release before it gets set-in-stone?
/Bruce
Quoted 51 lines · Bruce Richardson
Quoted 32 lines · Neil Horman
Quoted 17 lines · John McNamara
This patch is a minor extension to the recent patchset for RX/TX callbacks based on feedback from users implementing solutions based on it.
The patch adds a new parameter to the RX callback to pass in the number of available RX packets in addition to the number of dequeued packets. This provides the RX callback functions with additional information that can be used to decide how packets from a burst are handled.
The TX callback doesn't require this additional parameter so the RX and TX callbacks no longer have the same function parameters. As such the single RX/TX callback has been refactored into two separate callbacks.
Since this is an API change we hope it can be included in 2.0.0 to avoid changing the API in a subsequent release.
Quoted 12 lines
John McNamara (1):
ethdev: added additional packet count parameter to RX callbacksexamples/rxtx_callbacks/main.c | 3 +- lib/librte_ether/rte_ethdev.c | 8 ++-- lib/librte_ether/rte_ethdev.h | 74 ++++++++++++++++++++++++++-------------- 3 files changed, 54 insertions(+), 31 deletions(-)Signature · 1 line
1.7.4.1Quoted 9 lines
Well, we're well past the new feature phase of this cycle, so I would say NACK. I would also suggest that you don't need to modify ABI to accomodate this feature. Instead just document the pkts array to be terminated by a reserved value, so that the callback can determine its size dynamically. You could alternatively create a new api call that allows you to retrieve that information from the context of the callback.
Neil
Yes, I would agree we are past the new feature phase. However, given that we are making a change to the API, and a fairly small change too - adding one extra parameter - we think that the benefit of including this now outweighs any risk of merging the patch. It seems a bit crazy to ship a release with a new API and then immediately change the API straight after release. Is it not better to take the received feedback on the API and fix/improve it pre-release before it gets set-in-stone?
Quoted 3 lines
/Bruce
See above, the API doesn't need to change at all to accomodate this as far as I can see.
Neil
Quoted 52 lines · Neil Horman
Quoted 51 lines · Bruce Richardson
Quoted 32 lines · Neil Horman
Quoted 17 lines · John McNamara
This patch is a minor extension to the recent patchset for RX/TX callbacks based on feedback from users implementing solutions based on it.
The patch adds a new parameter to the RX callback to pass in the number of available RX packets in addition to the number of dequeued packets. This provides the RX callback functions with additional information that can be used to decide how packets from a burst are handled.
The TX callback doesn't require this additional parameter so the RX and TX callbacks no longer have the same function parameters. As such the single RX/TX callback has been refactored into two separate callbacks.
Since this is an API change we hope it can be included in 2.0.0 to avoid changing the API in a subsequent release.
Quoted 12 lines
John McNamara (1):
ethdev: added additional packet count parameter to RX callbacksexamples/rxtx_callbacks/main.c | 3 +- lib/librte_ether/rte_ethdev.c | 8 ++-- lib/librte_ether/rte_ethdev.h | 74 ++++++++++++++++++++++++++-------------- 3 files changed, 54 insertions(+), 31 deletions(-)Signature · 1 line
1.7.4.1Quoted 9 lines
Well, we're well past the new feature phase of this cycle, so I would say NACK. I would also suggest that you don't need to modify ABI to accomodate this feature. Instead just document the pkts array to be terminated by a reserved value, so that the callback can determine its size dynamically. You could alternatively create a new api call that allows you to retrieve that information from the context of the callback.
Neil
Yes, I would agree we are past the new feature phase. However, given that we are making a change to the API, and a fairly small change too - adding one extra parameter - we think that the benefit of including this now outweighs any risk of merging the patch. It seems a bit crazy to ship a release with a new API and then immediately change the API straight after release. Is it not better to take the received feedback on the API and fix/improve it pre-release before it gets set-in-stone?
Quoted 8 lines
Quoted 3 lines
/Bruce
See above, the API doesn't need to change at all to accomodate this as far as I can see.
Neil
Yes, there are alternative ways to see about accomplishing the same thing, but they are not nearly as clear as adding in the extra param. That's why we'd like to see this change go in before release, if possible. If it doesn't make 2.0 I'd like to see it in 2.1, but at the cost of having an API change and the additional versionning and deprecation that ensues.
Regards,
/Bruce
Quoted 60 lines · Bruce Richardson
Quoted 59 lines · Neil Horman
Quoted 51 lines · Bruce Richardson
Quoted 32 lines · Neil Horman
Quoted 17 lines · John McNamara
This patch is a minor extension to the recent patchset for RX/TX callbacks based on feedback from users implementing solutions based on it.
The patch adds a new parameter to the RX callback to pass in the number of available RX packets in addition to the number of dequeued packets. This provides the RX callback functions with additional information that can be used to decide how packets from a burst are handled.
The TX callback doesn't require this additional parameter so the RX and TX callbacks no longer have the same function parameters. As such the single RX/TX callback has been refactored into two separate callbacks.
Since this is an API change we hope it can be included in 2.0.0 to avoid changing the API in a subsequent release.
Quoted 12 lines
John McNamara (1):
ethdev: added additional packet count parameter to RX callbacksexamples/rxtx_callbacks/main.c | 3 +- lib/librte_ether/rte_ethdev.c | 8 ++-- lib/librte_ether/rte_ethdev.h | 74 ++++++++++++++++++++++++++-------------- 3 files changed, 54 insertions(+), 31 deletions(-)Signature · 1 line
1.7.4.1Quoted 9 lines
Well, we're well past the new feature phase of this cycle, so I would say NACK. I would also suggest that you don't need to modify ABI to accomodate this feature. Instead just document the pkts array to be terminated by a reserved value, so that the callback can determine its size dynamically. You could alternatively create a new api call that allows you to retrieve that information from the context of the callback.
Neil
Yes, I would agree we are past the new feature phase. However, given that we are making a change to the API, and a fairly small change too - adding one extra parameter - we think that the benefit of including this now outweighs any risk of merging the patch. It seems a bit crazy to ship a release with a new API and then immediately change the API straight after release. Is it not better to take the received feedback on the API and fix/improve it pre-release before it gets set-in-stone?
Quoted 3 lines
/Bruce
See above, the API doesn't need to change at all to accomodate this as far as I can see.
Quoted 7 lines
Quoted 1 line
Neil
Yes, there are alternative ways to see about accomplishing the same thing, but they are not nearly as clear as adding in the extra param. That's why we'd like to see this change go in before release, if possible. If it doesn't make 2.0 I'd like to see it in 2.1, but at the cost of having an API change and the additional versionning and deprecation that ensues.
Plese set asside the ABI issue for a moment. I get that you're trying to get it in prior to needing to version it. Thats not the argument. The argument is how best to codify the new information you want to express in the callback. For this specific case, I think there are better ways to do this than to just blindly add a new parameter. Encoding the array size implicitly with a terminating marker lets you use this equally well with the tx and rx callbacks (should you ever need it on the latter), and isn't uncommon to do at all. It also lets you avoid the odd bugs that arise should the caller ever mis-encode the array length such that it doesn't match the actual array size.
Using additional context sensitive functions are also nice, because they are additive without being ABI breaking. That is to say, in the future, if you want to export more information to a callback you can do so by adding an API call that simply didnt' exist before. Thats a nice feature to be able to support.
Just adding more parameters isn't the only (nor in my view) the more flexible way to do this
Neil
Quoted 4 lines
Regards,
/Bruce
Quoted 10 lines
-----Original Message-----
From: Neil Horman [mailto:[email protected]]
Sent: Friday, March 13, 2015 3:09 PM
To: Richardson, Bruce
Cc: Mcnamara, John; [email protected]
Subject: Re: [dpdk-dev] [PATCH] ethdev: additional parameter in RX callback
Quoted 5 lines
Plese set asside the ABI issue for a moment. I get that you're trying to get it in prior to needing to version it. Thats not the argument. The argument is how best to codify the new information you want to express in the callback. For this specific case, I think there are better ways to do this than to just blindly add a new parameter.
Hi Neil,
I think that is good advice is the general case but this is a very specific case. The modified callback is only used in rte_eth_rx_burst(). For context here is the function in its entirety (without #defs). The substantive change (the addition of nb_pkts) is on the line with an asterisk:
static inline uint16_t
rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id,
struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
{
struct rte_eth_dev *dev;
dev = &rte_eth_devices[port_id];
int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
rx_pkts, nb_pkts);
struct rte_eth_rxtx_callback *cb = dev->post_rx_burst_cbs[queue_id];
if (unlikely(cb != NULL)) {
do {
nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
* nb_pkts, cb->param);
cb = cb->next;
} while (cb != NULL);
}
return nb_rx;
}Quoted 3 lines
Encoding the array size
implicitly with a terminating marker lets you use this equally well with the tx and rx callbacks (should you ever need it on the latter)
Is encoding the information in the array really a better solution here? The cb->param already exists for passing in user defined information to the callback. The proposed patch merely transmits the parent function arguments to the enclosed callback.
John
Quoted 36 lines · John
Quoted 10 lines
-----Original Message-----
From: Neil Horman [mailto:[email protected]]
Sent: Friday, March 13, 2015 3:09 PM
To: Richardson, Bruce
Cc: Mcnamara, John; [email protected]
Subject: Re: [dpdk-dev] [PATCH] ethdev: additional parameter in RX callbackQuoted 5 lines
Plese set asside the ABI issue for a moment. I get that you're trying to get it in prior to needing to version it. Thats not the argument. The argument is how best to codify the new information you want to express in the callback. For this specific case, I think there are better ways to do this than to just blindly add a new parameter.
Hi Neil,
I think that is good advice is the general case but this is a very specific case. The modified callback is only used in
rte_eth_rx_burst(). For context here is the function in its entirety (without #defs). The substantive change (the addition ofnb_pkts) is on the line with an asterisk:static inline uint16_t rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id, struct rte_mbuf **rx_pkts, const uint16_t nb_pkts) { struct rte_eth_dev *dev; dev = &rte_eth_devices[port_id]; int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id], rx_pkts, nb_pkts); struct rte_eth_rxtx_callback *cb = dev->post_rx_burst_cbs[queue_id]; if (unlikely(cb != NULL)) { do {
Quoted 9 lines
nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
* nb_pkts, cb->param);
cb = cb->next;
} while (cb != NULL);
}
return nb_rx;
}Not sure I grok your point here. Why impact does the number of internal callouts for the callback api have on how we structure the API to external consumers?
Quoted 6 lines
Quoted 3 lines
Encoding the array size
implicitly with a terminating marker lets you use this equally well with the tx and rx callbacks (should you ever need it on the latter)Is encoding the information in the array really a better solution here? The
cb->paramalready exists for passing in user defined information to the callback. The proposed patch merely transmits the parent function arguments to the enclosed callback.
The cb->param can't be used here, because its opaque to the internals of the DPDK. rte_eth_rx_burst doesn't (and can't) know where in the cb->params pointer to store that information. Thats why you added an additional parameter in the first place, isn't it? My point is that using an array terminator keeps us out of this habbit of just adding parameters to communicate more information (as thats an ABI breaking method, and not particularly scalable if there is more information to be transmitted in the future). Using a context sensitive API set goes beyond even that, and allows to retrieve arbitrary information form callbacks as needed in an ABI safe manner
Neil
Quoted 8 lines
John
Quoted 11 lines
-----Original Message-----
From: Neil Horman [mailto:[email protected]]
Sent: Friday, March 13, 2015 5:32 PM
To: Mcnamara, John
Cc: Richardson, Bruce; [email protected]
Subject: Re: [dpdk-dev] [PATCH] ethdev: additional parameter in RX callbackQuoted 1 line
Is encoding the information in the array really a better solution here?
Quoted 8 lines
The
cb->paramalready exists for passing in user defined information to the callback. The proposed patch merely transmits the parent function arguments to the enclosed callback.Quoted 1 line
The
cb->paramcan't be used here, because its opaque to the internals of the DPDK.rte_eth_rx_burstdoesn't (and can't) know where in the cb-Quoted 1 line
params pointer to store that information. Thats why you added an
additional parameter in the first place, isn't it?
Yes. That is correct.
Quoted 7 lines
My point is that using
an array terminator keeps us out of this habbit of just adding parameters to communicate more information (as thats an ABI breaking method, and not particularly scalable if there is more information to be transmitted in the future). Using a context sensitive API set goes beyond even that, and allows to retrieve arbitrary information form callbacks as needed in an ABI safe manner
Again I can agree with this in the general case, but it isn't necessary, in this case, to encode the information in the array since it is already local to and available in the function. It seems artificial, at this point, to implement an array terminator solution to protect an API that, effectively, hasn't been published yet.
John
Quoted 15 lines · John
Quoted 15 lines
-----Original Message-----
From: Neil Horman [mailto:[email protected]]
Sent: Friday, March 13, 2015 5:32 PM
To: Mcnamara, John
Cc: Richardson, Bruce; [email protected]
Subject: Re: [dpdk-dev] [PATCH] ethdev: additional parameter in RX callbackQuoted 1 line
Is encoding the information in the array really a better solution here?
The
cb->paramalready exists for passing in user defined information to the callback. The proposed patch merely transmits the parent function arguments to the enclosed callback.Quoted 1 line
Quoted 7 lines
Quoted 4 lines
The
cb->paramcan't be used here, because its opaque to the internals of the DPDK.rte_eth_rx_burstdoesn't (and can't) know where in the cb-Quoted 1 line
params pointer to store that information. Thats why you added an
additional parameter in the first place, isn't it?
Yes. That is correct.
Then why did you suggest doing so?
Quoted 10 lines
Quoted 7 lines
My point is that using
an array terminator keeps us out of this habbit of just adding parameters to communicate more information (as thats an ABI breaking method, and not particularly scalable if there is more information to be transmitted in the future). Using a context sensitive API set goes beyond even that, and allows to retrieve arbitrary information form callbacks as needed in an ABI safe mannerAgain I can agree with this in the general case, but it isn't necessary, in this case, to encode the information in the array since it is already local to and available in the function. It seems artificial, at this point, to implement an array terminator solution to protect an API that, effectively, hasn't been published yet.
You indicate that you agree an alternate solution is preferable in the general case, so as to provide an API that is extensible in a way that isn't subject to ABI breakage, correct? If so, why do assert that its not necessecary in this specific case? If you feel you need to add information so that callbacks can be more flexible (in this case specifying the size of a passed in array), why immediately shoehorn another parmeter in place, and break the consistency between rx and tx callbacks, when you don't have to? I don't care if you break ABI today (although to call it unpublished I think is disingenuous, as lots of testing and development has already taken place with the ABI as it currently stands). I care, as I noted above about not getting into the habbit of just assuming a change like this requires that you invaliate ABI somehow. You don't have to, you can create an API that is fairly invariant to it here if you like. The question in my mind is, why don't you?
Neil
Quoted 6 lines
John
2015-03-13 19:15, Neil Horman:
Quoted 31 lines · John
Quoted 7 lines
From: Neil Horman [mailto:[email protected]]
Quoted 6 lines
Quoted 2 lines
Is encoding the information in the array really a better solution here?
The
cb->paramalready exists for passing in user defined information to the callback. The proposed patch merely transmits the parent function arguments to the enclosed callback.Quoted 1 line
Quoted 7 lines
Quoted 4 lines
The
cb->paramcan't be used here, because its opaque to the internals of the DPDK.rte_eth_rx_burstdoesn't (and can't) know where in the cb-Quoted 1 line
params pointer to store that information. Thats why you added an
additional parameter in the first place, isn't it?
Yes. That is correct.
Then why did you suggest doing so?
Quoted 8 lines
Quoted 7 lines
My point is that using
an array terminator keeps us out of this habbit of just adding parameters to communicate more information (as thats an ABI breaking method, and not particularly scalable if there is more information to be transmitted in the future). Using a context sensitive API set goes beyond even that, and allows to retrieve arbitrary information form callbacks as needed in an ABI safe mannerQuoted 6 lines
Again I can agree with this in the general case, but it isn't necessary, in this case, to encode the information in the array since it is already local to and available in the function. It seems artificial, at this point, to implement an array terminator solution to protect an API that, effectively, hasn't been published yet.
Quoted 13 lines
You indicate that you agree an alternate solution is preferable in the general case, so as to provide an API that is extensible in a way that isn't subject to ABI breakage, correct? If so, why do assert that its not necessecary in this specific case? If you feel you need to add information so that callbacks can be more flexible (in this case specifying the size of a passed in array), why immediately shoehorn another parmeter in place, and break the consistency between rx and tx callbacks, when you don't have to? I don't care if you break ABI today (although to call it unpublished I think is disingenuous, as lots of testing and development has already taken place with the ABI as it currently stands). I care, as I noted above about not getting into the habbit of just assuming a change like this requires that you invaliate ABI somehow. You don't have to, you can create an API that is fairly invariant to it here if you like. The question in my mind is, why don't you?
I think John is saying that the API of rte_eth_rx_burst() already includes the nb_pkts parameter. So it's natural to push it to the callback. I also think Neil is saying that this parameter is useless in the callback and in rte_eth_rx_burst() if the array was null terminated.
In any case, having a mix (null termination + parameter in rte_eth_rx_burst) is not acceptable.
Moreover, I wonder how efficient are the compiler optimizations in each loop case (index and null termination).
As the API was using an integer count, my opinion is to keep it and push it to the callback for 2.0.
If null termination is validated to be better, it could be a later rework.
Is there something I'm missing?
Thoughts?
Quoted 46 lines · Thomas Monjalon
2015-03-13 19:15, Neil Horman:
Quoted 31 lines · John
Quoted 7 lines
From: Neil Horman [mailto:[email protected]]
Quoted 6 lines
Quoted 2 lines
Is encoding the information in the array really a better solution here?
The
cb->paramalready exists for passing in user defined information to the callback. The proposed patch merely transmits the parent function arguments to the enclosed callback.Quoted 1 line
Quoted 7 lines
Quoted 4 lines
The
cb->paramcan't be used here, because its opaque to the internals of the DPDK.rte_eth_rx_burstdoesn't (and can't) know where in the cb-Quoted 1 line
params pointer to store that information. Thats why you added an
additional parameter in the first place, isn't it?
Yes. That is correct.
Then why did you suggest doing so?
Quoted 8 lines
Quoted 7 lines
My point is that using
an array terminator keeps us out of this habbit of just adding parameters to communicate more information (as thats an ABI breaking method, and not particularly scalable if there is more information to be transmitted in the future). Using a context sensitive API set goes beyond even that, and allows to retrieve arbitrary information form callbacks as needed in an ABI safe mannerQuoted 6 lines
Again I can agree with this in the general case, but it isn't necessary, in this case, to encode the information in the array since it is already local to and available in the function. It seems artificial, at this point, to implement an array terminator solution to protect an API that, effectively, hasn't been published yet.
Quoted 13 lines
You indicate that you agree an alternate solution is preferable in the general case, so as to provide an API that is extensible in a way that isn't subject to ABI breakage, correct? If so, why do assert that its not necessecary in this specific case? If you feel you need to add information so that callbacks can be more flexible (in this case specifying the size of a passed in array), why immediately shoehorn another parmeter in place, and break the consistency between rx and tx callbacks, when you don't have to? I don't care if you break ABI today (although to call it unpublished I think is disingenuous, as lots of testing and development has already taken place with the ABI as it currently stands). I care, as I noted above about not getting into the habbit of just assuming a change like this requires that you invaliate ABI somehow. You don't have to, you can create an API that is fairly invariant to it here if you like. The question in my mind is, why don't you?
Quoted 8 lines
I think John is saying that the API of
rte_eth_rx_burst()already includes thenb_pktsparameter. So it's natural to push it to the callback. I also think Neil is saying that this parameter is useless in the callback and inrte_eth_rx_burst()if the array was null terminated.
In any case, having a mix (null termination + parameter inrte_eth_rx_burst) is not acceptable.
Moreover, I wonder how efficient are the compiler optimizations in each loop case (index and null termination).
Compiler can't optimize/unroll the loop in the null termination case. For the passing-the-size through option, in any app where the RX buffer size is constant, i.e. probably a lot of them - like in our examples, the compiler can do loop unrolling, and possibly other optimizations on the known value. [Whether it choses too or not, is not something we have tested :-)]
/Bruce
Quoted 7 lines
As the API was using an integer count, my opinion is to keep it and push it to the callback for 2.0.
If null termination is validated to be better, it could be a later rework.Is there something I'm missing?
Thoughts?
Quoted 55 lines · Thomas Monjalon
2015-03-13 19:15, Neil Horman:
Quoted 31 lines · John
Quoted 7 lines
From: Neil Horman [mailto:[email protected]]
Quoted 6 lines
Quoted 2 lines
Is encoding the information in the array really a better solution here?
The
cb->paramalready exists for passing in user defined information to the callback. The proposed patch merely transmits the parent function arguments to the enclosed callback.Quoted 1 line
Quoted 7 lines
Quoted 4 lines
The
cb->paramcan't be used here, because its opaque to the internals of the DPDK.rte_eth_rx_burstdoesn't (and can't) know where in the cb-Quoted 1 line
params pointer to store that information. Thats why you added an
additional parameter in the first place, isn't it?
Yes. That is correct.
Then why did you suggest doing so?
Quoted 8 lines
Quoted 7 lines
My point is that using
an array terminator keeps us out of this habbit of just adding parameters to communicate more information (as thats an ABI breaking method, and not particularly scalable if there is more information to be transmitted in the future). Using a context sensitive API set goes beyond even that, and allows to retrieve arbitrary information form callbacks as needed in an ABI safe mannerQuoted 6 lines
Again I can agree with this in the general case, but it isn't necessary, in this case, to encode the information in the array since it is already local to and available in the function. It seems artificial, at this point, to implement an array terminator solution to protect an API that, effectively, hasn't been published yet.
Quoted 13 lines
You indicate that you agree an alternate solution is preferable in the general case, so as to provide an API that is extensible in a way that isn't subject to ABI breakage, correct? If so, why do assert that its not necessecary in this specific case? If you feel you need to add information so that callbacks can be more flexible (in this case specifying the size of a passed in array), why immediately shoehorn another parmeter in place, and break the consistency between rx and tx callbacks, when you don't have to? I don't care if you break ABI today (although to call it unpublished I think is disingenuous, as lots of testing and development has already taken place with the ABI as it currently stands). I care, as I noted above about not getting into the habbit of just assuming a change like this requires that you invaliate ABI somehow. You don't have to, you can create an API that is fairly invariant to it here if you like. The question in my mind is, why don't you?
I think John is saying that the API of
rte_eth_rx_burst()already includes thenb_pktsparameter. So it's natural to push it to the callback. I also think Neil is saying that this parameter is useless in the callback and inrte_eth_rx_burst()if the array was null terminated.
In any case, having a mix (null termination + parameter inrte_eth_rx_burst) is not acceptable.
Moreover, I wonder how efficient are the compiler optimizations in each loop case (index and null termination).
Quoted 4 lines
As the API was using an integer count, my opinion is to keep it and push it to the callback for 2.0.
If null termination is validated to be better, it could be a later rework.
I'm fine with this if thats the consensus, I'm more interested in making sure we think about these problems in such a way that we're not just running from ABI issues, because we're eventually going to have to deal with them Neil
Quoted 3 lines
Is there something I'm missing?
Thoughts?
2015-03-23 12:00, Neil Horman:
Quoted 15 lines · Thomas Monjalon
Quoted 9 lines
I think John is saying that the API of
rte_eth_rx_burst()already includes thenb_pktsparameter. So it's natural to push it to the callback. I also think Neil is saying that this parameter is useless in the callback and inrte_eth_rx_burst()if the array was null terminated.
In any case, having a mix (null termination + parameter inrte_eth_rx_burst) is not acceptable.
Moreover, I wonder how efficient are the compiler optimizations in each loop case (index and null termination).Quoted 4 lines
As the API was using an integer count, my opinion is to keep it and push it to the callback for 2.0.
If null termination is validated to be better, it could be a later rework.
Quoted 4 lines
I'm fine with this if thats the consensus, I'm more interested in making sure we think about these problems in such a way that we're not just running from ABI issues, because we're eventually going to have to deal with them Neil
Applied, thanks