Commit 75563be1 authored by David S. Miller's avatar David S. Miller

Merge nuts.ninka.net:/disk1/davem/BK/network-2.6

into nuts.ninka.net:/disk1/davem/BK/net-2.6
parents 0010bc50 05c79878
...@@ -1697,7 +1697,7 @@ config NET_POCKET ...@@ -1697,7 +1697,7 @@ config NET_POCKET
<file:Documentation/Changes>) and you can say N here. <file:Documentation/Changes>) and you can say N here.
Laptop users should read the Linux Laptop home page at Laptop users should read the Linux Laptop home page at
<http://www.cs.utexas.edu/users/kharker/linux-laptop/>. <http://www.linux-on-laptops.com/>.
Note that the answer to this question doesn't directly affect the Note that the answer to this question doesn't directly affect the
kernel: saying N will just cause the configurator to skip all kernel: saying N will just cause the configurator to skip all
......
...@@ -47,9 +47,7 @@ ...@@ -47,9 +47,7 @@
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/err.h> #include <linux/err.h>
#ifdef CONFIG_SYSCTL
#include <linux/sysctl.h> #include <linux/sysctl.h>
#endif
#define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_DELAY|NUD_PROBE) #define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_DELAY|NUD_PROBE)
#define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY) #define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY)
......
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
#define cycles() ((u32)get_cycles()) #define cycles() ((u32)get_cycles())
#define VERSION "pktgen version 1.3" #define VERSION "pktgen version 1.31"
static char version[] __initdata = static char version[] __initdata =
"pktgen.c: v1.3: Packet Generator for packet performance testing.\n"; "pktgen.c: v1.3: Packet Generator for packet performance testing.\n";
...@@ -720,8 +720,18 @@ static void inject(struct pktgen_info* info) ...@@ -720,8 +720,18 @@ static void inject(struct pktgen_info* info)
{ {
char *p = info->result; char *p = info->result;
__u64 pps = (__u32)(info->sofar * 1000) / ((__u32)(total) / 1000); __u64 bps, pps = 0;
__u64 bps = pps * 8 * (info->pkt_size + 4); /* take 32bit ethernet CRC into account */
if (total > 1000)
pps = (__u32)(info->sofar * 1000) / ((__u32)(total) / 1000);
else if(total > 100)
pps = (__u32)(info->sofar * 10000) / ((__u32)(total) / 100);
else if(total > 10)
pps = (__u32)(info->sofar * 100000) / ((__u32)(total) / 10);
else if(total > 1)
pps = (__u32)(info->sofar * 1000000) / (__u32)total;
bps = pps * 8 * (info->pkt_size + 4); /* take 32bit ethernet CRC into account */
p += sprintf(p, "OK: %llu(c%llu+d%llu) usec, %llu (%dbyte,%dfrags) %llupps %lluMb/sec (%llubps) errors: %llu", p += sprintf(p, "OK: %llu(c%llu+d%llu) usec, %llu (%dbyte,%dfrags) %llupps %lluMb/sec (%llubps) errors: %llu",
(unsigned long long) total, (unsigned long long) total,
(unsigned long long) (total - idle), (unsigned long long) (total - idle),
......
...@@ -81,7 +81,8 @@ proc_dodebug(ctl_table *table, int write, struct file *file, ...@@ -81,7 +81,8 @@ proc_dodebug(ctl_table *table, int write, struct file *file,
if (left > sizeof(tmpbuf) - 1) if (left > sizeof(tmpbuf) - 1)
return -EINVAL; return -EINVAL;
copy_from_user(tmpbuf, p, left); if (copy_from_user(tmpbuf, p, left))
return -EFAULT;
tmpbuf[left] = '\0'; tmpbuf[left] = '\0';
for (p = tmpbuf, value = 0; '0' <= *p && *p <= '9'; p++, left--) for (p = tmpbuf, value = 0; '0' <= *p && *p <= '9'; p++, left--)
...@@ -101,9 +102,11 @@ proc_dodebug(ctl_table *table, int write, struct file *file, ...@@ -101,9 +102,11 @@ proc_dodebug(ctl_table *table, int write, struct file *file,
len = sprintf(tmpbuf, "%d", *(unsigned int *) table->data); len = sprintf(tmpbuf, "%d", *(unsigned int *) table->data);
if (len > left) if (len > left)
len = left; len = left;
__copy_to_user(buffer, tmpbuf, len); if (__copy_to_user(buffer, tmpbuf, len))
return -EFAULT;
if ((left -= len) > 0) { if ((left -= len) > 0) {
put_user('\n', (char *)buffer + len); if (put_user('\n', (char *)buffer + len))
return -EFAULT;
left--; left--;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment