From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from BAY004-OMC2S13.hotmail.com (bay004-omc2s13.hotmail.com [65.54.190.88]) by dpdk.org (Postfix) with ESMTP id 7670FB6D for ; Fri, 27 Jan 2017 23:31:54 +0100 (CET) Received: from NAM02-CY1-obe.outbound.protection.outlook.com ([65.54.190.124]) by BAY004-OMC2S13.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Fri, 27 Jan 2017 14:31:53 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=q6tXWRHJmf7izNREnkSMdrCqHXfYagzrAk2FlXbiixs=; b=I8tY0s5Tt6Tdi8bw76X76BDJ4qCJy5m5MhqEynnnICXTdrYgPatetv3fh0tuWLI99NNEZxAuQviellVbw7u2fDAPAay+dr/GFeuZjQG3/1lZqmqVj374I9I5DQMXFqxxTwQpf+3U8lkaETNegNIhlNGFWQYJwkVjFGz0mQUNOMUBDL1a3MIPB7ECa2SK4JMUZUwxhALcaxRi5fasGZvsAClK5bNdl9F38y3vesdHGGjvYytOmFptedOw6o6EcJEWM2eu0xUqcU0+B7vo2hsTgtWnhMrgHIbkSdueco8gEhfiK2FRlLa6MkTAU/pFKMpMBzxOk/hvpPHQHnraYzDwzA== Received: from CY1NAM02FT051.eop-nam02.prod.protection.outlook.com (10.152.74.56) by CY1NAM02HT142.eop-nam02.prod.protection.outlook.com (10.152.75.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.8; Fri, 27 Jan 2017 22:31:52 +0000 Received: from MWHPR01MB2429.prod.exchangelabs.com (10.152.74.53) by CY1NAM02FT051.mail.protection.outlook.com (10.152.74.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.2 via Frontend Transport; Fri, 27 Jan 2017 22:31:52 +0000 Received: from MWHPR01MB2429.prod.exchangelabs.com ([10.168.202.139]) by MWHPR01MB2429.prod.exchangelabs.com ([10.168.202.139]) with mapi id 15.01.0860.023; Fri, 27 Jan 2017 22:31:52 +0000 From: Sridhar Pitchai To: Bruce Richardson CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] rte_eth_from_rings Thread-Index: AQHSeNEcRFPkerJFR0OwOwUl5qaAJqFM2TSAgAAKZHg= Date: Fri, 27 Jan 2017 22:31:52 +0000 Message-ID: References: , <20170127213629.GA91748@bricha3-MOBL3.ger.corp.intel.com> In-Reply-To: <20170127213629.GA91748@bricha3-MOBL3.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=outlook.com; x-incomingtopheadermarker: OriginalChecksum:41A0313EA4F346E1383F7B47B1EE439246C7C03AFDB39E25ECE552100E96E728; UpperCasedChecksum:4DD5917D38D5880AA646BA84350600FB2B1E77F6F0C221514EE470BA1FAF592E; SizeAsReceived:7783; Count:39 x-tmn: [VjUHQndQGnoapNgpbDVykfrLu3jJe+re] x-incomingheadercount: 39 x-eopattributedmessage: 0 x-microsoft-exchange-diagnostics: 1; CY1NAM02HT142; 7:LVk/okwD0nzQUbIg47gp38rC68p7kgp0kstiPgqV6uIhG38f+zisPczi2S2WjrI3cgJnAHzuN+bgM8loIwzZBUiSYvDFQGA60fSYAPXAnoc4dCAsOLQioagX67LJYrj4dKK+75MCK5Oh6CgOVyUAKDdkCkEKjo8wLaah7+80fkTZZzvJBj9JEXNqGenkZQLigQe7Jxgbkn2tY1xjfVP3/e7wVEaOEc/z3/o3y2oy7OOi+yTtB4VJbZH7vWGnsotwz2xbOh+bKkJcdM2js7lLBVpibqtfBXrYWdR0lzC0vRyFOQoi6iw/pb2byVr/M4FVHeS9/ogFm85FrdrAFg7DCghPOcL8LhDrqP+7pkrCOX5tAUO4CI6HSdxMEAoR2PpH/QXA0L5EnjFXIx9pmmBxkP30T7KRcsjzZ0j8MI6pIExxAr0hA7LGDxF9cFmgvuustDufaAbaB6mJDHpGEM8kaA== x-forefront-antispam-report: EFV:NLI; SFV:NSPM; SFS:(10019020)(98900005); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1NAM02HT142; H:MWHPR01MB2429.prod.exchangelabs.com; FPR:; SPF:None; LANG:en; x-ms-office365-filtering-correlation-id: 3efae4f1-459c-459d-6cda-08d447044af5 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(1601124038)(5061506344)(1603103113)(1601125047)(1603101340)(1701031023); SRVR:CY1NAM02HT142; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444111334)(444112120)(432015012)(82015046); SRVR:CY1NAM02HT142; BCL:0; PCL:0; RULEID:; SRVR:CY1NAM02HT142; x-forefront-prvs: 0200DDA8BE spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Jan 2017 22:31:52.8431 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1NAM02HT142 X-OriginalArrivalTime: 27 Jan 2017 22:31:53.0796 (UTC) FILETIME=[29054840:01D278ED] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] rte_eth_from_rings 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, 27 Jan 2017 22:31:55 -0000 Thanks Bruce. I have created eth_dev from the rings as below. rt =3D rte_eth_from_rings(port_p->name, (struct rte_ring * const*)port_p->rx_ring_p, 2, (struct rte_ring * const*)port_p->tx_ring_p, 2, rte_socket_id()); Lets say I have a call back something like pkt_rx(void * pkt_p, struct pkt_metadata_t *meta_p) which is called when there is a pkt at the chip. inside this function(pkt_rx) i will find the port and the corresponding rin= g_p and enqueue the pkt into the queue. I am assuming this should work. Kindly corr= ect me if i misunderstood you. question 2: Can use this eth_dev to create KNI interface, like below. rte_eth_dev_info_get(fp_p->port_list[port].key.port_id, &dev_info); ; ; ; ops.port_id =3D fp_p->port_list[port].key.port_id; // rt from rte_eth_from= _rings(...) ops.change_mtu =3D _kni_ifconfig_mtu; // static function ops.config_network_if =3D _kni_ifconfig; // static function= s PORT(fp_p, port).kni_p =3D rte_kni_alloc(PORT(fp_p, port).mbuf_p, &conf, &ops= ); I am assuming this should work as well. I find the netdevs created but when= i try to configure them i am facing the following error. root@ VM snaproute/softpath (master) >ifconfig PORT_8 PORT_8 Link encap:Ethernet HWaddr be:35:c3:0f:f8:2f BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) root@ VM snaproute/softpath (master) >ifconfig PORT_8 20.1.1.1/24 up SIOCSIFFLAGS: Timer expired SIOCSIFFLAGS: Timer expired root@ VM snaproute/softpath (master) > Thanks for the help. Thanks, Sridhar Pitchai ________________________________ From: Bruce Richardson Sent: Friday, January 27, 2017 1:36 PM To: Sridhar Pitchai Cc: dev@dpdk.org Subject: Re: [dpdk-dev] rte_eth_from_rings On Fri, Jan 27, 2017 at 07:16:25PM +0000, Sridhar Pitchai wrote: > Hi, > > I am trying to write a data path for packets punted to CPU(slowpath) from= vender silicon like broadcom. I am planing to use "rte_eth_from_rings" lik= e model where I will be able to read and write to the ring for the packets = punted from vendor chip. > > > the eth_dev abstraction provided by "rte_eth_from_rings" helps to build t= he dpdk data path. Can someone help me on how to read and write to the ring= s that is emulating the eth_dev. > > To use the rings like an ethdev just use rte_eth_rx_burst and rte_eth_tx_burst, passing in the port id of your newly created rings ethdev. To access them directly as rings, just use the ring enqueue/dequeue functions passing in the ring pointer as normal. Regards, /Bruce