All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] Support ethtool ntuple rule count change
@ 2021-06-16 12:51 sgoutham
  2021-06-16 12:51 ` [PATCH net-next 1/2] net: ethtool: Support setting ntuple rule count sgoutham
  2021-06-16 12:51 ` [PATCH net-next 2/2] octeontx2-pf: " sgoutham
  0 siblings, 2 replies; 7+ messages in thread
From: sgoutham @ 2021-06-16 12:51 UTC (permalink / raw)
  To: davem, kuba, netdev; +Cc: Sunil Goutham

From: Sunil Goutham <sgoutham@marvell.com>

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.
This 2 patch series adds support to modify ntuple rule
count for OcteonTx2 netdev.

Sunil Goutham (2):
  net: ethtool: Support setting ntuple rule count
  octeontx2-pf: Support setting ntuple rule count

 .../ethernet/marvell/octeontx2/nic/otx2_common.h   |  1 +
 .../ethernet/marvell/octeontx2/nic/otx2_ethtool.c  |  3 +++
 .../ethernet/marvell/octeontx2/nic/otx2_flows.c    | 27 ++++++++++++++++++++--
 include/uapi/linux/ethtool.h                       |  1 +
 net/ethtool/ioctl.c                                |  1 +
 5 files changed, 31 insertions(+), 2 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH net-next 1/2] net: ethtool: Support setting ntuple rule count
  2021-06-16 12:51 [PATCH net-next 0/2] Support ethtool ntuple rule count change sgoutham
@ 2021-06-16 12:51 ` sgoutham
  2021-06-16 17:57   ` Jakub Kicinski
  2021-06-16 12:51 ` [PATCH net-next 2/2] octeontx2-pf: " sgoutham
  1 sibling, 1 reply; 7+ messages in thread
From: sgoutham @ 2021-06-16 12:51 UTC (permalink / raw)
  To: davem, kuba, netdev; +Cc: Sunil Goutham

From: Sunil Goutham <sgoutham@marvell.com>

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(+)

diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index cfef6b0..2f16a07 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 3fa7a39..ced4a02 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -2759,6 +2759,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:
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 2/2] octeontx2-pf: Support setting ntuple rule count
  2021-06-16 12:51 [PATCH net-next 0/2] Support ethtool ntuple rule count change sgoutham
  2021-06-16 12:51 ` [PATCH net-next 1/2] net: ethtool: Support setting ntuple rule count sgoutham
