From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0053.outbound.protection.outlook.com [104.47.42.53]) by dpdk.org (Postfix) with ESMTP id 7AEDB1B402 for ; Fri, 22 Dec 2017 16:17:42 +0100 (CET) Received: from BLUPR0301CA0006.namprd03.prod.outlook.com (10.162.113.144) by BN6SPR00MB046.namprd03.prod.outlook.com (10.174.239.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.15; Fri, 22 Dec 2017 15:17:40 +0000 Received: from BY2FFO11FD006.protection.gbl (2a01:111:f400:7c0c::187) by BLUPR0301CA0006.outlook.office365.com (2a01:111:e400:5259::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.345.14 via Frontend Transport; Fri, 22 Dec 2017 15:17:40 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD006.mail.protection.outlook.com (10.1.14.127) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.302.6 via Frontend Transport; Fri, 22 Dec 2017 15:17:24 +0000 Received: from sunil-OptiPlex-790.ap.freescale.net (sunil-OptiPlex-790.ap.freescale.net [10.232.132.53]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vBMFHVev024113; Fri, 22 Dec 2017 08:17:38 -0700 From: Sunil Kumar Kori To: CC: , Date: Fri, 22 Dec 2017 20:47:17 +0530 Message-ID: <20171222151725.11273-4-sunil.kori@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171222151725.11273-1-sunil.kori@nxp.com> References: <20171215130828.14218-7-sunil.kori@nxp.com> <20171222151725.11273-1-sunil.kori@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131584294451846246; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(336005)(376002)(396003)(346002)(39380400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(104016004)(5890100001)(2950100002)(54906003)(16586007)(6916009)(50226002)(6666003)(316002)(85426001)(575784001)(68736007)(86362001)(8656006)(36756003)(498600001)(50466002)(51416003)(356003)(47776003)(305945005)(5660300001)(48376002)(77096006)(97736004)(4326008)(105606002)(2906002)(8936002)(1076002)(81166006)(2351001)(81156014)(106466001)(76176011)(8676002)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6SPR00MB046; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD006; 1:UKVVLI5JwwWmSi1B57644E+IjEJAIaw56i+A3nEky84JNcjy8bp+uaAlbF0qVPlB3WD/MtEGIJAHFMeoOaIUV6mcbDpGCJhjjr9Oc3yorhDcH1rm08IDmm5ghY9C8BAZ MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 677820f6-657e-4976-9c66-08d5494f1b49 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:BN6SPR00MB046; X-Microsoft-Exchange-Diagnostics: 1; BN6SPR00MB046; 3:vQm9kpr3h+rj6WN6RbfCiY0/basOstMV5KE44j1cj99jO5mQxhwEUlBSJxQBsNFAM0fQe/HXSMaKMrfg6VlmrUNyViz2Usx8f27xGWQpW33GwGLp1OHRM67ktramcJ3T/CMfThRrzzJvg3OCTJDQK9fqcWMWvNkYHTNg3LbhuPnzRx9djYzLOEh0mlIXdpxHUy/PQ3QSBmKG/jJd5y895DqPfh3/Iki3TEgZ6rQImOyaGeGBiBY6hTDZqssPxpCnI9+9NptbzwESS/k8o9+rvYYWQ+4uEpT9Yc0ta7H2pe6R+S/+HfHjbmFiNY3jaS0UQOV4IvPD778XSaUoUhBFs9lIFDOs5xLtqnfzJpjxhOw=; 25:uSJ6DnHM90d1Tc+9IElUHy2glKYNeghSJdCBcA0OuZpPfjkq9JKra0TcRTth87V+pr3OLk/y44xTzIkBbYX1xv7uzajEzQTbI3GGSybPSGM3vALn0UJLV+tNqLt2lEGrVHJhtdpGp3qw3OXfgYC+UqZO3bWHGj0fERzsDmH4vmpm2z8iJI7cR16QYi3rCZQzIvMPgSs13VNZLUPHen2Hw4y2EaRETrSuIk4+wBNKbE9RJP04tl/10VfOv7qD7FpQPHJ7mDwe+Zx24rBzZgnXKFJfhNr2H6oSQSSkiT0DN7oaj/NPLR9b21indWVniqTUbmz2vAjEMT1tJ50lhh1fGQ== X-MS-TrafficTypeDiagnostic: BN6SPR00MB046: X-Microsoft-Exchange-Diagnostics: 1; BN6SPR00MB046; 31:oUMgDfwJX7HfA2NQU3jJArfeaLYC4OuSRsUHOHysfDjYbqhKnAnn9VtPFqFmJ9AdtFf8DcQoAMKMXNcrCtZ16RD4oTIJm0CEVhW8E+Hd+JdeXmtUHeF7YtwdwGCef2W3rJb50/zy/dRR9lzVPHzG3JmdFKJTLcMw5Nz4DHCul95XdIKcFp0BBIR4IFI/AyOhjICLqLtga2Co+j82QWKxpnQsHgaPcJibm1f4tUhDWzM=; 4:JaB9+y11+ndVK1CWQFqYQmjewRlXa3+RjScQLajwMDsT+zgAOEHuFxfN/AsMnSQRgrU3xWTXVEm07cN6LC1FKszX0tdooEp0x4ReRA28gPBAcJOsDCyrNpQ1B/MUzLSssd6rtBhq/nfmfPOJMEJYml6/xQyuQ+QT9KA1A+Nd6836E/LppO4LAjSWWfKppAYso13x2gRd/wGrbahFUWSvoNt6KLsXB5FPy7ys/PAuf1WlNucdJByqoy7oq78kckXmvVRHK4Y/kaWp1q4wWbgyAgIg3oHJbGZfCfW9iA2A8/zjvYZxrThV/svHLOkHMUuw X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(3231023)(944510044)(944921044)(946801044)(946901044)(6055026)(6096035)(20161123563025)(20161123561025)(20161123556025)(20161123565025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123559100)(201708071742011); SRVR:BN6SPR00MB046; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BN6SPR00MB046; X-Forefront-PRVS: 05299D545B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6SPR00MB046; 23:sbyrk8VYQ9TT0utuc1QT66A4WssezOGq8gplojs7r?= =?us-ascii?Q?H/8tne17/77xDWyyGCo+viUY0K3rzAnUhZPw9Yw1wtmj5I2H399rkRQSvAiV?= =?us-ascii?Q?WypnbkSpYTgFtkc9ry/wYURjwIm9CkFk/iV1vOmE8IJek1F7G+N3XRxkQFzz?= =?us-ascii?Q?PDDiG69f7db3zRdDJXMTuSZDyGX0hAJ/2LxmnA6O5yPT3Z0bQAfn+lYDjkB4?= =?us-ascii?Q?Yt/ZQ4mhccmpx2vVDnJ8m8DBSr8GXJC3QMO0BHSP1Nq/TEmWc35im1m7drc4?= =?us-ascii?Q?YpU7O3TwWpx0mfeH1K2ZoZXxTShmRFIj/t2JxziUrLrn4XVzxwD4e/1FCpMb?= =?us-ascii?Q?ArjMMB4cEekEQF9utxL8M7yKsuDwLHvg9WUL8lLf33T4DoSsToMPw2wvWp5P?= =?us-ascii?Q?rFofjan3/y7Y5GwZ7Jm68JwtwMlhmBNXxYDcD94UV4/tizKCehrU/9LaFEml?= =?us-ascii?Q?58R27DUwGamJZUsdfX1LED+d5RIM4R1/D3cqcLE0NZwzv81P11NFz7427Q/i?= =?us-ascii?Q?pHLGynQgbsoI0/qpa0WkijUyLXEqphqSnH08AYhxY4/xY2o6MPXx2XiVHer8?= =?us-ascii?Q?lx4dvtmzn5SnPWU0bCl7bPxkP/FkAhuuEzBY3e8PDVGeqNnjzz87HW29K0iP?= =?us-ascii?Q?A8EyI08dHZeP0bTFgW3RKBsS2KGhM8BzkpMi9tDDOjKtQElA1dIR/1US24ak?= =?us-ascii?Q?TvTY5grRx5Dbon6brANShwQmmMSyFl1oiTBb3rU/ahH67QbIELoP3aAWhhJu?= =?us-ascii?Q?JFXaCTe34mG7VqhMS7CsVu9U7K8MrTqzYMrNbHnMXxCfAvbJPdLSlrRNkNy/?= =?us-ascii?Q?2pAw1lASA7YgjwKLTHR1ohrzVDVbPGUplCUR6AfbufDJT0mh6u5nc/BH1PMR?= =?us-ascii?Q?NiwS+B/wWaWCz33b8+8FkrqKDPXikuzvwQ9NZ6DQkg86JHqtOjKtIYJ7pvjF?= =?us-ascii?Q?D729BnxACXX7PddkcpLp1BLG3CJV/Cr7deBtRNz7L8SDmbWF3JjOIgkzOBES?= =?us-ascii?Q?uG/yXk87qaWPTkgX67oYp/bJ8aAOEbtIJgK/+WIO/cSxE9p3L+S6QCCnEsyy?= =?us-ascii?Q?k0TElfsatOCanezsXpjfOdLYtOjD/tvXis980Jz8C7LA3Hme9eh17iQvvk+B?= =?us-ascii?Q?KfXAq8pU55n89S8jNeHYSAYSbimviverOpZQtyrbj9ywVKPE+MWnQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN6SPR00MB046; 6:Jf+5/orO0wHK+EKDXGZ8wVdNurgJSrr6f5tJ/WraOtzRrLza/9YFTbcg018OA3iafa4fn5RJ7oOrrDRdaqsn5ZlolTrUUJ1j0k/OZlJj0ml7YzIqJeYAqk6G3g52u7VAt5kly9X+ma/ohLYeMiKg6aD2kyBi6Z1gcG6LuK3ilMeFVN2E0A/aAoIU4F04jtu2eXzoAr4oujLTvUW3pHKwmKAxm+mKnLleDX2IyNLVqJVbfdKexEB2G35kxKRgrQk+Mei0YmSrzLnBcoR/3DC5G/6JvpUQx3mvW+7faVyaysKhU3/FQOH1qZIZSNeHija8V7NjTBsvpQsC/gDs5i7mP/sYoppAVTIg/TJkF5xiwa0=; 5:iXURiQ3RPVNopq0Qtxb+IOdaPtHdMP60eYkVdnxyrutku1MTgOssaHOsoB3MdvL3WqSOiOU4RT3kwcAEEucQyAUO1FS3Jkd+DYMI1Y/mA/rF5LPwAGt0XV0mrjHJ1sgS3HhMpW23RYawSAIBFN364HOuc94WJpc/SH0UFi8EchQ=; 24:Y/K+A6edzIJCmBlNOz4dTzj2wuCFxHj86ptH8nDJaYzGofMVVCAqcBM2y7wpvNiyoXZ90FwJlHWdAbRS0zj5lcb4rL7EmyuwC19lh1TaRKk=; 7:MCELbWB2TevuYxiUR5BJZiBU0L8jVEcWBOISPcgofmfA369Xiqe6p8XAl/pVrNEdC7ov3QQ/737/zXLHX+0pCDe5SXBeHVG2RBE4R/kId1XWjv+qB74Fb46UzX3MMW++yfXgoHe56Kf0jWWvloXsQEJvfA7BAOyvCTfMG9yTL7jX5rdNxo8vxKKMBlpziHD0WSzmuuuBauPZcvpstEpaVrHKrmcQab87GV1bES/CnXwTRoLoygH+xKWxHR9RcvO+ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Dec 2017 15:17:24.9974 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 677820f6-657e-4976-9c66-08d5494f1b49 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6SPR00MB046 Subject: [dpdk-dev] [PATCH v2 04/12] net/dpaa: ethdev Rx queue configurations with eventdev X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Dec 2017 15:17:43 -0000 Given ethernet Rx queues can be attached with event queue in parallel or atomic mode. Patch imlmplements Rx queue configuration, attachment/detachment with given event queue and their corresponding callbacks to handle events from respective queues. Signed-off-by: Sunil Kumar Kori --- drivers/net/dpaa/Makefile | 2 + drivers/net/dpaa/dpaa_ethdev.c | 110 ++++++++++++++++++++++++++++-- drivers/net/dpaa/dpaa_ethdev.h | 29 ++++++++ drivers/net/dpaa/dpaa_rxtx.c | 80 +++++++++++++++++++++- drivers/net/dpaa/rte_pmd_dpaa_version.map | 2 + 5 files changed, 214 insertions(+), 9 deletions(-) diff --git a/drivers/net/dpaa/Makefile b/drivers/net/dpaa/Makefile index a99d1ee..c644353 100644 --- a/drivers/net/dpaa/Makefile +++ b/drivers/net/dpaa/Makefile @@ -43,7 +43,9 @@ CFLAGS += -I$(RTE_SDK_DPAA)/ CFLAGS += -I$(RTE_SDK_DPAA)/include CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/include/ +CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/base/qbman CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa +CFLAGS += -I$(RTE_SDK)/drivers/event/dpaa CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal/include diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 7798994..457e421 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -121,6 +121,21 @@ static const struct rte_dpaa_xstats_name_off dpaa_xstats_strings[] = { static struct rte_dpaa_driver rte_dpaa_pmd; +static inline void +dpaa_poll_queue_default_config(struct qm_mcc_initfq *opts) +{ + memset(opts, 0, sizeof(struct qm_mcc_initfq)); + opts->we_mask = QM_INITFQ_WE_FQCTRL | QM_INITFQ_WE_CONTEXTA; + opts->fqd.fq_ctrl = QM_FQCTRL_AVOIDBLOCK | QM_FQCTRL_CTXASTASHING | + QM_FQCTRL_PREFERINCACHE; + opts->fqd.context_a.stashing.exclusive = 0; + if (dpaa_svr_family != SVR_LS1046A_FAMILY) + opts->fqd.context_a.stashing.annotation_cl = + DPAA_IF_RX_ANNOTATION_STASH; + opts->fqd.context_a.stashing.data_cl = DPAA_IF_RX_DATA_STASH; + opts->fqd.context_a.stashing.context_cl = DPAA_IF_RX_CONTEXT_STASH; +} + static int dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { @@ -561,6 +576,92 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, return 0; } +int dpaa_eth_eventq_attach(const struct rte_eth_dev *dev, + int eth_rx_queue_id, + u16 ch_id, + const struct rte_event_eth_rx_adapter_queue_conf *queue_conf) +{ + int ret; + u32 flags = 0; + struct dpaa_if *dpaa_intf = dev->data->dev_private; + struct qman_fq *rxq = &dpaa_intf->rx_queues[eth_rx_queue_id]; + struct qm_mcc_initfq opts = {0}; + + dpaa_poll_queue_default_config(&opts); + + switch (queue_conf->ev.sched_type) { + case RTE_SCHED_TYPE_ATOMIC: + opts.fqd.fq_ctrl |= QM_FQCTRL_HOLDACTIVE; + /* Reset FQCTRL_AVOIDBLOCK bit as it is unnecessary + * configuration with HOLD_ACTIVE setting + */ + opts.fqd.fq_ctrl &= (~QM_FQCTRL_AVOIDBLOCK); + rxq->cb.dqrr_dpdk_cb = dpaa_rx_cb_atomic; + break; + case RTE_SCHED_TYPE_ORDERED: + DPAA_PMD_ERR("Ordered queue schedule type is not supported\n"); + return -1; + default: + opts.fqd.fq_ctrl |= QM_FQCTRL_AVOIDBLOCK; + rxq->cb.dqrr_dpdk_cb = dpaa_rx_cb_parallel; + break; + } + + opts.we_mask = opts.we_mask | QM_INITFQ_WE_DESTWQ; + opts.fqd.dest.channel = ch_id; + opts.fqd.dest.wq = queue_conf->ev.priority; + + if (dpaa_intf->cgr_rx) { + opts.we_mask |= QM_INITFQ_WE_CGID; + opts.fqd.cgid = dpaa_intf->cgr_rx[eth_rx_queue_id].cgrid; + opts.fqd.fq_ctrl |= QM_FQCTRL_CGE; + } + + flags = QMAN_INITFQ_FLAG_SCHED; + + ret = qman_init_fq(rxq, flags, &opts); + if (ret) { + DPAA_PMD_ERR("Channel/Queue association failed. fqid %d ret:%d", + rxq->fqid, ret); + return ret; + } + + /* copy configuration which needs to be filled during dequeue */ + memcpy(&rxq->ev, &queue_conf->ev, sizeof(struct rte_event)); + dev->data->rx_queues[eth_rx_queue_id] = rxq; + + return ret; +} + +int dpaa_eth_eventq_detach(const struct rte_eth_dev *dev, + int eth_rx_queue_id) +{ + struct qm_mcc_initfq opts; + int ret; + u32 flags = 0; + struct dpaa_if *dpaa_intf = dev->data->dev_private; + struct qman_fq *rxq = &dpaa_intf->rx_queues[eth_rx_queue_id]; + + dpaa_poll_queue_default_config(&opts); + + if (dpaa_intf->cgr_rx) { + opts.we_mask |= QM_INITFQ_WE_CGID; + opts.fqd.cgid = dpaa_intf->cgr_rx[eth_rx_queue_id].cgrid; + opts.fqd.fq_ctrl |= QM_FQCTRL_CGE; + } + + ret = qman_init_fq(rxq, flags, &opts); + if (ret) { + DPAA_PMD_ERR("init rx fqid %d failed with ret: %d", + rxq->fqid, ret); + } + + rxq->cb.dqrr_dpdk_cb = NULL; + dev->data->rx_queues[eth_rx_queue_id] = NULL; + + return 0; +} + static void dpaa_eth_rx_queue_release(void *rxq __rte_unused) { @@ -881,13 +982,8 @@ static int dpaa_rx_queue_init(struct qman_fq *fq, struct qman_cgr *cgr_rx, return ret; } fq->is_static = false; - opts.we_mask = QM_INITFQ_WE_FQCTRL | QM_INITFQ_WE_CONTEXTA; - opts.fqd.fq_ctrl = QM_FQCTRL_AVOIDBLOCK | QM_FQCTRL_CTXASTASHING | - QM_FQCTRL_PREFERINCACHE; - opts.fqd.context_a.stashing.exclusive = 0; - opts.fqd.context_a.stashing.annotation_cl = DPAA_IF_RX_ANNOTATION_STASH; - opts.fqd.context_a.stashing.data_cl = DPAA_IF_RX_DATA_STASH; - opts.fqd.context_a.stashing.context_cl = DPAA_IF_RX_CONTEXT_STASH; + + dpaa_poll_queue_default_config(&opts); if (cgr_rx) { /* Enable tail drop with cgr on this queue */ diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h index c0a8430..b81522a 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -36,6 +36,7 @@ /* System headers */ #include #include +#include #include #include @@ -50,6 +51,13 @@ #error "Annotation requirement is more than RTE_PKTMBUF_HEADROOM" #endif +/* mbuf->seqn will be used to store event entry index for + * driver specific usage. For parallel mode queues, invalid + * index will be set and for atomic mode queues, valid value + * ranging from 1 to 16. + */ +#define DPAA_INVALID_MBUF_SEQN 0 + /* we will re-use the HEADROOM for annotation in RX */ #define DPAA_HW_BUF_RESERVE 0 #define DPAA_PACKET_LAYOUT_ALIGN 64 @@ -178,4 +186,25 @@ struct dpaa_if_stats { uint64_t tund; /** #include #include +#include #include "dpaa_ethdev.h" #include "dpaa_rxtx.h" #include #include +#include #include #include #include @@ -451,6 +453,67 @@ dpaa_eth_queue_portal_rx(struct qman_fq *fq, return qman_portal_poll_rx(nb_bufs, (void **)bufs, fq->qp); } +enum qman_cb_dqrr_result +dpaa_rx_cb_parallel(void *event, + struct qman_portal *qm __always_unused, + struct qman_fq *fq, + const struct qm_dqrr_entry *dqrr, + void **bufs) +{ + u32 ifid = ((struct dpaa_if *)fq->dpaa_intf)->ifid; + struct rte_mbuf *mbuf; + struct rte_event *ev = (struct rte_event *)event; + + mbuf = dpaa_eth_fd_to_mbuf(&dqrr->fd, ifid); + ev->event_ptr = (void *)mbuf; + ev->flow_id = fq->ev.flow_id; + ev->sub_event_type = fq->ev.sub_event_type; + ev->event_type = RTE_EVENT_TYPE_ETHDEV; + ev->op = RTE_EVENT_OP_NEW; + ev->sched_type = fq->ev.sched_type; + ev->queue_id = fq->ev.queue_id; + ev->priority = fq->ev.priority; + ev->impl_opaque = (uint8_t)DPAA_INVALID_MBUF_SEQN; + mbuf->seqn = DPAA_INVALID_MBUF_SEQN; + *bufs = mbuf; + + return qman_cb_dqrr_consume; +} + +enum qman_cb_dqrr_result +dpaa_rx_cb_atomic(void *event, + struct qman_portal *qm __always_unused, + struct qman_fq *fq, + const struct qm_dqrr_entry *dqrr, + void **bufs) +{ + u8 index; + u32 ifid = ((struct dpaa_if *)fq->dpaa_intf)->ifid; + struct rte_mbuf *mbuf; + struct rte_event *ev = (struct rte_event *)event; + + mbuf = dpaa_eth_fd_to_mbuf(&dqrr->fd, ifid); + ev->event_ptr = (void *)mbuf; + ev->flow_id = fq->ev.flow_id; + ev->sub_event_type = fq->ev.sub_event_type; + ev->event_type = RTE_EVENT_TYPE_ETHDEV; + ev->op = RTE_EVENT_OP_NEW; + ev->sched_type = fq->ev.sched_type; + ev->queue_id = fq->ev.queue_id; + ev->priority = fq->ev.priority; + + /* Save active dqrr entries */ + index = DQRR_PTR2IDX(dqrr); + DPAA_PER_LCORE_DQRR_SIZE++; + DPAA_PER_LCORE_DQRR_HELD |= 1 << index; + DPAA_PER_LCORE_DQRR_MBUF(index) = mbuf; + ev->impl_opaque = index + 1; + mbuf->seqn = (uint32_t)index + 1; + *bufs = mbuf; + + return qman_cb_dqrr_defer; +} + uint16_t dpaa_eth_queue_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) @@ -734,6 +797,7 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) uint32_t frames_to_send, loop, sent = 0; uint16_t state; int ret; + uint32_t seqn, index, flags[DPAA_TX_BURST_SIZE] = {0}; ret = rte_dpaa_portal_init((void *)0); if (ret) { @@ -794,14 +858,26 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) goto send_pkts; } } + seqn = mbuf->seqn; + if (seqn != DPAA_INVALID_MBUF_SEQN) { + index = seqn - 1; + if (DPAA_PER_LCORE_DQRR_HELD & (1 << index)) { + flags[loop] = + ((index & QM_EQCR_DCA_IDXMASK) << 8); + flags[loop] |= QMAN_ENQUEUE_FLAG_DCA; + DPAA_PER_LCORE_DQRR_SIZE--; + DPAA_PER_LCORE_DQRR_HELD &= + ~(1 << index); + } + } } send_pkts: loop = 0; while (loop < frames_to_send) { loop += qman_enqueue_multi(q, &fd_arr[loop], - NULL, - frames_to_send - loop); + &flags[loop], + frames_to_send - loop); } nb_bufs -= frames_to_send; sent += frames_to_send; diff --git a/drivers/net/dpaa/rte_pmd_dpaa_version.map b/drivers/net/dpaa/rte_pmd_dpaa_version.map index d76acbd..888f203 100644 --- a/drivers/net/dpaa/rte_pmd_dpaa_version.map +++ b/drivers/net/dpaa/rte_pmd_dpaa_version.map @@ -6,6 +6,8 @@ DPDK_17.11 { DPDK_18.02 { global: + dpaa_eth_eventq_attach; + dpaa_eth_eventq_detach; rte_pmd_dpaa_set_tx_loopback; local: *; -- 2.9.3