ipg: add jumbo frame support kconfig option
Subsystems (2)
Hello,
Quoted 11 lines · Pekka J Enberg
Quoted 4 lines · Stephen Hemminger
Quoted 4 lines
Please don't do this as a config option. Config options seem like a good idea to developers but are difficult for distributions. Either support jumbo frames by default or not at all.
Quoted 3 lines · Jeff Garzik
Agreed, but to be more specific... always compile in jumbo frame support. You don't have to enable it at runtime by default, though.
Quoted 5 lines
Ok, so a sysfs attribute would be sufficient, I suppose? I don't have the hardware though, so I don't even know if the jumbo frame code actually works at this point hence the RFC. So I'll wait for someone to test this before sending a new patch. Thanks for the review!
I own such card:
02:02.0 Ethernet controller: Sundance Technology Inc / IC Plus Corp IP1000 Family Gigabit Ethernet (rev 41)
and I use patch similar to yours in order to enable Jumbo Frames. See attachment for details, patch is done for linux-2.6.25.6.
It works fine for me. However, I enabled 10K jumbo boxes instead of default 4K value, activated using your patch. Reason is simple: I need at least 9000-byte jumbo boxes in my network.
However, I have one request for you: please, make in possible to choose max MTU via kernel config option. In different environments different people may need different max MTU sizes (2K...10K). Recommended value is 4K (as described in the original driver from manufacturer, which was remake into kernel's one), but, for example, I'm interested in larger MTU values. OTOH larger MTU values require more memory and so on. For me, as for end user of Linux kernel, a possibility to select desired max MTU is very attractive and is definitely in no doubt more convenient than patching the kernel myself each time.
So, feel free to add jumbo boxes on ipg support to the mainstream and, please, make in possible to select max MTU; 4K as default will be fine.
Sincerely yours,
Andrew
net/ipg.c renamed from net/ipg.c.orig +7 -6
@@ -42,7 +42,8 @@#define ipg_r16 (reg) ioread16(ioaddr + (reg))#define ipg_r8 (reg) ioread8(ioaddr + (reg)) -#define JUMBO_FRAME_4k_ONLY +#define JUMBO_FRAME +#define JUMBO_FRAME_SIZE_10K enum { netdev_io_size =128 };
@@ -1267,7 +1268,7 @@return ;if (jumbo->found_start) { -int framelen, endframelen; +int framelen, endframeLen; framelen =le64_to_cpu (rxfd->rfs) &IPG_RFS_RXFRAMELEN ;
@@ -1352,16 +1353,16 @@switch (ipg_nic_rx_check_frame_type (dev)) {case FRAME_WITH_START_WITH_END : -ipg_nic_rx_with_start_and_end (dev, tp, rxfd, entry); +ipg_nic_rx_with_start_and_end (dev, sp, rxfd, entry);break ;case FRAME_WITH_START : -ipg_nic_rx_with_start (dev, tp, rxfd, entry); +ipg_nic_rx_with_start (dev, sp, rxfd, entry);break ;case FRAME_WITH_END : -ipg_nic_rx_with_end (dev, tp, rxfd, entry); +ipg_nic_rx_with_end (dev, sp, rxfd, entry);break ;case FRAME_NO_START_NO_END : -ipg_nic_rx_no_start_no_end (dev, tp, rxfd, entry); +ipg_nic_rx_no_start_no_end (dev, sp, rxfd, entry);break ; } }
Hi Andrew,
(Please don't trim the cc.)
Quoted 41 lines · Andrew Savchenko
Hello,
Quoted 11 lines · Pekka J Enberg
Quoted 4 lines · Stephen Hemminger
Quoted 4 lines
Please don't do this as a config option. Config options seem like a good idea to developers but are difficult for distributions. Either support jumbo frames by default or not at all.
Quoted 3 lines · Jeff Garzik
Agreed, but to be more specific... always compile in jumbo frame support. You don't have to enable it at runtime by default, though.
Quoted 5 lines
Ok, so a sysfs attribute would be sufficient, I suppose? I don't have the hardware though, so I don't even know if the jumbo frame code actually works at this point hence the RFC. So I'll wait for someone to test this before sending a new patch. Thanks for the review!
I own such card:
02:02.0 Ethernet controller: Sundance Technology Inc / IC Plus Corp IP1000 Family Gigabit Ethernet (rev 41)
and I use patch similar to yours in order to enable Jumbo Frames. See attachment for details, patch is done for linux-2.6.25.6.It works fine for me. However, I enabled 10K jumbo boxes instead of default 4K value, activated using your patch. Reason is simple: I need at least 9000-byte jumbo boxes in my network.
However, I have one request for you: please, make in possible to choose max MTU via kernel config option. In different environments different people may need different max MTU sizes (2K...10K). Recommended value is 4K (as described in the original driver from manufacturer, which was remake into kernel's one), but, for example, I'm interested in larger MTU values. OTOH larger MTU values require more memory and so on. For me, as for end user of Linux kernel, a possibility to select desired max MTU is very attractive and is definitely in no doubt more convenient than patching the kernel myself each time.
Quoted 3 lines
So, feel free to add jumbo boxes on ipg support to the mainstream and, please, make in possible to select max MTU; 4K as default will be fine.
As I don't have the hardware, I would appreciate if you could test the following quilt tree:
http://www.kernel.org/pub/linux/kernel/people/penberg/patches/ipg/2.6.26-rc6/
[Note: in case you're not familiar with quilt, the patches need to
be applied in the order specified by the quilt 'series' file included there.]
You can enable 10KB jumbo frames either by passing:
ipg.jumbo=10k
to the kernel command line or, alternatively, load the ipg module as follows:
modprobe ipg jumbo=10k
You cannot enable or disable jumbo frame support once the module is loaded so if you want to try out different frame sizes, you first need to unload the module.
Pekka
Quoted 66 lines · On Fri, 20 Jun 2008 14:12:51 +0300 "Pekka Enberg" <[email protected]>…
Hi Andrew,
(Please don't trim the cc.)
Quoted 41 lines · Andrew Savchenko
Hello,
Quoted 11 lines · Pekka J Enberg
Quoted 4 lines · Stephen Hemminger
Quoted 4 lines
Please don't do this as a config option. Config options seem like a good idea to developers but are difficult for distributions. Either support jumbo frames by default or not at all.
Quoted 3 lines · Jeff Garzik
Agreed, but to be more specific... always compile in jumbo frame support. You don't have to enable it at runtime by default, though.
Quoted 5 lines
Ok, so a sysfs attribute would be sufficient, I suppose? I don't have the hardware though, so I don't even know if the jumbo frame code actually works at this point hence the RFC. So I'll wait for someone to test this before sending a new patch. Thanks for the review!
I own such card:
02:02.0 Ethernet controller: Sundance Technology Inc / IC Plus Corp IP1000 Family Gigabit Ethernet (rev 41)
and I use patch similar to yours in order to enable Jumbo Frames. See attachment for details, patch is done for linux-2.6.25.6.It works fine for me. However, I enabled 10K jumbo boxes instead of default 4K value, activated using your patch. Reason is simple: I need at least 9000-byte jumbo boxes in my network.
However, I have one request for you: please, make in possible to choose max MTU via kernel config option. In different environments different people may need different max MTU sizes (2K...10K). Recommended value is 4K (as described in the original driver from manufacturer, which was remake into kernel's one), but, for example, I'm interested in larger MTU values. OTOH larger MTU values require more memory and so on. For me, as for end user of Linux kernel, a possibility to select desired max MTU is very attractive and is definitely in no doubt more convenient than patching the kernel myself each time.
Quoted 3 lines
So, feel free to add jumbo boxes on ipg support to the mainstream and, please, make in possible to select max MTU; 4K as default will be fine.
As I don't have the hardware, I would appreciate if you could test the following quilt tree:
http://www.kernel.org/pub/linux/kernel/people/penberg/patches/ipg/2.6.26-rc6/
[Note: in case you're not familiar with quilt, the patches need to
be applied in the order specified by the quilt 'series' file included there.]You can enable 10KB jumbo frames either by passing:
ipg.jumbo=10k
to the kernel command line or, alternatively, load the ipg module as follows:
Quoted 7 lines
modprobe ipg jumbo=10k
You cannot enable or disable jumbo frame support once the module is loaded so if you want to try out different frame sizes, you first need to unload the module.
Pekka
The code should enable/disable anything it needs based on the MTU size in the change_mtu call. If the driver needs to reallocate buffers, change receiver settings, make sacrifices to deities, or phone home that is the place to do it. In other words no compile or config option fro MTU settings please.
Hi Pekka,
Quoted 3 lines · Pekka Enberg
Hi Andrew,
(Please don't trim the cc.)
Oh, my apologies. I'm not subscribed to the list, so I mailed only to emails found on lkml web page with original top mail.
Quoted 2 lines
On Fri, Jun 20, 2008 at 9:37 AM, Andrew Savchenko
<[email protected]> wrote:
[...]
Quoted 10 lines
As I don't have the hardware, I would appreciate if you could test the following quilt tree:
http://www.kernel.org/pub/linux/kernel/people/penberg/patches/ip
g/2.6.26-rc6/[Note: in case you're not familiar with quilt, the patches need to be applied in the order specified by the quilt 'series' file included there.]
Thanks for the advice. I installed quilt on my system and applied your patchset to 2.6.26-rc6 kernel tree.
Quoted 4 lines
You can enable 10KB jumbo frames either by passing:
ipg.jumbo=10k
Quoted 8 lines
to the kernel command line or, alternatively, load the ipg module as follows:
modprobe ipg jumbo=10k
You cannot enable or disable jumbo frame support once the module is loaded so if you want to try out different frame sizes, you first need to unload the module.
Ok, but in practice I need to reboot the system: 1) usually I compile into the kernel all code related to frequently used hardware. 2) This is a remote system, so reload of network module which is in use will be quite tricky.
I tested it with both jumbo frames disabled (no options), and enabled for 10k frames: ipg.jumbo=10k. It seems to work fine with all acceptable MTUs (max MTU == 10240).
Sincerely yours,
Andrew
Quoted 4 lines · Stephen Hemminger
The code should enable/disable anything it needs based on the MTU size in the
change_mtucall. If the driver needs to reallocate buffers, change receiver settings, make sacrifices to deities, or phone home that is the place to do it. In other words no compile or config option fro MTU settings please.
Right, so how about something like this instead? Andrew, can you test the following patch? You need all the other patches from the previous series modulo the last patch. Thanks!
Pekka
Subject: [PATCH] ipg: run-time configurable jumbo frame support
From: Pekka Enberg <[email protected]>
Make jumbo frame support configurable via ifconfig mtu option as suggested by Stephen Hemminger.
--- drivers/net/ipg.c | 42 ++++++++++++++++++++------ drivers/net/ipg.h | 85 ------------------------------------------------------ 2 files changed, 32 insertions(+), 95 deletions(-)
drivers/net/ipg.c +32 -10
@@ -42,7 +42,6 @@#define ipg_r16 (reg) ioread16(ioaddr + (reg))#define ipg_r8 (reg) ioread8(ioaddr + (reg)) -#define JUMBO_FRAME_4k_ONLYenum { netdev_io_size =128 };
@@ -55,6 +54,14 @@MODULE_LICENSE ("GPL" );/* +* Defaults +*/ +#define IPG_MAX_RXFRAME_SIZE 0x0600 +#define IPG_RXFRAG_SIZE 0x0600 +#define IPG_RXSUPPORT_SIZE 0x0600 +#define IPG_IS_JUMBO false + +/* * Variable record -- index by leading revision/length * Revision/Length(=N*4), Address1, Data1, Address2, Data2,...,AddressN,DataN */
@@ -1805,9 +1812,6 @@ sp->jumbo.current_size =0 ; sp->jumbo.skb =NULL ; -if (IPG_TXFRAG_SIZE ) - dev->mtu =IPG_TXFRAG_SIZE ; -/* Enable transmit and receive operation of the IPG. */ ipg_w32 ((ipg_r32 (MAC_CTRL ) |IPG_MC_RX_ENABLE |IPG_MC_TX_ENABLE ) &IPG_MC_RSVD_MASK ,MAC_CTRL );
@@ -2116,6 +2120,7 @@static int ipg_nic_change_mtu (struct net_device *dev,int new_mtu) {struct ipg_nic_private *sp =netdev_priv (dev); +int err;/* Function to accomodate changes to Maximum Transfer Unit * (or MTU) of IPG NIC. Cannot use default function since
@@ -2124,16 +2129,33 @@IPG_DEBUG_MSG ("_nic_change_mtu\n" ); -/* Check that the new MTU value is between 68 (14 byte header, 46 -* byte payload, 4 byte FCS) and IPG_MAX_RXFRAME_SIZE, which -* corresponds to the MAXFRAMESIZE register in the IPG. +/* +* Check that the new MTU value is between 68 (14 byte header, 46 byte +* payload, 4 byte FCS) and 10 KB, which is the largest supported MTU. */ -if ((new_mtu <68 ) || (new_mtu > sp->max_rxframe_size)) +if (new_mtu <68 || new_mtu >10240 )return -EINVAL ; + err =ipg_nic_stop (dev); +if (err) +return err; + dev->mtu = new_mtu; -return 0 ; + sp->max_rxframe_size = new_mtu; + + sp->rxfrag_size = new_mtu; +if (sp->rxfrag_size >4088 ) + sp->rxfrag_size =4088 ; + + sp->rxsupport_size = sp->max_rxframe_size; + +if (new_mtu >0x0600 ) + sp->is_jumbo = true; +else + sp->is_jumbo = false; + +return ipg_nic_open (dev); }static int ipg_get_settings (struct net_device *dev,struct ethtool_cmd *cmd)
@@ -2238,7 +2260,7 @@spin_lock_init (&sp->lock);mutex_init (&sp->mii_mutex); - sp->is_jumbo =IPG_JUMBO ; + sp->is_jumbo =IPG_IS_JUMBO ; sp->rxfrag_size =IPG_RXFRAG_SIZE ; sp->rxsupport_size =IPG_RXSUPPORT_SIZE ; sp->max_rxframe_size =IPG_MAX_RXFRAME_SIZE ;
drivers/net/ipg.h +0 -85
91 lines not on this page · raw message
Hi,
Quoted 10 lines · Pekka J Enberg
Quoted 5 lines · Stephen Hemminger
The code should enable/disable anything it needs based on the MTU size in the
change_mtucall. If the driver needs to reallocate buffers, change receiver settings, make sacrifices to deities, or phone home that is the place to do it. In other words no compile or config option fro MTU settings please.Right, so how about something like this instead? Andrew, can you test the following patch? You need all the other patches from the previous series modulo the last patch. Thanks!
Ok, I replaced old ipg-make-jumbo-frame-support-configurable with newer version. It works fine, I tuned MTU in the range from 68 to 10240 bytes )).
Thanks for the patch, awaiting for it in the main kernel tree.
Sincerely yours,
Andrew