@ 2021-06-16 12:51 ` sgoutham
  1 sibling, 0 replies; 7+ messages in thread
From: sgoutham @ 2021-06-16 12:51 UTC (permalink / raw)
  To: davem, kuba, netdev; +Cc: Sunil Goutham

From: Sunil Goutham <sgoutham@marvell.com>

Added support for changing ethtool ntuple filter count.
Rule count change is supported only when there are no
ntuple filters installed.

Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 .../ethernet/marvell/octeontx2/nic/otx2_common.h   |  1 +
 .../ethernet/marvell/octeontx2/nic/otx2_ethtool.c  |  3 +++
 .../ethernet/marvell/octeontx2/nic/otx2_flows.c    | 27 ++++++++++++++++++++--
 3 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
index 234b330..5420aca 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
@@ -820,6 +820,7 @@ int otx2_get_all_flows(struct otx2_nic *pfvf,
 int otx2_add_flow(struct otx2_nic *pfvf,
 		  struct ethtool_rxnfc *nfc);
 int otx2_remove_flow(struct otx2_nic *pfvf, u32 location);
+int otx2_set_flow_rule_count(struct otx2_nic *pfvf, int count);
 int otx2_prepare_flow_request(struct ethtool_rx_flow_spec *fsp,
 			      struct npc_install_flow_req *req);
 void otx2_rss_ctx_flow_del(struct otx2_nic *pfvf, int ctx_id);
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
index 8df748e..753a8cf 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
@@ -690,6 +690,9 @@ static int otx2_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *nfc)
 		if (netif_running(dev) && ntuple)
 			ret = otx2_remove_flow(pfvf, nfc->fs.location);
 		break;
+	case ETHTOOL_SRXCLSRLCNT:
+		ret = otx2_set_flow_rule_count(pfvf, nfc->rule_cnt);
+		break;
 	default:
 		break;
 	}
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
index 8c97106..61530c8 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
@@ -117,12 +117,29 @@ static int otx2_alloc_ntuple_mcam_entries(struct otx2_nic *pfvf, u16 count)
 
 	if (allocated != count)
 		netdev_info(pfvf->netdev,
-			    "Unable to allocate %d MCAM entries for ntuple, got %d\n",
-			    count, allocated);
+			    "Unable to allocate %d MCAM entries above default rules "
+			    "start index %d, got only %d\n",
+			    count, flow_cfg->def_ent[0], allocated);
 
 	return allocated;
 }
 
+int otx2_set_flow_rule_count(struct otx2_nic *pfvf, int count)
+{
+	struct otx2_flow_config *flow_cfg = pfvf->flow_cfg;
+
+	if (!flow_cfg)
+		return 0;
+
+	if (flow_cfg->nr_flows) {
+		netdev_err(pfvf->netdev,
+			   "Cannot change count when there are active rules\n");
+		return 0;
+	}
+
+	return otx2_alloc_ntuple_mcam_entries(pfvf, count);
+}
+
 int otx2_alloc_mcam_entries(struct otx2_nic *pfvf)
 {
 	struct otx2_flow_config *flow_cfg = pfvf->flow_cfg;
@@ -827,6 +844,12 @@ int otx2_add_flow(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc)
 	u32 ring;
 	int err;
 
+	if (!flow_cfg->ntuple_max_flows) {
+		netdev_err(pfvf->netdev,
+			   "Ntuple rule count is 0, allocate and retry\n");
+		return -EINVAL;
+	}
+
 	ring = ethtool_get_flow_spec_ring(fsp->ring_cookie);
 	if (!(pfvf->flags & OTX2_FLAG_NTUPLE_SUPPORT))
 		return -ENOMEM;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 1/2] net: ethtool: Support setting ntuple rule count
  2021-06-16 12:51 ` [PATCH net-next 1/2] net: ethtool: Support setting ntuple rule count sgoutham
@ 2021-06-16 17:57   ` Jakub Kicinski
  2021-06-17 13:16     ` [EXT] " Sunil Kovvuri Goutham
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2021-06-16 17:57 UTC (permalink / raw)
  To: sgoutham; +Cc: davem, netdev

On Wed, 16 Jun 2021 18:21:21 +0530 sgoutham@marvell.com wrote:
> From: Sunil Goutham <sgoutham@marvell.com>
> 
> 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

man devlink-resource ?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [EXT] Re: [PATCH net-next 1/2] net: ethtool: Support setting ntuple rule count
  2021-06-16 17:57   ` Jakub Kicinski
@ 2021-06-17 13:16     ` Sunil Kovvuri Goutham
  2021-06-22 17:34       ` Sunil Kovvuri Goutham
  0 siblings, 1 reply; 7+ messages in thread
From: Sunil Kovvuri Goutham @ 2021-06-17 13:16 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev



> -----Original Message-----
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Wednesday, June 16, 2021 11:28 PM
> To: Sunil Kovvuri Goutham <sgoutham@marvell.com>
> Cc: davem@davemloft.net; netdev@vger.kernel.org
> Subject: [EXT] Re: [PATCH net-next 1/2] net: ethtool: Support setting ntuple
> rule count
> 
> External Email
> 
> ----------------------------------------------------------------------
> On Wed, 16 Jun 2021 18:21:21 +0530 sgoutham@marvell.com wrote:
> > From: Sunil Goutham <sgoutham@marvell.com>
> >
> > 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
> 
> man devlink-resource ?

Since ntuple rule insert and delete are part of ethtool, I thought having this config also in
ethtool will make user life easy ie all ntuple related stuff within one tool.

Thanks,
Sunil.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [EXT] Re: [PATCH net-next 1/2] net: ethtool: Support setting ntuple rule count
  2021-06-17 13:16     ` [EXT] " Sunil Kovvuri Goutham
