summaryrefslogtreecommitdiff
path: root/ethtool.c
diff options
context:
space:
mode:
authorAnanda Raju <Ananda.Raju@neterion.com>2006-03-14 15:15:18 -0500
committerJeff Garzik <jeff@garzik.org>2006-07-18 22:21:38 -0400
commit1d077f0b42d91daad0473258f0f8c58efacda71b (patch)
tree8c4885063abc9aebb82784f3e217dd0fdacf59ea /ethtool.c
parent7064b0d88a566b4c373593a55c39ea2d1a53c35f (diff)
downloadethtool-1d077f0b42d91daad0473258f0f8c58efacda71b.tar.gz
[PATCH] UFO patch
Hi, Kernel version 2.6.15 onwards provides UDP Fragmentation Offload (UFO) This patch to ethtool provides UFO (UDP Fragmentation Offload) on/off support using -K option similar to feature TSO. To find out whether UFO is enabled or not use #ethtool -k eth3 Offload parameters for eth3: rx-checksumming: on tx-checksumming: on scatter-gather: on tcp segmentation offload: on udp fragmentation offload: on # To turn off UFO use following command. #ethtool -K eth3 ufo off To turn off UFO use following command. #ethtool -K eth3 ufo on Please review the patch. Signed-off-by: Ananda Raju <ananda.raju@neterion.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'ethtool.c')
-rw-r--r--ethtool.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/ethtool.c b/ethtool.c
index cc204ab..7d408be 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -144,7 +144,8 @@ static struct option {
" [ rx on|off ]\n"
" [ tx on|off ]\n"
" [ sg on|off ]\n"
- " [ tso on|off ]\n" },
+ " [ tso on|off ]\n"
+ " [ ufo on|off ]\n" },
{ "-i", "--driver", MODE_GDRV, "Show driver information" },
{ "-d", "--register-dump", MODE_GREGS, "Do a register dump" },
{ "-e", "--eeprom-dump", MODE_GEEPROM, "Do a EEPROM dump",
@@ -189,6 +190,7 @@ static int off_csum_rx_wanted = -1;
static int off_csum_tx_wanted = -1;
static int off_sg_wanted = -1;
static int off_tso_wanted = -1;
+static int off_ufo_wanted = -1;
static struct ethtool_pauseparam epause;
static int gpause_changed = 0;
@@ -292,6 +294,7 @@ static struct cmdline_info cmdline_offload[] = {
{ "tx", CMDL_BOOL, &off_csum_tx_wanted, NULL },
{ "sg", CMDL_BOOL, &off_sg_wanted, NULL },
{ "tso", CMDL_BOOL, &off_tso_wanted, NULL },
+ { "ufo", CMDL_BOOL, &off_ufo_wanted, NULL },
};
static struct cmdline_info cmdline_pause[] = {
@@ -1112,17 +1115,19 @@ static int dump_coalesce(void)
return 0;
}
-static int dump_offload (int rx, int tx, int sg, int tso)
+static int dump_offload (int rx, int tx, int sg, int tso, int ufo)
{
fprintf(stdout,
"rx-checksumming: %s\n"
"tx-checksumming: %s\n"
"scatter-gather: %s\n"
- "tcp segmentation offload: %s\n",
+ "tcp segmentation offload: %s\n"
+ "udp fragmentation offload: %s\n",
rx ? "on" : "off",
tx ? "on" : "off",
sg ? "on" : "off",
- tso ? "on" : "off");
+ tso ? "on" : "off",
+ ufo ? "on" : "off");
return 0;
}
@@ -1386,7 +1391,7 @@ static int do_scoalesce(int fd, struct ifreq *ifr)
static int do_goffload(int fd, struct ifreq *ifr)
{
struct ethtool_value eval;
- int err, allfail = 1, rx = 0, tx = 0, sg = 0, tso = 0;
+ int err, allfail = 1, rx = 0, tx = 0, sg = 0, tso = 0, ufo = 0;
fprintf(stdout, "Offload parameters for %s:\n", devname);
@@ -1430,12 +1435,22 @@ static int do_goffload(int fd, struct ifreq *ifr)
allfail = 0;
}
+ eval.cmd = ETHTOOL_GUFO;
+ ifr->ifr_data = (caddr_t)&eval;
+ err = ioctl(fd, SIOCETHTOOL, ifr);
+ if (err)
+ perror("Cannot get device udp large send offload settings");
+ else {
+ ufo = eval.data;
+ allfail = 0;
+ }
+
if (allfail) {
fprintf(stdout, "no offload info available\n");
return 83;
}
- return dump_offload(rx, tx, sg, tso);
+ return dump_offload(rx, tx, sg, tso, ufo);
}
static int do_soffload(int fd, struct ifreq *ifr)
@@ -1490,6 +1505,17 @@ static int do_soffload(int fd, struct ifreq *ifr)
return 88;
}
}
+ if (off_ufo_wanted >= 0) {
+ changed = 1;
+ eval.cmd = ETHTOOL_SUFO;
+ eval.data = (off_ufo_wanted == 1);
+ ifr->ifr_data = (caddr_t)&eval;
+ err = ioctl(fd, SIOCETHTOOL, ifr);
+ if (err) {
+ perror("Cannot set device udp large send offload settings");
+ return 89;
+ }
+ }
if (!changed) {
fprintf(stdout, "no offload settings changed\n");
}