From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH v2] net/bonding: add add/remove mac addrs Date: Mon, 18 Jun 2018 11:58:33 -0700 Message-ID: <20180618115833.161b14d8@xeon-e3> References: <20180618122720.5B3F51559@dpdk.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Chas Williams , "dev@dpdk.org" To: Alex Kiselev Return-path: Received: from mail-pg0-f67.google.com (mail-pg0-f67.google.com [74.125.83.67]) by dpdk.org (Postfix) with ESMTP id 1A7AE1559 for ; Mon, 18 Jun 2018 20:58:41 +0200 (CEST) Received: by mail-pg0-f67.google.com with SMTP id c10-v6so7946705pgu.9 for ; Mon, 18 Jun 2018 11:58:40 -0700 (PDT) In-Reply-To: <20180618122720.5B3F51559@dpdk.org> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, 18 Jun 2018 15:27:16 +0300 Alex Kiselev wrote: > +static const struct ether_addr null_mac_addr; > + > +/* > + * Add additional MAC addresses to the slave > + */ > +int > +slave_add_mac_addresses(struct rte_eth_dev *bonded_eth_dev, > + uint16_t slave_port_id) > +{ > + int i, ret; > + struct ether_addr *mac_addr; > + > + /* add additional MACs to the slave */ > + for (i = 1; i < BOND_MAX_MAC_ADDRS; i++) { > + mac_addr = &bonded_eth_dev->data->mac_addrs[i]; > + if (is_same_ether_addr(mac_addr, &null_mac_addr)) > + break; > + > + ret = rte_eth_dev_mac_addr_add(slave_port_id, mac_addr, 0); > + if (ret < 0) > + return ret; > + } > + > + return 0; You need to unwind if adding MAC address to one of the slave devices worked, and the second one did not.