netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ethtool : Allow ethtool to set interface in loopback mode.
@ 2010-12-02  0:57 Mahesh Bandewar
  2010-12-02 14:21 ` Ben Hutchings
  0 siblings, 1 reply; 7+ messages in thread
From: Mahesh Bandewar @ 2010-12-02  0:57 UTC (permalink / raw)
  To: Ben Hutchings, linux-netdev; +Cc: Tom Herbert, David Miller

This patch adds -L command-line option to enable/disable loopback mode
and -l option to display current loopback mode on a give interface.


Signed-off-by Mahesh Bandewar <maheshb@google.com>

 ethtool-copy.h |    2 +
 ethtool.c      |   64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 0 deletions(-)

---

diff --git a/ethtool-copy.h b/ethtool-copy.h
index 75c3ae7..297a042 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -584,6 +584,8 @@ struct ethtool_flash {
 #define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */
 #define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */
 #define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */
+#define ETHTOOL_SLOOPBACK  0x0000003a /* Enable / Disable loopback. */
+#define ETHTOOL_GLOOPBACK  0x0000003b /* Get loopback status. */

 /* compatibility with older code */
 #define SPARC_ETH_GSET     ETHTOOL_GSET
diff --git a/ethtool.c b/ethtool.c
index 239912b..d3f7ffc 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -114,6 +114,8 @@ static int do_srxntuple(int fd, struct ifreq *ifr);
 static int do_grxntuple(int fd, struct ifreq *ifr);
 static int do_flash(int fd, struct ifreq *ifr);
 static int do_permaddr(int fd, struct ifreq *ifr);
+static int do_sloopback(int fd, struct ifreq *ifr);
+static int do_gloopback(int fd, struct ifreq *ifr);

 static int send_ioctl(int fd, struct ifreq *ifr);

@@ -145,6 +147,8 @@ static enum {
    MODE_GNTUPLE,
    MODE_FLASHDEV,
    MODE_PERMADDR,
+   MODE_SLOOPBACK,
+   MODE_GLOOPBACK,
 } mode = MODE_GSET;

 static struct option {
@@ -266,6 +270,9 @@ static struct option {
        "Get Rx ntuple filters and actions\n" },
     { "-P", "--show-permaddr", MODE_PERMADDR,
        "Show permanent hardware address" },
+    { "-L", "--config-loopback", MODE_SLOOPBACK, "{En|Dis}able device
loopback",
+       "       [ enable | disable ]\n"},
+    { "-l", "--show-loopback", MODE_GLOOPBACK, "Show device loopback mode",},
     { "-h", "--help", MODE_HELP, "Show this help" },
     {}
 };
@@ -407,6 +414,8 @@ static char *flash_file = NULL;
 static int flash = -1;
 static int flash_region = -1;

+static int loopback_enable = 0;
+
 static int msglvl_changed;
 static u32 msglvl_wanted = 0;
 static u32 msglvl_mask = 0;
@@ -841,6 +850,8 @@ static void parse_cmdline(int argc, char **argp)
                (mode == MODE_GNTUPLE) ||
                (mode == MODE_PHYS_ID) ||
                (mode == MODE_FLASHDEV) ||
+               (mode == MODE_SLOOPBACK) ||
+               (mode == MODE_GLOOPBACK) ||
                (mode == MODE_PERMADDR)) {
                devname = argp[i];
                break;
@@ -1009,6 +1020,16 @@ static void parse_cmdline(int argc, char **argp)
                }
                break;
            }
+           if (mode == MODE_SLOOPBACK) {
+               if (!strcmp(argp[i], "enable"))
+                   loopback_enable = 1;
+               else if (!strcmp(argp[i], "disable"))
+                   loopback_enable = 0;
+               else
+                   show_usage(1);
+               i = argc;
+               break;
+           }
            if (mode != MODE_SSET)
                show_usage(1);
            if (!strcmp(argp[i], "speed")) {
@@ -2019,6 +2040,10 @@ static int doit(void)
        return do_flash(fd, &ifr);
    } else if (mode == MODE_PERMADDR) {
        return do_permaddr(fd, &ifr);
+   } else if (mode == MODE_SLOOPBACK) {
+       return do_sloopback(fd, &ifr);
+   } else if (mode == MODE_GLOOPBACK) {
+       return do_gloopback(fd, &ifr);
    }

    return 69;
@@ -3201,6 +3226,45 @@ static int do_grxntuple(int fd, struct ifreq *ifr)
    return 0;
 }

+static int do_sloopback(int fd, struct ifreq *ifr)
+{
+   int err;
+   struct ethtool_value edata;
+
+   edata.cmd = ETHTOOL_SLOOPBACK;
+   edata.data = loopback_enable;
+   ifr->ifr_data = (caddr_t)&edata;
+
+   err = send_ioctl(fd, ifr);
+   if (err < 0) {
+       char error[64];
+       sprintf(error, "Cannot %s loopback mode",
+               loopback_enable ? "enable" : "disable");
+       perror(error);
+       return 102;
+   }
+
+   return err;
+}
+
+static int do_gloopback(int fd, struct ifreq *ifr)
+{
+   int err;
+   struct ethtool_value edata;
+
+   edata.cmd = ETHTOOL_GLOOPBACK;
+   ifr->ifr_data = (caddr_t)&edata;
+
+   err = send_ioctl(fd, ifr);
+   if (err < 0) {
+       perror("Cannot get loopback status");
+       return 103;
+   }
+   printf("Loopback is %s\n", edata.data ? "enabled" : "disabled");
+
+   return err;
+}
+
 static int send_ioctl(int fd, struct ifreq *ifr)
 {
    return ioctl(fd, SIOCETHTOOL, ifr);

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ethtool : Allow ethtool to set interface in loopback mode.
  2010-12-02  0:57 [PATCH] ethtool : Allow ethtool to set interface in loopback mode Mahesh Bandewar
@ 2010-12-02 14:21 ` Ben Hutchings
  2010-12-02 22:35   ` [PATCH v2] " Mahesh Bandewar
  0 siblings, 1 reply; 7+ messages in thread
From: Ben Hutchings @ 2010-12-02 14:21 UTC (permalink / raw)
  To: Mahesh Bandewar; +Cc: linux-netdev, Tom Herbert, David Miller

This patch seems to have been tab-damaged by your mailer - tabs have
been converted to spaces (and the wrong number of spaces).

On Wed, 2010-12-01 at 16:57 -0800, Mahesh Bandewar wrote:
> This patch adds -L command-line option to enable/disable loopback mode
> and -l option to display current loopback mode on a give interface.
>
> Signed-off-by Mahesh Bandewar <maheshb@google.com>
> 
>  ethtool-copy.h |    2 +
>  ethtool.c      |   64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 66 insertions(+), 0 deletions(-)
> 
> ---
> 
> diff --git a/ethtool-copy.h b/ethtool-copy.h
> index 75c3ae7..297a042 100644
> --- a/ethtool-copy.h
> +++ b/ethtool-copy.h
> @@ -584,6 +584,8 @@ struct ethtool_flash {
>  #define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */
>  #define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */
>  #define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */
> +#define ETHTOOL_SLOOPBACK  0x0000003a /* Enable / Disable loopback. */
> +#define ETHTOOL_GLOOPBACK  0x0000003b /* Get loopback status. */
> 
>  /* compatibility with older code */
>  #define SPARC_ETH_GSET     ETHTOOL_GSET
> diff --git a/ethtool.c b/ethtool.c
> index 239912b..d3f7ffc 100644
> --- a/ethtool.c
> +++ b/ethtool.c
> @@ -114,6 +114,8 @@ static int do_srxntuple(int fd, struct ifreq *ifr);
>  static int do_grxntuple(int fd, struct ifreq *ifr);
>  static int do_flash(int fd, struct ifreq *ifr);
>  static int do_permaddr(int fd, struct ifreq *ifr);
> +static int do_sloopback(int fd, struct ifreq *ifr);
> +static int do_gloopback(int fd, struct ifreq *ifr);
> 
>  static int send_ioctl(int fd, struct ifreq *ifr);
> 
> @@ -145,6 +147,8 @@ static enum {
>     MODE_GNTUPLE,
>     MODE_FLASHDEV,
>     MODE_PERMADDR,
> +   MODE_SLOOPBACK,
> +   MODE_GLOOPBACK,
>  } mode = MODE_GSET;
> 
>  static struct option {
> @@ -266,6 +270,9 @@ static struct option {
>         "Get Rx ntuple filters and actions\n" },
>      { "-P", "--show-permaddr", MODE_PERMADDR,
>         "Show permanent hardware address" },
> +    { "-L", "--config-loopback", MODE_SLOOPBACK, "{En|Dis}able device
> loopback",
> +       "       [ enable | disable ]\n"},

The argument should be 'on' or 'off', consistent with other flag
parameters.

> +    { "-l", "--show-loopback", MODE_GLOOPBACK, "Show device loopback mode",},

These new options need to be documented in the manual page too.

>      { "-h", "--help", MODE_HELP, "Show this help" },
>      {}
>  };
> @@ -407,6 +414,8 @@ static char *flash_file = NULL;
>  static int flash = -1;
>  static int flash_region = -1;
> 
> +static int loopback_enable = 0;
> +
>  static int msglvl_changed;
>  static u32 msglvl_wanted = 0;
>  static u32 msglvl_mask = 0;
> @@ -841,6 +850,8 @@ static void parse_cmdline(int argc, char **argp)
>                 (mode == MODE_GNTUPLE) ||
>                 (mode == MODE_PHYS_ID) ||
>                 (mode == MODE_FLASHDEV) ||
> +               (mode == MODE_SLOOPBACK) ||
> +               (mode == MODE_GLOOPBACK) ||
>                 (mode == MODE_PERMADDR)) {
>                 devname = argp[i];
>                 break;
> @@ -1009,6 +1020,16 @@ static void parse_cmdline(int argc, char **argp)
>                 }
>                 break;
>             }
> +           if (mode == MODE_SLOOPBACK) {
> +               if (!strcmp(argp[i], "enable"))
> +                   loopback_enable = 1;
> +               else if (!strcmp(argp[i], "disable"))
> +                   loopback_enable = 0;
> +               else
> +                   show_usage(1);
> +               i = argc;
> +               break;
> +           }
>             if (mode != MODE_SSET)
>                 show_usage(1);
>             if (!strcmp(argp[i], "speed")) {
> @@ -2019,6 +2040,10 @@ static int doit(void)
>         return do_flash(fd, &ifr);
>     } else if (mode == MODE_PERMADDR) {
>         return do_permaddr(fd, &ifr);
> +   } else if (mode == MODE_SLOOPBACK) {
> +       return do_sloopback(fd, &ifr);
> +   } else if (mode == MODE_GLOOPBACK) {
> +       return do_gloopback(fd, &ifr);
>     }
> 
>     return 69;
> @@ -3201,6 +3226,45 @@ static int do_grxntuple(int fd, struct ifreq *ifr)
>     return 0;
>  }
> 
> +static int do_sloopback(int fd, struct ifreq *ifr)
> +{
> +   int err;
> +   struct ethtool_value edata;
> +
> +   edata.cmd = ETHTOOL_SLOOPBACK;
> +   edata.data = loopback_enable;
> +   ifr->ifr_data = (caddr_t)&edata;
> +
> +   err = send_ioctl(fd, ifr);
> +   if (err < 0) {
> +       char error[64];
> +       sprintf(error, "Cannot %s loopback mode",
> +               loopback_enable ? "enable" : "disable");
> +       perror(error);
> +       return 102;

This exit code is already used.

But I don't think it really makes sense to assign unique exit codes to
every failure point, so you can just return 1.

> +   }
> +
> +   return err;
> +}
> +
> +static int do_gloopback(int fd, struct ifreq *ifr)
> +{
> +   int err;
> +   struct ethtool_value edata;
> +
> +   edata.cmd = ETHTOOL_GLOOPBACK;
> +   ifr->ifr_data = (caddr_t)&edata;
> +
> +   err = send_ioctl(fd, ifr);
> +   if (err < 0) {
> +       perror("Cannot get loopback status");
> +       return 103;

Same here.

Ben.

> +   }
> +   printf("Loopback is %s\n", edata.data ? "enabled" : "disabled");
> +
> +   return err;
> +}
> +
>  static int send_ioctl(int fd, struct ifreq *ifr)
>  {
>     return ioctl(fd, SIOCETHTOOL, ifr);

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] ethtool : Allow ethtool to set interface in loopback mode.
  2010-12-02 14:21 ` Ben Hutchings
