From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-f196.google.com (mail-io0-f196.google.com [209.85.223.196]) by dpdk.org (Postfix) with ESMTP id D10EE6C94 for ; Tue, 11 Oct 2016 13:30:55 +0200 (CEST) Received: by mail-io0-f196.google.com with SMTP id q192so1404638iod.0 for ; Tue, 11 Oct 2016 04:30:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=jzRS+cbtlaxyf7X43njijS+4P5tCNWcosmLTKU9EHpw=; b=qGh4wusgDtvK6zTtNFQu06xINn4kvIMDkOd3ltinMnWbxdUJhpTJeUCz+J7MEUM0N0 TgnfJ0c4cN+8/IVBJ9obcaRydaJ7+j2Rpqbuv5qjrRY8TkHBpCAh9S3MpsmhVeaGoa/x kR7cM3ahBbf8FcXTCUgRq+KG1mRDdtvp+LKeT7CUL1EzB2B7/mmK+BEE48xC3V5EtZi4 eMARhkViMe7KyoFSNos0fmDyIxwC9BATjaXxWvY8Fys+HKzkaEO8LAgSTAGDk6zJip3i 2fOKY0FVmhe+kwl+YVyTAn+IJeJ/LSKKY77FRnq/dimWWlCQZIVK4rg/hZW4ifeOQy2W D+ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=jzRS+cbtlaxyf7X43njijS+4P5tCNWcosmLTKU9EHpw=; b=lT9Ul8qareCCWhitpog7w/+HGoX9jT0mutxL8J3lNtWiuxHuCCvHRwhtnhEXNArzXo wGYkLHKyM6Ny4M7/Op84+X2u4kgGMhsWU679H6hPbnQr0dY9uxB7FvfJt3XYeWeX+dym a175SdtpIyi6rmSoiJOBCAMBR/xXdlaMPEtqRJMTiGqmtNyJt1xeRBltLSl6b1yZ1T26 y9TC4+5RwmnD4IsDlP1UULnBOOBVAMTXsOqZwMDWAO40s0ZfLnn89paAxoazXxHX/Kvp iXqa/FzGOk6aeK3WV4V+5TDIodEMyN1ci4Rbk6Q7WDwR4D89y+5TpvP9URqGFSdF7QzV S8KQ== X-Gm-Message-State: AA6/9RlRFG5aKE6byRawFZvQu7OQd9wZikn/Ahxuw6Pr/j9Obs0uaBAurXd1nkumJABH1WE5IIzOX9qgZqqEAg== X-Received: by 10.107.11.165 with SMTP id 37mr5251569iol.210.1476185455170; Tue, 11 Oct 2016 04:30:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.2.229 with HTTP; Tue, 11 Oct 2016 04:30:54 -0700 (PDT) In-Reply-To: <1475592311-25749-1-git-send-email-keith.wiles@intel.com> References: <1474423220-10207-1-git-send-email-keith.wiles@intel.com> <1475592311-25749-1-git-send-email-keith.wiles@intel.com> From: =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= Date: Tue, 11 Oct 2016 13:30:54 +0200 Message-ID: To: Keith Wiles Cc: dev@dpdk.org, pmatilai@redhat.com, yuanhan.liu@linux.intel.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH v4] drivers/net:new PMD using tun/tap host interface 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: Tue, 11 Oct 2016 11:30:56 -0000 2016-10-04 16:45 GMT+02:00, Keith Wiles : > The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces > on the local host. The PMD allows for DPDK and the host to > communicate using a raw device interface on the host and in > the DPDK application. The device created is a Tap device with > a L2 packet header. [...] > +static uint16_t > +pmd_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) > +{ > + int len, n; > + struct rte_mbuf *mbuf; > + struct rx_queue *rxq =3D queue; > + struct pollfd pfd; > + uint16_t num_rx; > + unsigned long num_rx_bytes =3D 0; > + > + pfd.events =3D POLLIN; > + pfd.fd =3D rxq->fd; > + for (num_rx =3D 0; num_rx < nb_pkts; ) { > + n =3D poll(&pfd, 1, 0); > + > + if (n <=3D 0) > + break; > + Considering that syscalls are rather expensive, it would be cheaper to allocate an mbuf here and free it when read() returns -1 instead of calling poll() to check whether a packet is waiting. This way you save a syscall per packet and replace one syscall with one mbuf free per poll. Best Regards, Micha=C5=82=C2=A0Miros=C5=82aw