Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1154332ybl; Thu, 12 Dec 2019 10:26:33 -0800 (PST) X-Google-Smtp-Source: APXvYqxDgqkeaHZ/z2USyLhfJvO0jwbaDp3EJGRP5Wpfww9bSs/P5ByLHcrn39XsjHAik2LWbhIK X-Received: by 2002:a05:6830:1c90:: with SMTP id v16mr2786273otf.259.1576175193701; Thu, 12 Dec 2019 10:26:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576175193; cv=none; d=google.com; s=arc-20160816; b=KTPKAI4hgCP5APx3d1jlPDT/0I7o6QHmvQbstqRnodsAViNEbcHbcpwzJHcGvXkPKQ g8jwK+5AIg2qb3vaa6WwckQ7aLEXo0siIEu2cgDt0Z/WeaXEQhs9Ke25/eOkhZSvbMPi KBQE5NRaEbHKR+t1ajK3PNKehaKpaq9Q+eq2k7V1yVZHf1TexQKzOaknFVv9dCg2BZ8a Ov3PHzP3qqRgGzT+gm00xuv6S4zMMvJZLcD+7DQmI5NhBgnxjMRBJdYVJwXLfefGi8z2 YKNRnZHJl5ZS0oU7ZF0ZHl4WlVwWN38taArhSXtmp3ozeiEmC3kDvolSAWlUtojai/MH 4oiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=dq8iMUhZ2yfBywJFDlsyvo5d9zUYOkAnGOhY/ugaTfg=; b=AWNGP+v6IiqtvELDNF9/QFlC0WwDhLxly6/XMX1G8BAyhgMWvTMLWQ8Ba708QhmjGC OaOT1c1CufI92Pbfpksl29AFCcKQorGvaz21EfGKEkXuZGJyHq+XrClsBdiB82Ssr/Ud Tn+9FAF0Hslxv75u8LKw/6VDaMtfYJLXaQlhfGRFcHcdHoP/lbI+su2MEvwsPmIBNxVU gRVlr68uVC+atg8bsOl8cofysm07pv7DJBwTENHvBg1x/2LCFDFbrFpmErmn/CfLskEH XDwtD0PuLdfg4NrikK+iZUur5E8UYSrYAWvNfEpwIeek1OhHgMR1Q1oM6Ugqu27pjQ+R UnFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=JZ5+WGDL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z11si3769032oic.119.2019.12.12.10.26.20; Thu, 12 Dec 2019 10:26:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=JZ5+WGDL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730567AbfLLSZ0 (ORCPT + 99 others); Thu, 12 Dec 2019 13:25:26 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:45945 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730550AbfLLSZW (ORCPT ); Thu, 12 Dec 2019 13:25:22 -0500 Received: by mail-pg1-f196.google.com with SMTP id b9so1559116pgk.12 for ; Thu, 12 Dec 2019 10:25:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=dq8iMUhZ2yfBywJFDlsyvo5d9zUYOkAnGOhY/ugaTfg=; b=JZ5+WGDLMqcN43s4lZE8f2qx6LIqv25/YKdRZArNa+TIOR4zXMBDSDbF7EmxMp0teV z1yPgFHV6R/Y9nblOr69R2by1K+voQaFqi1czL1TEgAnwKlhaWWZZOyJb4nkuo/BLt/j wvdVj/ii5Vw695+oPBU4gtmV6mzDwuLoBejlJLVaGxuRsPGe5db080gTD4+bXeAAkx7d YsJRtU9GgMY8L8P2KyUMmX/U6lfmDO4F9mwWnkrYv/C/XW/u2hNoBAISrq4fnjV5ENKG fM0llueVK1mnbYBGRuPlE3cVPr1d4j3j6vm3deESJo64OOHDYqdZvR+4eQMMthrLa89/ 3kpg== 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:organization:mime-version:content-transfer-encoding; bh=dq8iMUhZ2yfBywJFDlsyvo5d9zUYOkAnGOhY/ugaTfg=; b=FIbaWbUZdfEVkXZE/88dkj3VGCJ0n3b+Y4tC/ZtReSygShib+hej2Hskp7k3Oi2/hy vg0GwplIAyLqwDMeOjzWHiqroNa+yGrGYyzJs/eYpUx8h9XSlQcPYNwet4gYL7zj6ObO ZIYDas9VbCLo5Tk+4WER9yPfruSi5RckpD69DmdQ3aB5Xkpait1cNzY/laZWj6pibVW1 1TpW9RLwgzPU0BIqLxtOtUneC1Nfgk4dQmBZQNmf2KCDjL7czc2RenaFCG2USUM5uDFt 57aFjhsGuJFUfevIxvxjjq1gvXoH4/hg5wjYhk1UuAcC/pvD/pBqGVmSOHGqhDNJgri6 wQaA== X-Gm-Message-State: APjAAAVlIdKOUsYPRRAf8ULAvYKrPw3My0sgVI8lOyZLYdaGBqjxRbkP S0/CUHkpXZ0qVgg/JSVB5jFUZA== X-Received: by 2002:a63:c12:: with SMTP id b18mr11819556pgl.156.1576175121153; Thu, 12 Dec 2019 10:25:21 -0800 (PST) Received: from cakuba.netronome.com ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id i4sm6344645pjw.28.2019.12.12.10.25.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2019 10:25:20 -0800 (PST) Date: Thu, 12 Dec 2019 10:25:17 -0800 From: Jakub Kicinski To: Yuval Avnery Cc: Jiri Pirko , "davem@davemloft.net" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Andy Gospodarek Subject: Re: [PATCH net-next] netdevsim: Add max_vfs to bus_dev Message-ID: <20191212102517.602a8a5d@cakuba.netronome.com> In-Reply-To: References: <1576033133-18845-1-git-send-email-yuvalav@mellanox.com> <20191211095854.6cd860f1@cakuba.netronome.com> <20191211111537.416bf078@cakuba.netronome.com> <20191211142401.742189cf@cakuba.netronome.com> <20191211154952.50109494@cakuba.netronome.com> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 12 Dec 2019 05:11:12 +0000, Yuval Avnery wrote: > > > > Okay, please post v2 together with the tests. We don't accept > > > > netdevsim features without tests any more. > > > > > > I think the only test I can currently write is the enable SR-IOV max_vfs > > > enforcement. Because subdev is not in yet. > > > Will that be good enough? > > > > It'd be good to test some netdev API rather than just the enforcement itself > > which is entirely in netdevsim, I think. > > > > So max_vfs enforcement plus checking that ip link lists the correct number of > > entries (and perhaps the entries are in reset state after > > enable) would do IMO. > > Ok, but this is possible regardless of my patch (to enable vfs). I was being lenient :) Your patch is only really needed when the devlink API lands, since devlink will display all max VFs not enabled. > > My knee jerk reaction is that we should populate the values to those set via > > devlink upon SR-IOV enable, but then if user overwrites those values that's > > their problem. > > > > Sort of mirror how VF MAC addrs work, just a level deeper. The VF defaults > > to the MAC addr provided by the PF after reset, but it can change it to > > something else (things may stop working because spoof check etc. will drop > > all its frames, but nothing stops the VF in legacy HW from writing its MAC > > addr register). > > > > IOW the devlink addr is the default/provisioned addr, not necessarily the > > addr the PF has set _now_. > > > > Other options I guess are (a) reject the changes of the address from the PF > > once devlink has set a value; (b) provide some device->control CPU notifier > > which can ack/reject a request from the PF to change devlink's value..? > > > > You guys posted the devlink patches a while ago, what was your > > implementation doing? > > devlink simply calls the driver with set or get. > It is up to the vendor driver/HW if to make this address persistent or not. > The address is not saved in the devlink layer. It'd be preferable for the behaviour of the kernel API to not be vendor specific. That defeats the purpose of having an operating system as a HW abstraction layer. SR-IOV devices of today are so FW heavy we can make them behave whatever way we choose makes most sense. > The MAC address in mlx5 is stored in the HW and > persistent (until PF reset) , whether it is set by devlink or ip link. Okay, let's see if I understand. The devlink and ip link interfaces basically do the same thing but one reaches from control CPU and the other one from the SR-IOV host? And on SR-IOV host reset the addresses go back to 00:00.. i.e. any? What happens if the SR-IOV host changes the MAC? Is it used by HW or is the MAC provisioned by the control CPU used for things like spoof check? Does the control CPU get a notification for SR-IOV host reset? In that case the control CPU driver could restore the MAC addr. > So from what I understand, we have the freedom to choose how netdevsim > behave in this case, which means non-persistent is ok. To be clear - by persistent I meant that it survives the SR-IOV host's resets, not necessarily written to NVRAM of any sort. I'd like to see netdevsim to also serve as sort of a reference model for device behaviour. Vendors who are not first to implement a feature always complain that there is no documentation on how things should work.