diff mbox series

[net-next,v11,08/11] octeontx2-pf: Configure VF mtu via representor

Message ID 20240822132031.29494-9-gakula@marvell.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series Introduce RVU representors | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 7 this patch: 7
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 20 this patch: 20
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 40 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-25--21-00 (tests: 714)

Commit Message

Geetha sowjanya Aug. 22, 2024, 1:20 p.m. UTC
Adds support to manage the mtu configuration for VF through representor.
On update of representor mtu a mbox notification is send
to VF to update its mtu.

Signed-off-by: Sai Krishna <saikrishnag@marvell.com>
Signed-off-by: Geetha sowjanya <gakula@marvell.com>
Reviewed-by: Simon Horman <horms@kernel.org>
---
 .../ethernet/marvell/octeontx2/nic/otx2_pf.c    |  5 +++++
 .../net/ethernet/marvell/octeontx2/nic/rep.c    | 17 +++++++++++++++++
 2 files changed, 22 insertions(+)

Comments

Jiri Pirko Aug. 22, 2024, 2:23 p.m. UTC | #1
Thu, Aug 22, 2024 at 03:20:28PM CEST, gakula@marvell.com wrote:
>Adds support to manage the mtu configuration for VF through representor.
>On update of representor mtu a mbox notification is send
>to VF to update its mtu.

NACK

Nope. If your patch does what you describe, this is certainly incorrect.

VF is responsible of setting MTU itself. If you set MTU on representor
netdev, it's related only to that, you SHOULD NOT touch VF MTU.


