diff mbox series

[v2,1/2] net: ethtool: Support setting ntuple rule count

Message ID 1627064206-16032-2-git-send-email-sgoutham@marvell.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series Support ethtool ntuple rule count change | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers warning 12 maintainers not CCed: ecree@solarflare.com petr.vorel@gmail.com akpm@linux-foundation.org andrew@lunn.ch shenjian15@huawei.com magnus.karlsson@intel.com dmurphy@ti.com bjorn@kernel.org danieller@nvidia.com arnd@arndb.de irusskikh@marvell.com alexanderduyck@fb.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 2069 this patch: 2069
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 2061 this patch: 2061
netdev/header_inline success Link

Commit Message

Sunil Kovvuri Goutham July 23, 2021, 6:16 p.m. UTC
Some NICs share resources like packet filters across
multiple interfaces they support. From HW point of view
it is possible to use all filters for a single interface.
Currently ethtool doesn't support modifying filter count so
that user can allocate more filters to a interface and less
to others. This patch adds ETHTOOL_SRXCLSRLCNT ioctl command
for modifying filter count.

example command:
./ethtool -U eth0 rule-count 256

Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 include/uapi/linux/ethtool.h | 1 +
 net/ethtool/ioctl.c          | 1 +
 2 files changed, 2 insertions(+)

Comments

Andrew Lunn July 24, 2021, 5:23 p.m. UTC | #1
On Fri, Jul 23, 2021 at 11:46:45PM +0530, Sunil Goutham wrote:
> Some NICs share resources like packet filters across
> multiple interfaces they support. From HW point of view
> it is possible to use all filters for a single interface.
> Currently ethtool doesn't support modifying filter count so
> that user can allocate more filters to a interface and less
> to others. This patch adds ETHTOOL_SRXCLSRLCNT ioctl command
> for modifying filter count.
> 
> example command:
> ./ethtool -U eth0 rule-count 256

How can use see what the current usage is? How many in total you have
available?  What the current split is between the interfaces?

You say:

   * Jakub suggested if devlink-resource can be used for this.

devlink-resource provides you a standardised mechanism to answer the
questions i just asked. So i would have to agree with Jakub.

	  Andrew
Saeed Mahameed July 26, 2021, 10:29 p.m. UTC | #2
On Sat, 2021-07-24 at 19:23 +0200, Andrew Lunn wrote:
> On Fri, Jul 23, 2021 at 11:46:45PM +0530, Sunil Goutham wrote:
> > Some NICs share resources like packet filters across
> > multiple interfaces they support. From HW point of view
> > it is possible to use all filters for a single interface.
> > Currently ethtool doesn't support modifying filter count so
> > that user can allocate more filters to a interface and less
> > to others. This patch adds ETHTOOL_SRXCLSRLCNT ioctl command
> > for modifying filter count.
> > 
> > example command:
> > ./ethtool -U eth0 rule-count 256
> 
> How can use see what the current usage is? How many in total you have
> available?  What the current split is between the interfaces?
> 

There is no point of adding this ethtool interface if the orchestration
tool already knows the "rule-count" in advance, it's just redundant to
have a user managed limiting device in ethtool.

> You say:
> 
>    * Jakub suggested if devlink-resource can be used for this.
> 
> devlink-resource provides you a standardised mechanism to answer the
> questions i just asked. So i would have to agree with Jakub.
> 

+1, devlink is your address when a single device is shared across
multiple interfaces.

>           Andrew
diff mbox series

Patch

diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 67aa713..178f346 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -1552,6 +1552,7 @@  enum ethtool_fec_config_bits {
 #define ETHTOOL_PHY_STUNABLE	0x0000004f /* Set PHY tunable configuration */
 #define ETHTOOL_GFECPARAM	0x00000050 /* Get FEC settings */
 #define ETHTOOL_SFECPARAM	0x00000051 /* Set FEC settings */
+#define ETHTOOL_SRXCLSRLCNT	0x00000052 /* Set RX class rule count */
 
 /* compatibility with older code */
 #define SPARC_ETH_GSET		ETHTOOL_GSET
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index 6134b18..ca0f75e 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -2863,6 +2863,7 @@  int dev_ethtool(struct net *net, struct ifreq *ifr)
 	case ETHTOOL_SRXFH:
 	case ETHTOOL_SRXCLSRLDEL:
 	case ETHTOOL_SRXCLSRLINS:
+	case ETHTOOL_SRXCLSRLCNT:
 		rc = ethtool_set_rxnfc(dev, ethcmd, useraddr);
 		break;
 	case ETHTOOL_FLASHDEV: