lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <OF13743B7F.C32B8685-ONC1257587.003E2ABA-C1257587.003EE8DA@transmode.se>
Date:	Sat, 28 Mar 2009 12:27:09 +0100
From:	Joakim Tjernlund <Joakim.Tjernlund@...nsmode.se>
To:	Timur Tabi <timur@...escale.com>
Cc:	avorontsov@...mvista.com, David Miller <davem@...emloft.net>,
	leoli@...escale.com, linuxppc-dev@...abs.org,
	netdev@...r.kernel.org, timur.tabi@...il.com
Subject: Re: [PATCH] ucc_geth: Convert to net_device_ops

timur.tabi@...il.com wrote on 27/03/2009 19:50:30:

> 
> On Tue, Mar 24, 2009 at 6:08 PM, Joakim Tjernlund
> <Joakim.Tjernlund@...nsmode.se> wrote:
> 
> > +       .ndo_change_mtu         = 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 = netdev_priv(dev);
> +   int frame_size = 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 = ugeth->ug_info;
> +      uf_info = &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 =
> +          (frame_size & ~(UCC_GETH_MRBLR_ALIGNMENT - 1)) +
> +          UCC_GETH_MRBLR_ALIGNMENT;
> +
> +      ugeth->ug_info->uf_info.max_rx_buf_length = max_rx_buf_length;
> +      dev->mtu = new_mtu;
> +
> +      /* Set the max. rx buffer size (MRBLR) */
> +      uf_info->max_rx_buf_length = max_rx_buf_length;
> +
> +      /* set the max. frame length (MFLR) */
> +      ug_info->maxFrameLength = frame_size;
> +
> +      ugeth_info("%s: MTU = %d (frame size=%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.

Not quite so. I don't think you can support JUMBO frames with just one big 
RX buffer.
Also, maxframe & RX buffer should be somewhat bigger than the actual mtu 
so you can
support VLAN(4) and PPPOE(8) = 12 bytes.
You need to add 12 bytes to the default values too.

 Jocke 

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