@ 2010-12-02 22:35   ` Mahesh Bandewar
  2010-12-03 16:03     ` David Lamparter
  0 siblings, 1 reply; 7+ messages in thread
From: Mahesh Bandewar @ 2010-12-02 22:35 UTC (permalink / raw)
  To: Ben Hutchings, linux-netdev; +Cc: Tom Herbert, David Miller

This patch adds -L command-line option to switch loopback mode on/off
and -l option to display current loopback mode on a specified interface.

Signed-off-by Mahesh Bandewar <maheshb@google.com>

 Change-log
   v2:
      - Changed argument from enable/disable to on/off
      - Added these new options into the man page.

 ethtool-copy.h |    2 +
 ethtool.8      |   21 ++++++++++++++++++
 ethtool.c      |   64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 87 insertions(+), 0 deletions(-)

---

diff --git a/ethtool-copy.h b/ethtool-copy.h
index 75c3ae7..297a042 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -584,6 +584,8 @@ struct ethtool_flash {
 #define ETHTOOL_GSSET_INFO     0x00000037 /* Get string set info */
 #define ETHTOOL_GRXFHINDIR     0x00000038 /* Get RX flow hash indir'n table */
 #define ETHTOOL_SRXFHINDIR     0x00000039 /* Set RX flow hash indir'n table */
+#define ETHTOOL_SLOOPBACK      0x0000003a /* Enable / Disable loopback. */
+#define ETHTOOL_GLOOPBACK      0x0000003b /* Get loopback status. */

 /* compatibility with older code */
 #define SPARC_ETH_GSET         ETHTOOL_GSET
diff --git a/ethtool.8 b/ethtool.8
index 1760924..bda1fe6 100644
--- a/ethtool.8
+++ b/ethtool.8
@@ -174,6 +174,13 @@ ethtool \- Display or change ethernet card settings
 .B2 txvlan on off
 .B2 rxhash on off

+.B ethtool \-l|\-\-show\-loopback
+.I ethX
+
+.B ethtool \-L|\-\-config\-loopback
+.I ethX
+.B1 on off
+
 .B ethtool \-p|\-\-identify
 .I ethX
 .RI [ N ]
@@ -406,6 +413,20 @@ Specifies whether TX VLAN acceleration should be enabled
 .A2 rxhash on off
 Specifies whether receive hashing offload should be enabled
 .TP
+.B \-l \-\-show\-loopback
+Queries the specified ethernet device for loopback mode settings.
+.TP
+.B \-L \-\-config\-loopback
+Configures loopback mode on the specified ethernet device. Possible values
+are:
+.TP
+.A1 on off
+Switches loopback mode
+.B on
+or
+.B off
+for the speficied ethernet device.
+.TP
 .B \-p \-\-identify
 Initiates adapter-specific action intended to enable an operator to
 easily identify the adapter by sight.  Typically this involves
diff --git a/ethtool.c b/ethtool.c
index 239912b..b3bf4dd 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -114,6 +114,8 @@ static int do_srxntuple(int fd, struct ifreq *ifr);
 static int do_grxntuple(int fd, struct ifreq *ifr);
 static int do_flash(int fd, struct ifreq *ifr);
 static int do_permaddr(int fd, struct ifreq *ifr);
+static int do_sloopback(int fd, struct ifreq *ifr);
+static int do_gloopback(int fd, struct ifreq *ifr);

 static int send_ioctl(int fd, struct ifreq *ifr);

@@ -145,6 +147,8 @@ static enum {
        MODE_GNTUPLE,
        MODE_FLASHDEV,
        MODE_PERMADDR,
+       MODE_SLOOPBACK,
+       MODE_GLOOPBACK,
 } mode = MODE_GSET;

 static struct option {
@@ -266,6 +270,9 @@ static struct option {
                "Get Rx ntuple filters and actions\n" },
     { "-P", "--show-permaddr", MODE_PERMADDR,
                "Show permanent hardware address" },
+    { "-L", "--config-loopback", MODE_SLOOPBACK, "{En|Dis}able device loopback"
+               "               [ on|off ]\n"},
+    { "-l", "--show-loopback", MODE_GLOOPBACK, "Show device loopback mode",},
     { "-h", "--help", MODE_HELP, "Show this help" },
     {}
 };
@@ -407,6 +414,8 @@ static char *flash_file = NULL;
 static int flash = -1;
 static int flash_region = -1;

+static int loopback_enable = 0;
+
 static int msglvl_changed;
 static u32 msglvl_wanted = 0;
 static u32 msglvl_mask = 0;
@@ -841,6 +850,8 @@ static void parse_cmdline(int argc, char **argp)
                            (mode == MODE_GNTUPLE) ||
                            (mode == MODE_PHYS_ID) ||
                            (mode == MODE_FLASHDEV) ||
+                           (mode == MODE_SLOOPBACK) ||
+                           (mode == MODE_GLOOPBACK) ||
                            (mode == MODE_PERMADDR)) {
                                devname = argp[i];
                                break;
@@ -1009,6 +1020,16 @@ static void parse_cmdline(int argc, char **argp)
                                }
                                break;
                        }
