From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id EA4D56880 for ; Thu, 20 Nov 2014 04:50:36 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 19 Nov 2014 20:01:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208,217";a="419052586" Received: from kmsmsx153.gar.corp.intel.com ([172.21.73.88]) by FMSMGA003.fm.intel.com with ESMTP; 19 Nov 2014 19:51:35 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by KMSMSX153.gar.corp.intel.com (172.21.73.88) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 20 Nov 2014 12:00:59 +0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.182]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.110]) with mapi id 14.03.0195.001; Thu, 20 Nov 2014 12:00:58 +0800 From: "Zhou, Danny" To: Robert Sanford Thread-Topic: [dpdk-dev] Enhance KNI DPDK-app-side to be Multi-Producer/Consumer Thread-Index: AdAATsFuOFSVQkZQSEOfgayUigXcoQAGA4TQAOQUPYAAHwr3sA== Date: Thu, 20 Nov 2014 04:00:58 +0000 Message-ID: References: In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] Enhance KNI DPDK-app-side to be Multi-Producer/Consumer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Nov 2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HN1Y2Nlc3M7DQorICB1bnNpZ25lZCBpOw0KKyAg Y29uc3QgdWludDMyX3QgbWFzayA9IHByb2QtPm1hc2s7DQorDQorICAvKiBNb3ZlIHByb2QtPmhl YWQgYXRvbWljYWxseS4gKi8NCisgIGRvIHsNCisgICAgIC8qIFJlc2V0IG4gdG8gdGhlIGluaXRp YWwgYnVyc3QgY291bnQuICovDQorICAgICBuID0gbWF4Ow0KKw0KKyAgICAgcHJvZF9oZWFkID0g cHJvZC0+aGVhZDsNCisgICAgIGNvbnNfdGFpbCA9IGZpZm8tPnJlYWQ7DQorDQorICAgICBmcmVl X2VudHJpZXMgPSAobWFzayArIGNvbnNfdGFpbCAtIHByb2RfaGVhZCkgJiBtYXNrOw0KKw0KKyAg ICAgLyogQ2hlY2sgdGhhdCB3ZSBoYXZlIGVub3VnaCByb29tIGluIHJpbmcuICovDQorICAgICBp ZiAodW5saWtlbHkobiA+IGZyZWVfZW50cmllcykpIHsNCisgICAgICAgICBpZiAodW5saWtlbHko ZnJlZV9lbnRyaWVzID09IDApKQ0KKyAgICAgICAgICAgIHJldHVybiAwOw0KKyAgICAgICAgIG4g PSBmcmVlX2VudHJpZXM7DQorICAgICB9DQorDQorICAgICBwcm9kX25leHQgPSAocHJvZF9oZWFk ICsgbikgJiBtYXNrOw0KKyAgICAgc3VjY2VzcyA9IHJ0ZV9hdG9taWMzMl9jbXBzZXQoJnByb2Qt PmhlYWQsIHByb2RfaGVhZCwgcHJvZF9uZXh0KTsNCisgIH0gd2hpbGUgKHVubGlrZWx5KHN1Y2Nl c3MgPT0gMCkpOw0KKw0KKyAgLyogV3JpdGUgZW50cmllcyBpbiByaW5nLiAqLw0KKyAgZm9yIChp ID0gMDsgaSA8IG47IGkrKykgew0KKyAgICAgZmlmby0+YnVmZmVyWyhwcm9kX2hlYWQgKyBpKSAm IG1hc2tdID0gZGF0YVtpXTsNCisgIH0NCisgIHJ0ZV9jb21waWxlcl9iYXJyaWVyKCk7DQorDQor ICAvKiBJZ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