From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 962C511D9 for ; Tue, 31 Jan 2017 14:21:44 +0100 (CET) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP; 31 Jan 2017 05:21:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,315,1477983600"; d="scan'208";a="59205148" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.237.220.38]) ([10.237.220.38]) by orsmga005.jf.intel.com with ESMTP; 31 Jan 2017 05:21:28 -0800 To: Pascal Mazon , 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> Cc: dev@dpdk.org From: Ferruh Yigit Message-ID: <705b3fcf-5db5-c3e6-32e5-ae9c56231db0@intel.com> Date: Tue, 31 Jan 2017 13:21:28 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <1485855778-15496-6-git-send-email-pascal.mazon@6wind.com> Content-Type: text/plain; charset=windows-1252 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 13:21:45 -0000 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. 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; > + } <...>