linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fred Lefranc <hardware.evs@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Fred Lefranc <hardware.evs@gmail.com>,
	Madalin Bucur <madalin.bucur@nxp.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] net/fsl: fman: Allow fm_max_frame_sz & rx_extra_headroom config from devicetree.
Date: Thu, 17 Feb 2022 17:05:26 +0100	[thread overview]
Message-ID: <20220217160528.2662513-1-hardware.evs@gmail.com> (raw)

Allow modification of two additional Frame Manager parameters :
- FM Max Frame Size : Can be changed to a value other than 1522
  (ie support Jumbo Frames)
- RX Extra Headroom

Signed-off-by: Fred Lefranc <hardware.evs@gmail.com>
---
 drivers/net/ethernet/freescale/fman/fman.c | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c
index 8f0db61cb1f6..bf4240eacf42 100644
--- a/drivers/net/ethernet/freescale/fman/fman.c
+++ b/drivers/net/ethernet/freescale/fman/fman.c
@@ -2862,6 +2862,32 @@ static struct fman *read_dts_node(struct platform_device *of_dev)
 		of_property_read_bool(fm_node, "fsl,erratum-a050385");
 #endif
 
+	/* Get Max Frame Size */
+	err = of_property_read_u32(fm_node, "fsl,max-frm-sz", &val);
+	if (!err) {
+		if (val > FSL_FM_MAX_POSSIBLE_FRAME_SIZE)
+			fsl_fm_max_frm = FSL_FM_MAX_POSSIBLE_FRAME_SIZE;
+		else if (val < FSL_FM_MIN_POSSIBLE_FRAME_SIZE)
+			fsl_fm_max_frm = FSL_FM_MIN_POSSIBLE_FRAME_SIZE;
+		else
+			fsl_fm_max_frm = (int)val;
+	}
+	dev_dbg(&of_dev->dev, "Configured Max Frame Size: %d\n",
+		fsl_fm_max_frm);
+
+	/* Get RX Extra Headroom Value */
+	err = of_property_read_u32(fm_node, "fsl,rx-extra-headroom", &val);
+	if (!err) {
+		if (val > FSL_FM_RX_EXTRA_HEADROOM_MAX)
+			fsl_fm_rx_extra_headroom = FSL_FM_RX_EXTRA_HEADROOM_MAX;
+		else if (val < FSL_FM_RX_EXTRA_HEADROOM_MIN)
+			fsl_fm_rx_extra_headroom = FSL_FM_RX_EXTRA_HEADROOM_MIN;
+		else
+			fsl_fm_rx_extra_headroom = (int)val;
+	}
+	dev_dbg(&of_dev->dev, "Configured RX Extra Headroom: %d\n",
+		fsl_fm_rx_extra_headroom);
+
 	return fman;
 
 fman_node_put:
-- 
2.25.1


             reply	other threads:[~2022-02-17 16:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17 16:05 Fred Lefranc [this message]
2022-02-17 16:05 ` [PATCH 2/2] net/fsl: fman dt binding: add fsl,max-frm-sz & fsl,rx-extra-headroom properties Fred Lefranc
2022-02-18  4:08 ` [PATCH 1/2] net/fsl: fman: Allow fm_max_frame_sz & rx_extra_headroom config from devicetree Jakub Kicinski
2022-02-18  7:23 ` Madalin Bucur
2022-02-18 11:28   ` EVS Hardware Dpt
2022-02-18 11:33     ` Madalin Bucur
2022-02-18 12:28       ` EVS Hardware Dpt
2022-02-25 17:42         ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220217160528.2662513-1-hardware.evs@gmail.com \
    --to=hardware.evs@gmail.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=madalin.bucur@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).