netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Lemoine <eric.lemoine@gmail.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: hadi@cyberus.ca, netdev@oss.sgi.com
Subject: Re: [PATCH] Allow setting dev->weight using ip(8)
Date: Tue, 31 Aug 2004 11:58:10 +0200	[thread overview]
Message-ID: <5cac192f04083102586e322b1a@mail.gmail.com> (raw)
In-Reply-To: <20040830165851.64cf8822.davem@davemloft.net>

> Please make a patch against Linus's current tree.
> I put the rest of your rtnetlink device interface
> changes in, and your patches here duplicate all of
> that.

See below.
 
> I agree also with Jamel wrt. ioctl(), let's not go
> there if possible. :-)

Ok. 

I did also go the ioctl() way because that's what iproute2-2.6.8 uses.

[Dave: sorry for the sending you this twice]

--
Eric

===== include/linux/rtnetlink.h 1.41 vs edited =====
--- 1.41/include/linux/rtnetlink.h      Wed Aug 25 02:20:27 2004
+++ edited/include/linux/rtnetlink.h    Tue Aug 31 11:22:55 2004
@@ -565,6 +565,8 @@
 #define IFLA_TXQLEN IFLA_TXQLEN
        IFLA_MAP,
 #define IFLA_MAP IFLA_MAP
+       IFLA_WEIGHT,
+#define IFLA_WEIGHT IFLA_WEIGHT
        __IFLA_MAX
 };

===== net/core/rtnetlink.c 1.23 vs edited =====
--- 1.23/net/core/rtnetlink.c   Wed Aug 25 02:20:27 2004
+++ edited/net/core/rtnetlink.c Tue Aug 31 11:27:15 2004
@@ -177,6 +177,11 @@
        }

        if (1) {
+               u32 weight = dev->weight;
+               RTA_PUT(skb, IFLA_WEIGHT, sizeof(weight), &weight);
+       }
+
+       if (1) {
                struct ifmap map = {
                        .mem_start   = dev->mem_start,
                        .mem_end     = dev->mem_end,
@@ -331,6 +336,13 @@
                        goto out;

                dev->tx_queue_len = *((u32 *) RTA_DATA(ida[IFLA_TXQLEN - 1]));
+       }
+
+       if (ida[IFLA_WEIGHT - 1]) {
+               if (ida[IFLA_WEIGHT - 1]->rta_len != RTA_LENGTH(sizeof(u32)))
+                       goto out;
+
+               dev->weight = *((u32 *) RTA_DATA(ida[IFLA_WEIGHT - 1]));
        }

        err = 0;

  reply	other threads:[~2004-08-31  9:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-30 10:56 [PATCH] Allow setting dev->weight using ip(8) Eric Lemoine
2004-08-30 12:27 ` jamal
2004-08-30 12:42   ` jamal
2004-08-30 14:35     ` Eric Lemoine
2004-08-30 23:58       ` David S. Miller
2004-08-31  9:58         ` Eric Lemoine [this message]
2004-08-30 14:33   ` Eric Lemoine
2004-09-08 13:45     ` Thomas Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5cac192f04083102586e322b1a@mail.gmail.com \
    --to=eric.lemoine@gmail.com \
    --cc=davem@davemloft.net \
    --cc=hadi@cyberus.ca \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).