Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp693647pxu; Thu, 7 Jan 2021 16:07:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHIYRq1t+g0e2HmJQ472f0xSiBAsQq6X78qMw5syhAC5RfLaN970XVPrpZWxPWEXGeUV4+ X-Received: by 2002:a05:6402:55:: with SMTP id f21mr3504281edu.38.1610064426854; Thu, 07 Jan 2021 16:07:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610064426; cv=none; d=google.com; s=arc-20160816; b=fB1j5k823DbvQxpJwhmIyxLs6979fxAGGsspzEuvo5DcQy+ZSJNV4Cq7NPdh/YWaxw 6aGHFVeKzk0QirHLe29EalNkSM5EMD0B8Yj/v80yKQeZGtoQMWbeILUU6Gc6KmNOmlQJ f4jm+4GaHcU0W/8c3izi7c/5zxWNx5ade9Itu4D2E19jdDKOwzCL2suRKWhriDIgysip rxNjM+86lfAd918PJSevVpkEqtHbqiBSSrheic/dW5SCnX65+0vM17CEBhUBLbUBLhqW EnR5mOkJxhwj1qQfLTFMSx8Qv+/NSTp8sL0gnrg8nY6tUCmFPaVtiaUdnvR9vVDJknxg kp2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=L4HO0Yj29jyCFpzT2x1n0U+73ImIUkhV6HJs7/htSCA=; b=Iz5XFEdAJUU6A10qGhkjBeEdOniqPFDmzOr4xOAvHYDF4YNvU8zk93WHMnLmWDAIch sEfNQ+kWeM3LyPDVKk/J0weTf2RekdhdA5wGo8ro4l72IzK5uiZKLL75w7ygN2AnDYNm 4JGK9JukHW22KfkqcMA6qbykqaHqiRxeyG3/QuOoUNgNrG5VjyIpASUc+0YMna34WLoB RmAXXzV5CZWXfIIuf3FhrjE4Wsr/n3wMdRfVM7aSErHlWdH8wZwDpUN4YQwxBIdAPVEv 34jRiVzBuo5ukN2LpeUxYkEjEJi3eGD3IwKdL8oNS04F6f63Tl5Fc5n4oLkhHm5xoN5W anGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="U+/uFAdt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y6si3249891edp.196.2021.01.07.16.06.43; Thu, 07 Jan 2021 16:07:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="U+/uFAdt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729445AbhAHAFQ (ORCPT + 99 others); Thu, 7 Jan 2021 19:05:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44325 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728698AbhAHAFP (ORCPT ); Thu, 7 Jan 2021 19:05:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610064229; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=L4HO0Yj29jyCFpzT2x1n0U+73ImIUkhV6HJs7/htSCA=; b=U+/uFAdtIvCmbLPAKNrDo5lwv98DL57Cplh5TJPba2K06ycIVnM1UHn54SdjWuTf/PwY82 yfijqDV8jrI+E4H7IOR91LOA3Svntqg5cIwDdiGGRvwdmTPdTdc+BrQyV9EOoom88Ar1XD 5gzDZ3XdIHWKqrdKVvsJgsnVA2cFfRg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-151-uCmgvnO7PvSKOd1nT75pMw-1; Thu, 07 Jan 2021 19:03:45 -0500 X-MC-Unique: uCmgvnO7PvSKOd1nT75pMw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A67FB801817; Fri, 8 Jan 2021 00:03:43 +0000 (UTC) Received: from redhat.com (dhcp-17-185.bos.redhat.com [10.18.17.185]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 893ED19809; Fri, 8 Jan 2021 00:03:42 +0000 (UTC) Date: Thu, 7 Jan 2021 19:03:40 -0500 From: Jarod Wilson To: Jay Vosburgh Cc: linux-kernel@vger.kernel.org, Veaceslav Falico , Andy Gospodarek , "David S. Miller" , Jakub Kicinski , Thomas Davis , netdev@vger.kernel.org Subject: Re: [RFC PATCH net-next] bonding: add a vlan+srcmac tx hashing option Message-ID: <20210108000340.GC29828@redhat.com> References: <20201218193033.6138-1-jarod@redhat.com> <21784.1608337139@famine> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <21784.1608337139@famine> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 18, 2020 at 04:18:59PM -0800, Jay Vosburgh wrote: > Jarod Wilson wrote: > > >This comes from an end-user request, where they're running multiple VMs on > >hosts with bonded interfaces connected to some interest switch topologies, > >where 802.3ad isn't an option. They're currently running a proprietary > >solution that effectively achieves load-balancing of VMs and bandwidth > >utilization improvements with a similar form of transmission algorithm. > > > >Basically, each VM has it's own vlan, so it always sends its traffic out > >the same interface, unless that interface fails. Traffic gets split > >between the interfaces, maintaining a consistent path, with failover still > >available if an interface goes down. > > > >This has been rudimetarily tested to provide similar results, suitable for > >them to use to move off their current proprietary solution. > > > >Still on the TODO list, if these even looks sane to begin with, is > >fleshing out Documentation/networking/bonding.rst. > > I'm sure you're aware, but any final submission will also need > to include netlink and iproute2 support. I believe everything for netlink support is already included, but I'll double-check that before submitting something for inclusion consideration. > >diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c > >index 5fe5232cc3f3..151ce8c7a56f 100644 > >--- a/drivers/net/bonding/bond_main.c > >+++ b/drivers/net/bonding/bond_main.c > >@@ -164,7 +164,7 @@ module_param(xmit_hash_policy, charp, 0); > > MODULE_PARM_DESC(xmit_hash_policy, "balance-alb, balance-tlb, balance-xor, 802.3ad hashing method; " > > "0 for layer 2 (default), 1 for layer 3+4, " > > "2 for layer 2+3, 3 for encap layer 2+3, " > >- "4 for encap layer 3+4"); > >+ "4 for encap layer 3+4, 5 for vlan+srcmac"); > > module_param(arp_interval, int, 0); > > MODULE_PARM_DESC(arp_interval, "arp interval in milliseconds"); > > module_param_array(arp_ip_target, charp, NULL, 0); > >@@ -1434,6 +1434,8 @@ static enum netdev_lag_hash bond_lag_hash_type(struct bonding *bond, > > return NETDEV_LAG_HASH_E23; > > case BOND_XMIT_POLICY_ENCAP34: > > return NETDEV_LAG_HASH_E34; > >+ case BOND_XMIT_POLICY_VLAN_SRCMAC: > >+ return NETDEV_LAG_HASH_VLAN_SRCMAC; > > default: > > return NETDEV_LAG_HASH_UNKNOWN; > > } > >@@ -3494,6 +3496,20 @@ static bool bond_flow_ip(struct sk_buff *skb, struct flow_keys *fk, > > return true; > > } > > > >+static inline u32 bond_vlan_srcmac_hash(struct sk_buff *skb) > >+{ > >+ struct ethhdr *mac_hdr = (struct ethhdr *)skb_mac_header(skb); > >+ u32 srcmac = mac_hdr->h_source[5]; > >+ u16 vlan; > >+ > >+ if (!skb_vlan_tag_present(skb)) > >+ return srcmac; > >+ > >+ vlan = skb_vlan_tag_get(skb); > >+ > >+ return srcmac ^ vlan; > > For the common configuration wherein multiple VLANs are > configured atop a single interface (and thus by default end up with the > same MAC address), this seems like a fairly weak hash. The TCI is 16 > bits (12 of which are the VID), but only 8 are used from the MAC, which > will be a constant. > > Is this algorithm copying the proprietary solution you mention? I've not actually seen the code in question, so I can't be 100% certain, but this is exactly how it was described to me, and testing seems to bear out that it behaves at least similarly enough for the user. They like simplicity, and the very basic hash suits their needs, which are basically just getting some load-balancing with failover w/o having to have lacp, running on some older switches that can't do lacp. -- Jarod Wilson jarod@redhat.com