Message ID | 1418900657-21427-2-git-send-email-maxim.uvarov@linaro.org |
---|---|
State | New |
Headers | show |
On 12/18/2014 02:17 PM, Stuart Haslam wrote: > On Thu, Dec 18, 2014 at 11:04:14AM +0000, Maxim Uvarov wrote: >> Correctly remove queue from packet i/o and remove it from scheduler. >> >> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> >> --- >> platform/linux-generic/odp_packet_io.c | 28 +++++++++++++++++++++++++++- >> 1 file changed, 27 insertions(+), 1 deletion(-) >> >> diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c >> index 3ca8100..80c1e82 100644 >> --- a/platform/linux-generic/odp_packet_io.c >> +++ b/platform/linux-generic/odp_packet_io.c >> @@ -391,7 +391,33 @@ int odp_pktio_inq_setdef(odp_pktio_t id, odp_queue_t queue) >> >> int odp_pktio_inq_remdef(odp_pktio_t id) >> { >> - return odp_pktio_inq_setdef(id, ODP_QUEUE_INVALID); >> + pktio_entry_t *pktio_entry = get_pktio_entry(id); >> + odp_queue_t queue; >> + queue_entry_t *qentry; >> + >> + if (pktio_entry == NULL) >> + return -1; >> + >> + lock_entry(pktio_entry); >> + queue = pktio_entry->s.inq_default; >> + qentry = queue_to_qentry(queue); >> + >> + queue_lock(qentry); >> + if (qentry->s.status == QUEUE_STATUS_FREE) { >> + queue_unlock(qentry); >> + unlock_entry(pktio_entry); >> + return -1; >> + } >> + >> + qentry->s.enqueue = queue_enq_dummy; >> + qentry->s.enqueue_multi = queue_enq_multi_dummy; >> + qentry->s.status = QUEUE_STATUS_FREE; > As per previous comment, should not be setting this to _FREE. Oh, sorry. Will fix. > > And what about queue->s.pktin?.. I think it should be cleared here but > I'm not completely sure what's happening within the queue/schedule code > at this point. I think it should be cleared so that pkio can not more reference to that queue. >> + queue_unlock(qentry); >> + >> + pktio_entry->s.inq_default = ODP_QUEUE_INVALID; >> + unlock_entry(pktio_entry); >> + >> + return 0; >> } >> >> odp_queue_t odp_pktio_inq_getdef(odp_pktio_t id) >> -- >> 1.8.5.1.163.gd7aced9 >>
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 3ca8100..80c1e82 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -391,7 +391,33 @@ int odp_pktio_inq_setdef(odp_pktio_t id, odp_queue_t queue) int odp_pktio_inq_remdef(odp_pktio_t id) { - return odp_pktio_inq_setdef(id, ODP_QUEUE_INVALID); + pktio_entry_t *pktio_entry = get_pktio_entry(id); + odp_queue_t queue; + queue_entry_t *qentry; + + if (pktio_entry == NULL) + return -1; + + lock_entry(pktio_entry); + queue = pktio_entry->s.inq_default; + qentry = queue_to_qentry(queue); + + queue_lock(qentry); + if (qentry->s.status == QUEUE_STATUS_FREE) { + queue_unlock(qentry); + unlock_entry(pktio_entry); + return -1; + } + + qentry->s.enqueue = queue_enq_dummy; + qentry->s.enqueue_multi = queue_enq_multi_dummy; + qentry->s.status = QUEUE_STATUS_FREE; + queue_unlock(qentry); + + pktio_entry->s.inq_default = ODP_QUEUE_INVALID; + unlock_entry(pktio_entry); + + return 0; } odp_queue_t odp_pktio_inq_getdef(odp_pktio_t id)
Correctly remove queue from packet i/o and remove it from scheduler. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- platform/linux-generic/odp_packet_io.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)