From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756639AbdDFBqD (ORCPT ); Wed, 5 Apr 2017 21:46:03 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:49030 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756315AbdDFBp4 (ORCPT ); Wed, 5 Apr 2017 21:45:56 -0400 Date: Wed, 05 Apr 2017 18:45:54 -0700 (PDT) Message-Id: <20170405.184554.1608171595937690317.davem@davemloft.net> To: jarod@redhat.com Cc: linux-kernel@vger.kernel.org, j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net, netdev@vger.kernel.org Subject: Re: [PATCH net-next] bonding: attempt to better support longer hw addresses From: David Miller In-Reply-To: <20170404213242.50079-1-jarod@redhat.com> References: <20170404213242.50079-1-jarod@redhat.com> X-Mailer: Mew version 6.7 on Emacs 25.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 05 Apr 2017 18:04:39 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jarod Wilson Date: Tue, 4 Apr 2017 17:32:42 -0400 > People are using bonding over Infiniband IPoIB connections, and who knows > what else. Infiniband has a hardware address length of 20 octets > (INFINIBAND_ALEN), and the network core defines a MAX_ADDR_LEN of 32. > Various places in the bonding code are currently hard-wired to 6 octets > (ETH_ALEN), such as the 3ad code, which I've left untouched here. Besides, > only alb is currently possible on Infiniband links right now anyway, due > to commit 1533e7731522, so the alb code is where most of the changes are. > > One major component of this change is the addition of a bond_hw_addr_copy > function that takes a length argument, instead of using ether_addr_copy > everywhere that hardware addresses need to be copied about. The other > major component of this change is converting the bonding code from using > struct sockaddr for address storage to struct sockaddr_storage, as the > former has an address storage space of only 14, while the latter is 128 > minus a few, which is necessary to support bonding over device with up to > MAX_ADDR_LEN octet hardware addresses. Additionally, this probably fixes > up some memory corruption issues with the current code, where it's > possible to write an infiniband hardware address into a sockaddr declared > on the stack. > > Lightly tested on a dual mlx4 IPoIB setup, which properly shows a 20-octet > hardware address now: ... > CC: Jay Vosburgh > CC: Veaceslav Falico > CC: Andy Gospodarek > CC: netdev@vger.kernel.org > Signed-off-by: Jarod Wilson Applied, but: > +static inline void bond_hw_addr_copy(u8 *dst, const u8 *src, unsigned int len) > +{ > + if (len == ETH_ALEN) { > + ether_addr_copy(dst, src); > + return; > + } > + > + memcpy(dst, src, len); > +} I wonder how much value there is in trying to conditionally use ether_addr_copy(). Unless some of these calls are in the data plane, just a straight memcpy() all the time is fine and much simpler. Thanks.