>
>Signed-off-by: Sai Krishna <saikrishnag@marvell.com>
>Signed-off-by: Geetha sowjanya <gakula@marvell.com>
>Reviewed-by: Simon Horman <horms@kernel.org>
>---
> .../ethernet/marvell/octeontx2/nic/otx2_pf.c    |  5 +++++
> .../net/ethernet/marvell/octeontx2/nic/rep.c    | 17 +++++++++++++++++
> 2 files changed, 22 insertions(+)
>
>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>index cdd1f1321318..955ea941a53b 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>@@ -854,6 +854,11 @@ static int otx2_mbox_up_handler_rep_event_up_notify(struct otx2_nic *pf,
> {
> 	struct net_device *netdev = pf->netdev;
> 
>+	if (info->event == RVU_EVENT_MTU_CHANGE) {
>+		netdev->mtu = info->evt_data.mtu;
>+		return 0;
>+	}
>+
> 	if (info->event == RVU_EVENT_PORT_STATE) {
> 		if (info->evt_data.port_state) {
> 			pf->flags |= OTX2_FLAG_PORT_UP;
>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
>index 95301faf6afe..5f767b6e79c3 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
>@@ -79,6 +79,22 @@ int rvu_event_up_notify(struct otx2_nic *pf, struct rep_event *info)
> 	return 0;
> }
> 
>+static int rvu_rep_change_mtu(struct net_device *dev, int new_mtu)
>+{
>+	struct rep_dev *rep = netdev_priv(dev);
>+	struct otx2_nic *priv = rep->mdev;
>+	struct rep_event evt = {0};
>+
>+	netdev_info(dev, "Changing MTU from %d to %d\n",
>+		    dev->mtu, new_mtu);
>+	dev->mtu = new_mtu;
>+
>+	evt.evt_data.mtu = new_mtu;
>+	evt.pcifunc = rep->pcifunc;
>+	rvu_rep_notify_pfvf(priv, RVU_EVENT_MTU_CHANGE, &evt);
>+	return 0;
>+}
>+
> static void rvu_rep_get_stats(struct work_struct *work)
> {
> 	struct delayed_work *del_work = to_delayed_work(work);
>@@ -226,6 +242,7 @@ static const struct net_device_ops rvu_rep_netdev_ops = {
> 	.ndo_stop		= rvu_rep_stop,
> 	.ndo_start_xmit		= rvu_rep_xmit,
> 	.ndo_get_stats64	= rvu_rep_get_stats64,
>+	.ndo_change_mtu		= rvu_rep_change_mtu,
> };
> 
> static int rvu_rep_napi_init(struct otx2_nic *priv,
>-- 
>2.25.1
>
Geetha sowjanya Sept. 1, 2024, 9:51 a.m. UTC | #2
>-----Original Message-----
>From: Jiri Pirko <jiri@resnulli.us>
>Sent: Thursday, August 22, 2024 7:54 PM
>To: Geethasowjanya Akula <gakula@marvell.com>
>Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; kuba@kernel.org;
>davem@davemloft.net; pabeni@redhat.com; edumazet@google.com; Sunil
>Kovvuri Goutham <sgoutham@marvell.com>; Subbaraya Sundeep Bhatta
><sbhatta@marvell.com>; Hariprasad Kelam <hkelam@marvell.com>
>Subject: [EXTERNAL] Re: [net-next PATCH v11 08/11] octeontx2-pf: Configure VF
>mtu via representor
>
>
>Thu, Aug 22, 2024 at 03:20:28PM CEST, gakula@marvell.com wrote:
>>Adds support to manage the mtu configuration for VF through representor.
>>On update of representor mtu a mbox notification is send to VF to
>>update its mtu.
>
>NACK
>
>Nope. If your patch does what you describe, this is certainly incorrect.
>
>VF is responsible of setting MTU itself. If you set MTU on representor netdev,
>it's related only to that, you SHOULD NOT touch VF MTU.

We implemented this feature based on the kernel representor documentation "https://docs.kernel.org/networking/representors.html"
"Setting an MTU on the representor should cause that same MTU to be reported to the representee. (On hardware that allows configuring separate and distinct MTU and MRU values, the representor MTU should correspond to the representee’s MRU and vice-versa.)"

>
>
>>
>>Signed-off-by: Sai Krishna <saikrishnag@marvell.com>
>>Signed-off-by: Geetha sowjanya <gakula@marvell.com>
>>Reviewed-by: Simon Horman <horms@kernel.org>
>>---
>> .../ethernet/marvell/octeontx2/nic/otx2_pf.c    |  5 +++++
>> .../net/ethernet/marvell/octeontx2/nic/rep.c    | 17 +++++++++++++++++
>> 2 files changed, 22 insertions(+)
>>
>>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>>index cdd1f1321318..955ea941a53b 100644
>>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>>@@ -854,6 +854,11 @@ static int
>>otx2_mbox_up_handler_rep_event_up_notify(struct otx2_nic *pf,  {
>> 	struct net_device *netdev = pf->netdev;
>>
>>+	if (info->event == RVU_EVENT_MTU_CHANGE) {
>>+		netdev->mtu = info->evt_data.mtu;
>>+		return 0;
>>+	}
>>+
>> 	if (info->event == RVU_EVENT_PORT_STATE) {
>> 		if (info->evt_data.port_state) {
>> 			pf->flags |= OTX2_FLAG_PORT_UP;
>>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
>>b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
>>index 95301faf6afe..5f767b6e79c3 100644
>>--- a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
>>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
>>@@ -79,6 +79,22 @@ int rvu_event_up_notify(struct otx2_nic *pf, struct
>rep_event *info)
>> 	return 0;
>> }
>>
>>+static int rvu_rep_change_mtu(struct net_device *dev, int new_mtu) {
>>+	struct rep_dev *rep = netdev_priv(dev);
>>+	struct otx2_nic *priv = rep->mdev;
>>+	struct rep_event evt = {0};
>>+
>>+	netdev_info(dev, "Changing MTU from %d to %d\n",
>>+		    dev->mtu, new_mtu);
>>+	dev->mtu = new_mtu;
>>+
>>+	evt.evt_data.mtu = new_mtu;
>>+	evt.pcifunc = rep->pcifunc;
>>+	rvu_rep_notify_pfvf(priv, RVU_EVENT_MTU_CHANGE, &evt);
>>+	return 0;
>>+}
>>+
>> static void rvu_rep_get_stats(struct work_struct *work)  {
>> 	struct delayed_work *del_work = to_delayed_work(work); @@ -226,6
>>+242,7 @@ static const struct net_device_ops rvu_rep_netdev_ops = {
>> 	.ndo_stop		= rvu_rep_stop,
>> 	.ndo_start_xmit		= rvu_rep_xmit,
>> 	.ndo_get_stats64	= rvu_rep_get_stats64,
>>+	.ndo_change_mtu		= rvu_rep_change_mtu,
>> };
>>
>> static int rvu_rep_napi_init(struct otx2_nic *priv,
>>--
>>2.25.1
>>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
index cdd1f1321318..955ea941a53b 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
@@ -854,6 +854,11 @@  static int otx2_mbox_up_handler_rep_event_up_notify(struct otx2_nic *pf,
 {
 	struct net_device *netdev = pf->netdev;
 
+	if (info->event == RVU_EVENT_MTU_CHANGE) {
+		netdev->mtu = info->evt_data.mtu;
+		return 0;
+	}
+
 	if (info->event == RVU_EVENT_PORT_STATE) {
 		if (info->evt_data.port_state) {
 			pf->flags |= OTX2_FLAG_PORT_UP;
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
index 95301faf6afe..5f767b6e79c3 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
@@ -79,6 +79,22 @@  int rvu_event_up_notify(struct otx2_nic *pf, struct rep_event *info)
 	return 0;
 }
 
+static int rvu_rep_change_mtu(struct net_device *dev, int new_mtu)
+{
+	struct rep_dev *rep = netdev_priv(dev);
+	struct otx2_nic *priv = rep->mdev;
+	struct rep_event evt = {0};
+
+	netdev_info(dev, "Changing MTU from %d to %d\n",
+		    dev->mtu, new_mtu);
+	dev->mtu = new_mtu;
+
+	evt.evt_data.mtu = new_mtu;
+	evt.pcifunc = rep->pcifunc;
+	rvu_rep_notify_pfvf(priv, RVU_EVENT_MTU_CHANGE, &evt);
+	return 0;
+}
+
 static void rvu_rep_get_stats(struct work_struct *work)
 {
 	struct delayed_work *del_work = to_delayed_work(work);
@@ -226,6 +242,7 @@  static const struct net_device_ops rvu_rep_netdev_ops = {
 	.ndo_stop		= rvu_rep_stop,
 	.ndo_start_xmit		= rvu_rep_xmit,
 	.ndo_get_stats64	= rvu_rep_get_stats64,
+	.ndo_change_mtu		= rvu_rep_change_mtu,
 };
 
 static int rvu_rep_napi_init(struct otx2_nic *priv,