Hi Petri,

Thank you!

I think it's my misunderstanding now. mTCP is also caring about queue number 
with cpu_id. So mTCP can call the APIs 

odp_pktin_recv and odp_pktout_send.

e.g. From mTCP
int32_t xxx_recv_pkts(struct mtcp_thread_context *ctxt, int ifidx)
int ifidx is the port number as odp_pktio_t;
and 'int cpu' from struct mtcp_thread_context is according queue index which is 
the same with cupid.

struct mtcp_thread_context
{
        int cpu;
        pthread_t thread;
        uint8_t done:1, 
                        exit:1, 
                        interrupt:1;

        struct mtcp_manager* mtcp_manager;

        void *io_private_context;
        pthread_mutex_t smap_lock;
        pthread_mutex_t flow_pool_lock;
        pthread_mutex_t socket_pool_lock;

#if LOCK_STREAM_QUEUE
#if USE_SPIN_LOCK
        pthread_spinlock_t connect_lock;
        pthread_spinlock_t close_lock;
        pthread_spinlock_t reset_lock;
        pthread_spinlock_t sendq_lock;
        pthread_spinlock_t ackq_lock;
        pthread_spinlock_t destroyq_lock;
#else
        pthread_mutex_t connect_lock;
        pthread_mutex_t close_lock;
        pthread_mutex_t reset_lock;
        pthread_mutex_t sendq_lock;
        pthread_mutex_t ackq_lock;
        pthread_mutex_t destroyq_lock;
#endif /* USE_SPIN_LOCK */
#endif /* LOCK_STREAM_QUEUE */
};

From Zaibo
Thank you!


-----邮件原件-----
发件人: Savolainen, Petri (Nokia - FI/Espoo) [mailto:petri.savolai...@nokia.com] 
发送时间: 2016年3月21日 17:13
收件人: Xu Zaibo; lng-odp@lists.linaro.org
抄送: Huwei (Xavier); chenlizhi; Liuzhongzhu; zhouxufeng 00215716; yangfajun; 
Tangchaofei
主题: RE: [question] why tha APIS of odp_pktio_send and odp_pktio_recv are 
removed in v1.8.0.0?

Hi,

Single queue per interface is still the default configuration. You can find an 
example of that e.g. in example/ odp_l2fwd_simple/odp_l2fwd_simple.c

See under the minimum configuration to open a pktio interface with a single 
input and output queue. Usage of single queue handle vs. pktio handle in 
recv/send is not very different from previous (single queue) API.

-Petri

        odp_pktio_t pktio;
        odp_pktin_queue_t pktin;
        odp_pktout_queue_t pktout;
        odp_pktio_param_t pktio_param;

        odp_pktio_param_init(&pktio_param);

        pktio = odp_pktio_open(name, pool, &pktio_param);
        if (pktio == ODP_PKTIO_INVALID)
                exit(1);

        if (odp_pktin_queue_config(pktio, NULL))
                exit(1);

        if (odp_pktout_queue_config(pktio, NULL))
                exit(1);

        if (odp_pktin_queue(pktio, &pktin, 1) != 1)
                exit(1);

        if (odp_pktout_queue(pktio, &pktout, 1) != 1)
                exit(1);

        if (odp_pktio_start(pktio))
                exit(1);

        pkts = odp_pktin_recv(pktin, pkt_tbl, MAX_PKT_BURST);

        sent = odp_pktout_send(pktout, pkt_tbl, pkts);



From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT Xu 
Zaibo
Sent: Monday, March 21, 2016 10:16 AM
To: lng-odp@lists.linaro.org
Cc: Huwei (Xavier) <xavier.hu...@huawei.com>; chenlizhi <chenli...@huawei.com>; 
Liuzhongzhu <liuzhong...@huawei.com>; zhouxufeng 00215716 
<zhouxuf...@huawei.com>; yangfajun <yangfa...@huawei.com>; Tangchaofei 
<tangchao...@huawei.com>
Subject: [lng-odp] [question] why tha APIS of odp_pktio_send and odp_pktio_recv 
are removed in v1.8.0.0?

Hi All,
As we know, 'odp_pktio_send' and 'odp_pktio_recv' operate packets by the port, 
users need not care for queues of port. 
Instead, there are only 'odp_pktin_recv' and 'odp_pktout_send' APIs in 
v1.8.0.0, which user must input queue index.
So I really don't understand why users should and have to care for queues. 
  For example, mTCP is not taking queues of port(pktio) in consideration. So 
far, we need more queues because we need more threads or processes to operate 
packets, and we do need 'odp_pktin_recv' and 'odp_pktout_send' APIs, but I 
think 'odp_pktio_send' and 'odp_pktio_recv' APIs should be kept and not just 
push queues assigning job to users , since not all users care about queues.

From Zaibo Xu
Thank you!
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to