+                       if (mode == MODE_SLOOPBACK) {
+                               if (!strcmp(argp[i], "on"))
+                                       loopback_enable = 1;
+                               else if (!strcmp(argp[i], "off"))
+                                       loopback_enable = 0;
+                               else
+                                       show_usage(1);
+                               i = argc;
+                               break;
+                       }
                        if (mode != MODE_SSET)
                                show_usage(1);
                        if (!strcmp(argp[i], "speed")) {
@@ -2019,6 +2040,10 @@ static int doit(void)
                return do_flash(fd, &ifr);
        } else if (mode == MODE_PERMADDR) {
                return do_permaddr(fd, &ifr);
+       } else if (mode == MODE_SLOOPBACK) {
+               return do_sloopback(fd, &ifr);
+       } else if (mode == MODE_GLOOPBACK) {
+               return do_gloopback(fd, &ifr);
        }

        return 69;
@@ -3201,6 +3226,45 @@ static int do_grxntuple(int fd, struct ifreq *ifr)
        return 0;
 }

+static int do_sloopback(int fd, struct ifreq *ifr)
+{
+       int err;
+       struct ethtool_value edata;
+
+       edata.cmd = ETHTOOL_SLOOPBACK;
+       edata.data = loopback_enable;
+       ifr->ifr_data = (caddr_t)&edata;
+
+       err = send_ioctl(fd, ifr);
+       if (err < 0) {
+               char error[64];
+               sprintf(error, "Cannot turn %s loopback mode",
+                               loopback_enable ? "on" : "off");
+               perror(error);
+               return 1;
+       }
+
+       return err;
+}
+
+static int do_gloopback(int fd, struct ifreq *ifr)
+{
+       int err;
+       struct ethtool_value edata;
+
+       edata.cmd = ETHTOOL_GLOOPBACK;
+       ifr->ifr_data = (caddr_t)&edata;
+
+       err = send_ioctl(fd, ifr);
+       if (err < 0) {
+               perror("Cannot get loopback status");
+               return 1;
+       }
+       printf("Loopback is turned %s\n", edata.data ? "on" : "off");
+
+       return err;
+}
+
 static int send_ioctl(int fd, struct ifreq *ifr)
 {
        return ioctl(fd, SIOCETHTOOL, ifr);

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] ethtool : Allow ethtool to set interface in loopback mode.
  2010-12-02 22:35   ` [PATCH v2] " Mahesh Bandewar
@ 2010-12-03 16:03     ` David Lamparter
  2010-12-03 16:33       ` Ben Hutchings
  0 siblings, 1 reply; 7+ messages in thread
From: David Lamparter @ 2010-12-03 16:03 UTC (permalink / raw)
  To: Mahesh Bandewar; +Cc: Ben Hutchings, linux-netdev, Tom Herbert, David Miller

On Thu, Dec 02, 2010 at 02:35:51PM -0800, Mahesh Bandewar wrote:
> This patch adds -L command-line option to switch loopback mode on/off
> and -l option to display current loopback mode on a specified interface.
[...]
> +.A1 on off
> +Switches loopback mode
> +.B on
> +or
> +.B off

What about devices that support different kinds of loopback, like MAC
loopback & PHY loopback? (No idea if we have kernel support for this
either...)


-David


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] ethtool : Allow ethtool to set interface in loopback mode.
  2010-12-03 16:03     ` David Lamparter
