From: Timur Tabi <timur@freescale.com>
To: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Cc: leoli@freescale.com, linuxppc-dev@ozlabs.org,
David Miller <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: Re: [PATCH] ucc_geth: Convert to net_device_ops
Date: Fri, 27 Mar 2009 13:50:30 -0500 [thread overview]
Message-ID: <ed82fe3e0903271150v34fc18cbua6bb7918a3a71c71@mail.gmail.com> (raw)
In-Reply-To: <OF4B79F4DE.4DC6DEA7-ONC1257583.007ECBEA-C1257583.007F2805@transmode.se>
On Tue, Mar 24, 2009 at 6:08 PM, Joakim Tjernlund
<Joakim.Tjernlund@transmode.se> wrote:
> + =A0 =A0 =A0 .ndo_change_mtu =A0 =A0 =A0 =A0 =3D eth_change_mtu,
I have an old patch for change_mtu support for ucc_geth which I've
been meaning to push upstream. This patch uses this function instead
of eth_change_mtu():
+static int ucc_geth_change_mtu(struct net_device *dev, int new_mtu)
+{
+ int max_rx_buf_length;
+ struct ucc_geth_private *ugeth =3D netdev_priv(dev);
+ int frame_size =3D new_mtu + 18;
+ struct ucc_geth_info *ug_info;
+ struct ucc_fast_info *uf_info;
+
+ if (ugeth->p_rx_glbl_pram) {
+ printk("%s: Interface is active!\n", __FUNCTION__);
+ } else {
+
+ ug_info =3D ugeth->ug_info;
+ uf_info =3D &ug_info->uf_info;
+
+ if ((frame_size < 64) || (frame_size > JUMBO_FRAME_SIZE)) {
+ printk(KERN_ERR "%s: Invalid MTU setting\n", dev->name);
+ return -EINVAL;
+ }
+
+ max_rx_buf_length =3D
+ (frame_size & ~(UCC_GETH_MRBLR_ALIGNMENT - 1)) +
+ UCC_GETH_MRBLR_ALIGNMENT;
+
+ ugeth->ug_info->uf_info.max_rx_buf_length =3D max_rx_buf_length;
+ dev->mtu =3D new_mtu;
+
+ /* Set the max. rx buffer size (MRBLR) */
+ uf_info->max_rx_buf_length =3D max_rx_buf_length;
+
+ /* set the max. frame length (MFLR) */
+ ug_info->maxFrameLength =3D frame_size;
+
+ ugeth_info("%s: MTU =3D %d (frame size=3D%d)\n", dev->name,
+ dev->mtu, frame_size);
+ }
+ return 0;
+}
Do you think this is how it should be done? I don't know enough about
ucc_geth and MTUs to know off-hand.
--=20
Timur Tabi
Linux kernel developer at Freescale
next prev parent reply other threads:[~2009-03-27 18:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-23 10:17 [PATCH] ucc_geth: Convert to net_device_ops Joakim Tjernlund
2009-03-23 18:49 ` David Miller
2009-03-24 10:37 ` Joakim Tjernlund
2009-03-24 21:22 ` David Miller
2009-03-24 22:45 ` Joakim Tjernlund
2009-03-24 22:49 ` David Miller
2009-03-24 23:08 ` Joakim Tjernlund
2009-03-24 23:29 ` David Miller
2009-03-24 23:35 ` Joakim Tjernlund
2009-03-27 18:50 ` Timur Tabi [this message]
2009-03-28 11:27 ` Joakim Tjernlund
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=ed82fe3e0903271150v34fc18cbua6bb7918a3a71c71@mail.gmail.com \
--to=timur@freescale.com \
--cc=Joakim.Tjernlund@transmode.se \
--cc=davem@davemloft.net \
--cc=leoli@freescale.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=netdev@vger.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).