From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f49.google.com (mail-pg0-f49.google.com [74.125.83.49]) by dpdk.org (Postfix) with ESMTP id B5E92160 for ; Mon, 18 Dec 2017 19:26:32 +0100 (CET) Received: by mail-pg0-f49.google.com with SMTP id w7so9478209pgv.6 for ; Mon, 18 Dec 2017 10:26:32 -0800 (PST) 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=gxVNPZbiGd2cspyuwoJoaLixtlqyArNFvwmO1z+E4Yo=; b=H2WIJoXghhcMSDRYRSZ9VrjqoPzMragYzoh0No7PhlQVDol5DlaEwvB2sIm9Y6XIMU 4UbXqzrFR2/KBGesJ5ZYF9Yue13WerYcFqFYOGW2yNJdZNEd2M9ErqLZWx/E9hPTJa74 gdPW0DYAtmOY/fNfnYUa0dyPcPX+X3VuRff0nmLx9NkKkHr2ynp9C97T/bJZrHwyK/h3 Cf+zyrtZJjDRzPHvCS777pNOcEq3M3hfJzkNlRwUsVxcoKni2ebSnsgY03zMqhrnirLt AMnnxgjK2Smkq8XVSRVzGgU7Tzw4XqFDt7CdvPyG6Or8mQPKh3NfC0pq7iV+oyjvrjRE sK8A== 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=gxVNPZbiGd2cspyuwoJoaLixtlqyArNFvwmO1z+E4Yo=; b=j2JbBaUSOwrqaorBAX+SHlRbMsyuDKgvvmK6NMHnP7+SgTCDk7PthGLfEfdo3P1d5w VL7HrcvaQ+gSGS9RLnyWho+BQ/Ax+E6SpySnu4/ZqXXLJxPuoCjhDwAf8xhIiSYrKYpz XVkjabg3WskWbPOUMlIIXWWEs2d9EE25BIOeYqsKo4hKVQUbmpcwqOOo7V7ybrCLzAv5 Yeh80WJRsO8737zzFNUixDI9DRZ2s8DXHAnCUyuKcwYDDYk4B1p+7QvGJ+0wHoEge56w pve5vn6S/K47JB9eWK7ORo/6ZkZwaAmf+j8t3i2hGLf1OtgIvbtA0atgpW2bkDcmgLCG eH4Q== X-Gm-Message-State: AKGB3mJ0/Nd1XiDHQhv6pqmWekPDbxTzxe04/Ja8IfazKoL6TCISs9i2 yips/CjL2LkjcqVYXC9p1VvjOA== X-Google-Smtp-Source: ACJfBotRWh7ETPXvtAmXOzqFF180wd47CjRtW0kIPLNiOHYqxYVbWcu45vCbpiAR+3OdAhfymKZ5Ow== X-Received: by 10.98.89.4 with SMTP id n4mr559895pfb.133.1513621591837; Mon, 18 Dec 2017 10:26:31 -0800 (PST) Received: from xeon-e3 (204-195-18-133.wavecable.com. [204.195.18.133]) by smtp.gmail.com with ESMTPSA id k2sm25074136pfg.53.2017.12.18.10.26.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Dec 2017 10:26:31 -0800 (PST) Date: Mon, 18 Dec 2017 10:26:29 -0800 From: Stephen Hemminger To: Adrien Mazarguil Cc: Ferruh Yigit , dev@dpdk.org Message-ID: <20171218102629.43798de2@xeon-e3> In-Reply-To: <20171218162443.12971-3-adrien.mazarguil@6wind.com> References: <20171124172132.GW4062@6wind.com> <20171218162443.12971-1-adrien.mazarguil@6wind.com> <20171218162443.12971-3-adrien.mazarguil@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v1 2/3] net/hyperv: implement core functionality 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, 18 Dec 2017 18:26:33 -0000 On Mon, 18 Dec 2017 17:46:23 +0100 Adrien Mazarguil wrote: > +static int > +ether_addr_from_str(struct ether_addr *eth_addr, const char *str) > +{ > + static const uint8_t conv[0x100] = { > + ['0'] = 0x80, ['1'] = 0x81, ['2'] = 0x82, ['3'] = 0x83, > + ['4'] = 0x84, ['5'] = 0x85, ['6'] = 0x86, ['7'] = 0x87, > + ['8'] = 0x88, ['9'] = 0x89, ['a'] = 0x8a, ['b'] = 0x8b, > + ['c'] = 0x8c, ['d'] = 0x8d, ['e'] = 0x8e, ['f'] = 0x8f, > + ['A'] = 0x8a, ['B'] = 0x8b, ['C'] = 0x8c, ['D'] = 0x8d, > + ['E'] = 0x8e, ['F'] = 0x8f, [':'] = 0x40, ['-'] = 0x40, > + ['\0'] = 0x60, > + }; > + uint64_t addr = 0; > + uint64_t buf = 0; > + unsigned int i = 0; > + unsigned int n = 0; > + uint8_t tmp; > + > + do { > + tmp = conv[(int)*(str++)]; > + if (!tmp) > + return -EINVAL; > + if (tmp & 0x40) { > + i += (i & 1) + (!i << 1); > + addr = (addr << (i << 2)) | buf; > + n += i; > + buf = 0; > + i = 0; > + } else { > + buf = (buf << 4) | (tmp & 0xf); > + ++i; > + } > + } while (!(tmp & 0x20)); > + if (n > 12) > + return -EINVAL; > + i = RTE_DIM(eth_addr->addr_bytes); > + while (i) { > + eth_addr->addr_bytes[--i] = addr & 0xff; > + addr >>= 8; > + } > + return 0; > +} > + Why not ether_ntoa?