From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by dpdk.org (Postfix) with ESMTP id 6A6DD29CB for ; Mon, 12 Mar 2018 18:33:26 +0100 (CET) Received: by mail-pf0-f193.google.com with SMTP id u5so4645442pfh.6 for ; Mon, 12 Mar 2018 10:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dakMGUcpQa/35sLCFfhi5XC8w+5+LMLlGeyOyWBitnY=; b=IIkFExulylzqLkOeAXZ0hnqicUeYtzk3Fo1xfX4DsrGOXjLDey8lBgzci+K0mSuiuj eVXt4rgfaa+rZCCfEzzTikuI14roROFChfLntgGw2XGiNJAObCccu7m2e4eVzqsBFYMA u0HezZUXBhWfiPBLzGNYwGJpV7gNKSsgmRb97UUHDe9pxbaMLkov4ATjNEljM2QSxUG2 HKBW+2tLiK6i4iKbhjCLQqwtZpgkDqjsD2HI/ubQ9EnaX+gf+9vnuk8s/UorAazIw0qO BMBehU1h0vl//cQlOBLQQksLU1RfF62INaflj5L/J2HJgeFFG91EZSsW8OZpWlH2V0IB PdaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dakMGUcpQa/35sLCFfhi5XC8w+5+LMLlGeyOyWBitnY=; b=Qpb3Bmsi/PYVmsk46GhzbOwh2KtdpCMROZ3dC/RtLtJMQufk9JZTZP343Tf7Xxv43t oZHFupaXlsWiVlnZ5TqSjLBiG8gMy2DNe1P3NRDsxjEof7U3t9IJmvbnwkpB6gl7eX5F Q00Y74s1Nrt0o4v+VwuCfJKvo6UyBzu/wCQpZWprpDeRsFADWqHe7ztj/xRvMI5WH/JA AnUh6zsInuMN1iMnVO9ClWdmVqbg+lxI2buUR8qimDS/RlMuacdXEHRMvMojQMAHackl enVRzzsEKdrYPJiqciO5Cz21ZdC89++Ajacx6+u/wlGxoUWpjuVLoV7cwjk5tqN3GN3V LbYA== X-Gm-Message-State: AElRT7EMfMFntos8BTRQ/XKi2hseLRhGVDxRZ4h94IfWk5ick2dPR8kr EHrKOFWKAPkQOh6EG7UT3NQvQg== X-Google-Smtp-Source: AG47ELueUgx4QO7yzAcxPc3Dpu6WWqFsLXnXsaL31pVgCX6qvTOhVCQXgodIIy1WZBWtZfVkXgEoIw== X-Received: by 10.99.8.4 with SMTP id 4mr7263668pgi.289.1520876004544; Mon, 12 Mar 2018 10:33:24 -0700 (PDT) Received: from xeon-e3 (204-195-71-95.wavecable.com. [204.195.71.95]) by smtp.gmail.com with ESMTPSA id v12sm20745145pfd.141.2018.03.12.10.33.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Mar 2018 10:33:24 -0700 (PDT) Date: Mon, 12 Mar 2018 10:33:17 -0700 From: Stephen Hemminger To: Vipin Varghese Cc: dev@dpdk.org, ferruh.yigit@intel.com, pascal.mazon@6wind.com Message-ID: <20180312103317.01739678@xeon-e3> In-Reply-To: <1520886094-28319-1-git-send-email-vipin.varghese@intel.com> References: <1518446689-26839-1-git-send-email-vipin.varghese@intel.com> <1520886094-28319-1-git-send-email-vipin.varghese@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2] net/tap: allow user MAC to be passed as args 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: Mon, 12 Mar 2018 17:33:26 -0000 On Tue, 13 Mar 2018 01:51:34 +0530 Vipin Varghese wrote: > +static int parse_user_mac(struct ether_addr *user_mac, > + const char *value) > +{ > + unsigned int index = 0; > + char mac_temp[strlen(ETH_TAP_USR_MAC_FMT) + 1], *mac_byte = NULL; > + > + if (user_mac == NULL || value == NULL) > + return 0; > + > + snprintf(mac_temp, sizeof(mac_temp), "%s", value); > + mac_byte = strtok(mac_temp, ":"); > + > + while ((mac_byte != NULL) && > + (strlen(mac_byte) <= 2) && > + (strlen(mac_byte) == strspn(mac_byte, > + ETH_TAP_CMP_MAC_FMT))) { > + user_mac->addr_bytes[index++] = strtoul(mac_byte, NULL, 16); > + mac_byte = strtok(NULL, ":"); > + } > + > + return index; > +} We need rte_ether_aton or better yet replace the DPDK custom definition of "struct ether_addr" with the with the one from Linux/BSD There is no value in having a private version of all these routines...