From patchwork Tue Jan 22 11:22:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tonghao Zhang X-Patchwork-Id: 1029324 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="dfcM5uEr"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43kWHm4d8lz9s3q for ; Wed, 23 Jan 2019 01:38:28 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728716AbfAVOi1 (ORCPT ); Tue, 22 Jan 2019 09:38:27 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:46460 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728377AbfAVOi0 (ORCPT ); Tue, 22 Jan 2019 09:38:26 -0500 Received: by mail-pl1-f194.google.com with SMTP id t13so11560957ply.13 for ; Tue, 22 Jan 2019 06:38:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=YayyI0cBWymZ31y69zgMF3VTAa+Cnnlcq/enDswxbSY=; b=dfcM5uErjMKMGqFNqkbObLAuIUQ53EG3VBA6Kcen3Cp8drAFHv3bTbhN5BgpBVtdu0 EAD8SXLJKRmRMBoXuCbtTWM1OZ2aEKiGtyklMFTE0RvFZRRVQz6FjbbH16LoGvLV9fn9 SwpANDSnKipK7/aZSLWKvuqhm9eB9NRcxmGT0MWcfTRmlHXjcQn+8v6JO9UH5lRtZ8f8 IyxS6Jci2Uv4cYmfa0NZMCTDRpf2is+v7fG1aJIM2tUclStztpruhV/ZsR7KQdg025Zy WpwlI92itZ3W+yF5ZU41ICRHGmHEWYVZqJb+8xpk9NFz6yjCk+JZigpnRTuLmnWKcpZI u4ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=YayyI0cBWymZ31y69zgMF3VTAa+Cnnlcq/enDswxbSY=; b=K6YWGsm2JTyCPQcfLk9Ns0voyeO9HXJYGiZodGYC5qbKy6GNMIIuaSxUiRukghnQ6s JT6ZGQ3Wz+OviubJjaKF2sbEKy+OKTmqMxFpo59NLhkkLa1ryOZjUPnhAf+qhXvuQMtl P4rQuu5CPf014oVU1flyyAZhe++dupWLS0bvnt5B7RZL0zJ2r2tUo3pdUpnP2akCtlHo c5QVwzNrqdyGgluF8ZpqOkqinOLYzZqq2FIOvidYeIXkMuEPSK1Ao+Cr0hLRR11hdLAR ghda6JugGvRs3S/cW/n0TOg+p9ch3lda/DGkz63uf31sf7mtuu/rm6jqfO6bRMm5bRfR VK3Q== X-Gm-Message-State: AJcUukeNcZ0Fd1syEBWDvF0zG8zpjD5Bz5C2UYVsIAjwn1NW0UPQituN osK3nUW1hAp61RDJICgv0eg= X-Google-Smtp-Source: ALg8bN6oGL9SWk2jTvCoojVp5iMxB1rmvDpH2K6Cp0stO1LAc3H+LKnduh39vGPZ8Of1RgmgHiJHDw== X-Received: by 2002:a17:902:b40d:: with SMTP id x13mr35005218plr.237.1548167906148; Tue, 22 Jan 2019 06:38:26 -0800 (PST) Received: from local.opencloud.tech.localdomain ([1.202.68.9]) by smtp.gmail.com with ESMTPSA id t13sm18965887pgr.42.2019.01.22.06.38.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jan 2019 06:38:25 -0800 (PST) From: xiangxia.m.yue@gmail.com To: saeedm@mellanox.com, gerlitz.or@gmail.com Cc: netdev@vger.kernel.org, Tonghao Zhang , Hadar Hen Zion Subject: [PATCH net-next v3 1/2] net/mlx5e: Update hw flows when encap source mac changed Date: Tue, 22 Jan 2019 03:22:05 -0800 Message-Id: <1548156126-8021-1-git-send-email-xiangxia.m.yue@gmail.com> X-Mailer: git-send-email 1.8.3.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Tonghao Zhang When we offload tc filters to hardware, hardware flows can be updated when mac of encap destination ip is changed. But we ignore one case, that the mac of local encap ip can be changed too, so we should also update them. To fix it, add route_dev in mlx5e_encap_entry struct to save the local encap netdevice, and when mac changed, kernel will flush all the neighbour on the netdevice and send NETEVENT_NEIGH_UPDATE event. The mlx5 driver will delete the flows and add them when neighbour available again. Fixes: 232c001398ae ("net/mlx5e: Add support to neighbour update flow") Cc: Hadar Hen Zion Signed-off-by: Tonghao Zhang Reviewed-by: Or Gerlitz --- v2: simply the implement v3: support ipv6 --- drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 2 ++ drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 4 ++++ drivers/net/ethernet/mellanox/mlx5/core/en_rep.h | 1 + 3 files changed, 7 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c index 046948e..114e0a2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c @@ -256,6 +256,7 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv, e->m_neigh.family = n->ops->family; memcpy(&e->m_neigh.dst_ip, n->primary_key, n->tbl->key_len); e->out_dev = out_dev; + e->route_dev = route_dev; /* It's important to add the neigh to the hash table before checking * the neigh validity state. So if we'll get a notification, in case the @@ -369,6 +370,7 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv, e->m_neigh.family = n->ops->family; memcpy(&e->m_neigh.dst_ip, n->primary_key, n->tbl->key_len); e->out_dev = out_dev; + e->route_dev = route_dev; /* It's importent to add the neigh to the hash table before checking * the neigh validity state. So if we'll get a notification, in case the diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index 96cc0c6..c4b9073 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -594,6 +594,10 @@ static void mlx5e_rep_update_flows(struct mlx5e_priv *priv, if (neigh_connected && !(e->flags & MLX5_ENCAP_ENTRY_VALID)) { ether_addr_copy(e->h_dest, ha); ether_addr_copy(eth->h_dest, ha); + /* Update the encap source mac, in case that we delete + * the flows when encap source mac changed. + */ + ether_addr_copy(eth->h_source, e->route_dev->dev_addr); mlx5e_tc_encap_flows_add(priv, e); } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h index edd7228..36eafc8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h @@ -148,6 +148,7 @@ struct mlx5e_encap_entry { unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ struct net_device *out_dev; + struct net_device *route_dev; int tunnel_type; int tunnel_hlen; int reformat_type;