@ 2021-06-22 17:34       ` Sunil Kovvuri Goutham
  0 siblings, 0 replies; 7+ messages in thread
From: Sunil Kovvuri Goutham @ 2021-06-22 17:34 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev



> -----Original Message-----
> From: Sunil Kovvuri Goutham
> Sent: Thursday, June 17, 2021 6:46 PM
> To: Jakub Kicinski <kuba@kernel.org>
> Cc: davem@davemloft.net; netdev@vger.kernel.org
> Subject: RE: [EXT] Re: [PATCH net-next 1/2] net: ethtool: Support setting
> ntuple rule count
> 
> 
> 
> > -----Original Message-----
> > From: Jakub Kicinski <kuba@kernel.org>
> > Sent: Wednesday, June 16, 2021 11:28 PM
> > To: Sunil Kovvuri Goutham <sgoutham@marvell.com>
> > Cc: davem@davemloft.net; netdev@vger.kernel.org
> > Subject: [EXT] Re: [PATCH net-next 1/2] net: ethtool: Support setting
> > ntuple rule count
> >
> > External Email
> >
> > ----------------------------------------------------------------------
> > On Wed, 16 Jun 2021 18:21:21 +0530 sgoutham@marvell.com wrote:
> > > From: Sunil Goutham <sgoutham@marvell.com>
> > >
> > > 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
> >
> > man devlink-resource ?
> 
> Since ntuple rule insert and delete are part of ethtool, I thought having this
> config also in ethtool will make user life easy ie all ntuple related stuff within
> one tool.
> 
> Thanks,
> Sunil.

Any further feedback or objections to these change ?

Thanks,
Sunil.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH net-next 0/2] Support ethtool ntuple rule count change
@ 2021-06-16 12:49 sgoutham
  0 siblings, 0 replies; 7+ messages in thread
From: sgoutham @ 2021-06-16 12:49 UTC (permalink / raw)
  To: davem, kuba, netdev; +Cc: Sunil Goutham

From: Sunil Goutham <sgoutham@marvell.com>

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.
This 2 patch series adds support to modify ntuple rule
count for OcteonTx2 netdev.

Sunil Goutham (2):
  net: ethtool: Support setting ntuple rule count
  octeontx2-pf: Support setting ntuple rule count

 .../ethernet/marvell/octeontx2/nic/otx2_common.h   |  1 +
 .../ethernet/marvell/octeontx2/nic/otx2_ethtool.c  |  3 +++
 .../ethernet/marvell/octeontx2/nic/otx2_flows.c    | 27 ++++++++++++++++++++--
 include/uapi/linux/ethtool.h                       |  1 +
 net/ethtool/ioctl.c                                |  1 +
 5 files changed, 31 insertions(+), 2 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-06-22 17:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16 12:51 [PATCH net-next 0/2] Support ethtool ntuple rule count change sgoutham
2021-06-16 12:51 ` [PATCH net-next 1/2] net: ethtool: Support setting ntuple rule count sgoutham
2021-06-16 17:57   ` Jakub Kicinski
2021-06-17 13:16     ` [EXT] " Sunil Kovvuri Goutham
2021-06-22 17:34       ` Sunil Kovvuri Goutham
2021-06-16 12:51 ` [PATCH net-next 2/2] octeontx2-pf: " sgoutham
  -- strict thread matches above, loose matches on Subject: below --
2021-06-16 12:49 [PATCH net-next 0/2] Support ethtool ntuple rule count change sgoutham

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.