From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wj0-f182.google.com (mail-wj0-f182.google.com [209.85.210.182]) by dpdk.org (Postfix) with ESMTP id BB47E11D9 for ; Tue, 31 Jan 2017 15:32:48 +0100 (CET) Received: by mail-wj0-f182.google.com with SMTP id uo9so14801495wjc.1 for ; Tue, 31 Jan 2017 06:32:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=W8cImY00J9v3+oJRLfp9AQ/p/PJv9Ai3+ThbNGI8P4c=; b=IKlgPDpgtj420sdVTW3GR+mdNUjLwzE3S/0KNQ9QAfGv5YZ8ANcDUgsBO1xcZUqTis +GmBbQnUgWEOOKnvsyzg/cLFu1lwUa+BMpRZ7WQewxJXVCTz3lEn3vvdqzOA960/tFM9 pPgqZKqMQ5Zb9wlvkmhuvkidiZdSerGleDH7W8xDLO681NC85lZfS4D6gGdgpmgDN/ow AGjP3alvLHxB2YIRM+ZRDn6E1tITSOetL/iI1KSboF16/lUbzdPih5GeY0Uu0l07wNBK vDXQhErbycjLKyev0iTQ4lWC0W5myUhQ4Z0f2ttcrhHR9Rf+KSe6QSy8v08FaqULS1ZI eGDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=W8cImY00J9v3+oJRLfp9AQ/p/PJv9Ai3+ThbNGI8P4c=; b=XAzLmf59mLa+isTi78xl+WanfsK8mJAdQGLe0xg/xmCL81SbuuZNStYtKwm9zqpzXa Pym1E/JdvDQyrs/OvpnJlS+xp6eEauWAPhdDSystRlJPi7dyFBsoaeZ0xVp+34rE4sjk UTGgSPEBtThZlYXaHkS3bOzRLxyxgN9JXjjbDTAV5UfOmn6uFGSo2rmv6bCSK/0qQDOX Hd1hglfAXrbxkdmlEWRfNqVAOQGaL9ytSYYS/5pzyFB91xG6YGQegdJP8sNDL0s/hGl8 iknk84LzbAiO1cFss7AqKf9N9s6TUIkR6L4XoQ1LApv6R7aDbsJbTU43K61E197QuCIx BcIw== X-Gm-Message-State: AIkVDXJDxY8qfSrBXrR6LOsUkRQJS0uB3qBprU2a2zck4YVDuG/j2EAiuG2wk2kPXMwy713T X-Received: by 10.223.153.135 with SMTP id y7mr24153454wrb.55.1485873168175; Tue, 31 Jan 2017 06:32:48 -0800 (PST) Received: from [10.16.0.184] (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id p49sm28483918wrb.10.2017.01.31.06.32.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jan 2017 06:32:47 -0800 (PST) To: Ferruh Yigit , keith.wiles@intel.com References: <1485855778-15496-1-git-send-email-pascal.mazon@6wind.com> <1485855778-15496-6-git-send-email-pascal.mazon@6wind.com> <705b3fcf-5db5-c3e6-32e5-ae9c56231db0@intel.com> Cc: dev@dpdk.org From: Pascal Mazon Message-ID: <98c45b0e-c9a8-b6ec-eeee-aba004ea0c2b@6wind.com> Date: Tue, 31 Jan 2017 15:31:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 MIME-Version: 1.0 In-Reply-To: <705b3fcf-5db5-c3e6-32e5-ae9c56231db0@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 6/6] net/tap: implement link up and down callbacks 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: Tue, 31 Jan 2017 14:32:48 -0000 On 01/31/2017 02:21 PM, Ferruh Yigit wrote: > On 1/31/2017 9:42 AM, Pascal Mazon wrote: >> Signed-off-by: Pascal Mazon >> --- >> drivers/net/tap/rte_eth_tap.c | 59 +++++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 59 insertions(+) >> >> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c >> index 734e3a579219..9b6bbff5fd81 100644 >> --- a/drivers/net/tap/rte_eth_tap.c >> +++ b/drivers/net/tap/rte_eth_tap.c >> @@ -405,6 +405,63 @@ tap_link_update(struct rte_eth_dev *dev __rte_unused, >> return 0; >> } >> >> +static int tap_link_set(struct pmd_internals *pmd, int state) >> +{ >> + struct ifreq ifr; >> + int err, s; >> + >> + /* >> + * An AF_INET/DGRAM socket is needed for >> + * SIOCGIFFLAGS/SIOCSIFFLAGS, using fd won't work. >> + */ >> + s = socket(AF_INET, SOCK_DGRAM, 0); >> + if (s < 0) { >> + RTE_LOG(ERR, PMD, >> + "Unable to get a socket to set flags: %s\n", >> + strerror(errno)); >> + return -1; >> + } >> + memset(&ifr, 0, sizeof(ifr)); >> + strncpy(ifr.ifr_name, pmd->name, IFNAMSIZ); > > Again how this will behave for multiple queue setup. The link status is not related to the number of queues. As long as there is at least one queue configured (if the last queue is closed, then the netdevice is effectively deleted entirely), it is possible to set the link up or down. With the link down, no queues will be able to receive or send packets. > > Rest looks good. > >> + err = ioctl(s, SIOCGIFFLAGS, &ifr); >> + if (err < 0) { >> + RTE_LOG(ERR, PMD, "Unable to get tap netdevice flags: %s\n", >> + strerror(errno)); >> + close(s); >> + return -1; >> + } > <...> > -- Pascal Mazon www.6wind.com