@ 2010-12-03 16:33       ` Ben Hutchings
  2010-12-03 16:48         ` David Lamparter
  0 siblings, 1 reply; 7+ messages in thread
From: Ben Hutchings @ 2010-12-03 16:33 UTC (permalink / raw)
  To: David Lamparter; +Cc: Mahesh Bandewar, linux-netdev, Tom Herbert, David Miller

On Fri, 2010-12-03 at 17:03 +0100, David Lamparter wrote:
> On Thu, Dec 02, 2010 at 02:35:51PM -0800, Mahesh Bandewar wrote:
> > This patch adds -L command-line option to switch loopback mode on/off
> > and -l option to display current loopback mode on a specified interface.
> [...]
> > +.A1 on off
> > +Switches loopback mode
> > +.B on
> > +or
> > +.B off
> 
> What about devices that support different kinds of loopback, like MAC
> loopback & PHY loopback? (No idea if we have kernel support for this
> either...)

That distinction is useful for diagnostic purposes, but drivers can
already cover those different loopback modes in self-test.  The
motivation for this feature is testing data path behaviour, and Mahesh
has specified that loopback should be enabled as near as possible to the
host.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] ethtool : Allow ethtool to set interface in loopback mode.
  2010-12-03 16:33       ` Ben Hutchings
@ 2010-12-03 16:48         ` David Lamparter
  2010-12-05  1:33           ` Bill Fink
  0 siblings, 1 reply; 7+ messages in thread
From: David Lamparter @ 2010-12-03 16:48 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: David Lamparter, Mahesh Bandewar, linux-netdev, Tom Herbert,
	David Miller

On Fri, Dec 03, 2010 at 04:33:34PM +0000, Ben Hutchings wrote:
> On Fri, 2010-12-03 at 17:03 +0100, David Lamparter wrote:
> > On Thu, Dec 02, 2010 at 02:35:51PM -0800, Mahesh Bandewar wrote:
> > > This patch adds -L command-line option to switch loopback mode on/off
> > > and -l option to display current loopback mode on a specified interface.
> > [...]
> > > +.A1 on off
> > > +Switches loopback mode
> > > +.B on
> > > +or
> > > +.B off
> > 
> > What about devices that support different kinds of loopback, like MAC
> > loopback & PHY loopback? (No idea if we have kernel support for this
> > either...)
> 
> That distinction is useful for diagnostic purposes, but drivers can
> already cover those different loopback modes in self-test.  The
> motivation for this feature is testing data path behaviour, and Mahesh
> has specified that loopback should be enabled as near as possible to the
> host.

Ah, good enough. Thanks.

-David


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] ethtool : Allow ethtool to set interface in loopback mode.
  2010-12-03 16:48         ` David Lamparter
