Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp322092lqd; Wed, 24 Apr 2024 03:33:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWzcANhFvgIO53FV/FXeT93SKvmdy00ZDO6tQweF09DLsFRFDUWm7zo0xqgEVyMJH2Bkg0aCMfeqV4/b8Bb96A3fjc96+sHvYBxKrXnWQ== X-Google-Smtp-Source: AGHT+IGOqxXZwe4sQKcYhZVPoukhRVH7gnYK/6oktFmYCAjpFgEJj9GjPJxqSnBvdIxX4LstHsMS X-Received: by 2002:a17:906:aa15:b0:a52:54d8:6d21 with SMTP id ko21-20020a170906aa1500b00a5254d86d21mr1217308ejb.7.1713954831262; Wed, 24 Apr 2024 03:33:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713954831; cv=pass; d=google.com; s=arc-20160816; b=YiFcxXmJNxa7eAMJRZFRP3kVfBZdY27o1ByuD3D5einqZhRb8rerO1PKgjgy6ZfSAJ 1p8asOy2oWajCvD6aIlUGKtkPdGuObPc2tYYofppc0o/bCp2EmyvZQyEioOjxtsrX9ga mtdcpeM08d9nJuRdJ6g4iJ/opXV+nSabXrPGbFhIJjyvnbOIOkLGDn75wnDw2K8bt4dr tm/d2gZ2154KRmuIqBOnPH9ciBCmvqVpRf24Mhnkz2kUu8nmiVYXr99kKXqo35yhHfcs 5nk1BrmcMBFvHASzUcfXyH9xaeKPt3wMN4362wZkfyqPPuZwErZWWzDp6SPgrvHq6hN7 C1rQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=V1mal6zq+xdeJfcmGXIqdRpTal7N99j0myea4I6HSlE=; fh=9F/zgAfNvLnDgRbLMUtbyBgsbRvrFwmtG/oTUj9XYVQ=; b=KSD1vRAxxsgis1Ph1kR0eHVzoUEBuON0TIoeJVqy/q+Ar/0pI19Pw+t6zslngScuBL r7MZhrPkba9QhrTdTXsTx5lCl+23KPanwuuFu5+TX/AMxh3DihVhchawndV8+NmzGfLY E3vZi6crQt8hoDmrDJSlNF+5vOWf42v53S8nVp6mkwVnpInKtTFPgZiUYLqEmUzh+Hv4 BL946Ytl4plwGjJTN6GmUDjGRUd00sxsxKiSRd1sozrP3ziBIee819F7c14kmoWaQLOc /4SlKLOgIpC5fYnT6fjsSTgI2npWzNpJlh30jsTSf84IMWSi2wUaR2r8EVAhOA54nXnf ZPNg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=QthLMQ3O; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-156730-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156730-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s23-20020a1709066c9700b00a5890bca2f5si817214ejr.211.2024.04.24.03.33.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 03:33:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156730-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=QthLMQ3O; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-156730-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156730-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 03EEE1F22962 for ; Wed, 24 Apr 2024 10:33:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C7CE159579; Wed, 24 Apr 2024 10:33:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="QthLMQ3O" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F3B313DBB2; Wed, 24 Apr 2024 10:33:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713954821; cv=none; b=BzFmz2fwXOn6goSE1KF5dR9S9iWpZFrlOPdtzEVM8NKCWHPqnbJ+rN3DSiyx7fNzkpdz6OiBHgCxZcDU7JORaIaKO6MHv9xQDbWAwBnlQs3/B0fY7cNxwcG7HUJ3CIQ+K2axUjJ2N06T7nqICnx2l4Nqc32I9Y2pLGirWClVjMA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713954821; c=relaxed/simple; bh=LDWhUK0jDEvgCD/wSr4IUcRjzC8SZUkMJLbsuVglrYo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=hFC5qY/snUHprD+uI0JgYEZqbGTpIK34Z1VSj+buASyvTrjWP9oLEHbhHn7AqnlqpTfjOYwABV/LeIc6NCUv/pp1I7ARPPJPaNgladCjGJjobkhVPttviu7TYOePkpOWmM8qJW4PGMrszxHPRGIrdB5/QPs6xI3hSu5+P6o0j6w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=QthLMQ3O; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: by linux.microsoft.com (Postfix, from userid 1134) id E09C0208591D; Wed, 24 Apr 2024 03:33:39 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E09C0208591D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713954819; bh=V1mal6zq+xdeJfcmGXIqdRpTal7N99j0myea4I6HSlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QthLMQ3OGJ47JeoAeOwmOy2PnbZj8TbUaGhCtbHpoj/Dp9SZU4fZClI8Fnm/WU+UZ UiKYfYchd9ESdwLW/HcP1eN1eWlNhz1evt+EEt8UG6iGj3gm50vMcP0s9ma0KO2nPQ Ian4DEwomU69hf3sJHR4uXkTgclY3DFa5n+qjO98= From: Shradha Gupta To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Bjorn Helgaas , Jonathan Corbet , Randy Dunlap , Johannes Berg , Breno Leitao , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Souradeep Chakrabarti , Konstantin Taranov , Yury Norov , linux-hyperv@vger.kernel.org Cc: Shradha Gupta , shradhagupta@microsoft.com Subject: [PATCH net-next v2 1/2] net: Add sysfs atttributes for max_mtu min_mtu Date: Wed, 24 Apr 2024 03:33:37 -0700 Message-Id: <1713954817-30133-1-git-send-email-shradhagupta@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1713954774-29953-1-git-send-email-shradhagupta@linux.microsoft.com> References: <1713954774-29953-1-git-send-email-shradhagupta@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Add sysfs attributes to read max_mtu and min_mtu value for network devices Signed-off-by: Shradha Gupta --- Changes in v2: * Created a new patch for generic attributes --- Documentation/ABI/testing/sysfs-class-net | 16 ++++++++++++++++ net/core/net-sysfs.c | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-class-net b/Documentation/ABI/testing/sysfs-class-net index ebf21beba846..f68f3b9be6ec 100644 --- a/Documentation/ABI/testing/sysfs-class-net +++ b/Documentation/ABI/testing/sysfs-class-net @@ -352,3 +352,19 @@ Description: 0 threaded mode disabled for this dev 1 threaded mode enabled for this dev == ================================== + +What: /sys/class/net//max_mtu +Date: April 2024 +KernelVersion: 6.10 +Contact: netdev@vger.kernel.org +Description: + Indicates the interface's maximum supported MTU value, in + bytes, and in decimal format. + +What: /sys/class/net//min_mtu +Date: April 2024 +KernelVersion: 6.10 +Contact: netdev@vger.kernel.org +Description: + Indicates the interface's minimum supported MTU value, in + bytes, and in decimal format. diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index e3d7a8cfa20b..525b85d47676 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -114,6 +114,8 @@ NETDEVICE_SHOW_RO(addr_len, fmt_dec); NETDEVICE_SHOW_RO(ifindex, fmt_dec); NETDEVICE_SHOW_RO(type, fmt_dec); NETDEVICE_SHOW_RO(link_mode, fmt_dec); +NETDEVICE_SHOW_RO(max_mtu, fmt_dec); +NETDEVICE_SHOW_RO(min_mtu, fmt_dec); static ssize_t iflink_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -671,6 +673,8 @@ static struct attribute *net_class_attrs[] __ro_after_init = { &dev_attr_carrier_up_count.attr, &dev_attr_carrier_down_count.attr, &dev_attr_threaded.attr, + &dev_attr_max_mtu.attr, + &dev_attr_min_mtu.attr, NULL, }; ATTRIBUTE_GROUPS(net_class); -- 2.34.1