@ 2010-12-05  1:33           ` Bill Fink
  0 siblings, 0 replies; 7+ messages in thread
From: Bill Fink @ 2010-12-05  1:33 UTC (permalink / raw)
  To: David Lamparter
  Cc: Ben Hutchings, Mahesh Bandewar, linux-netdev, Tom Herbert,
	David Miller

On Fri, 3 Dec 2010, David Lamparter wrote:

> On Fri, Dec 03, 2010 at 04:33:34PM +0000, Ben Hutchings wrote:
> > On Fri, 2010-12-03 at 17:03 +0100, David Lamparter wrote:
> > > On Thu, Dec 02, 2010 at 02:35:51PM -0800, Mahesh Bandewar wrote:
> > > > This patch adds -L command-line option to switch loopback mode on/off
> > > > and -l option to display current loopback mode on a specified interface.
> > > [...]
> > > > +.A1 on off
> > > > +Switches loopback mode
> > > > +.B on
> > > > +or
> > > > +.B off
> > > 
> > > What about devices that support different kinds of loopback, like MAC
> > > loopback & PHY loopback? (No idea if we have kernel support for this
> > > either...)
> > 
> > That distinction is useful for diagnostic purposes, but drivers can
> > already cover those different loopback modes in self-test.  The
> > motivation for this feature is testing data path behaviour, and Mahesh
> > has specified that loopback should be enabled as near as possible to the
> > host.
> 
> Ah, good enough. Thanks.

Perhaps in the future it could be extended, if desired,
to something like:

	loopback=0	disabled
	loopback=1	driver loopback nearest host
	loopback=2	driver loopback nearest network

Both types of loopback could be useful for different purposes.

					-Bill

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-12-05  1:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-02  0:57 [PATCH] ethtool : Allow ethtool to set interface in loopback mode Mahesh Bandewar
2010-12-02 14:21 ` Ben Hutchings
2010-12-02 22:35   ` [PATCH v2] " Mahesh Bandewar
2010-12-03 16:03     ` David Lamparter
2010-12-03 16:33       ` Ben Hutchings
2010-12-03 16:48         ` David Lamparter
2010-12-05  1:33           ` Bill Fink

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).