From: Jon Mason <jdmason@us.ibm.com>
To: "Catalin(ux aka Dino) BOIE" <util@deuroconsult.ro>
Cc: netdev@oss.sgi.com, davem@davemloft.net
Subject: Re: [PATCH] [BRIDGE] Set features based on slave's ones (was Ethernet Bridging: Enable Hardware Checksumming)
Date: Thu, 19 May 2005 14:00:32 -0500 [thread overview]
Message-ID: <20050519190032.GA19620@us.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.62.0505192019090.8076@webhosting.rdsbv.ro>
I combined my previous patch with your patch, and came up with the
following. I have tested it on my system, and it works exactly the way
I wanted. What do you think?
Thanks,
Jon
Signed-off-by: Catalin(ux aka Dino) BOIE <catab at umbrella.ro>
Signed-off-by: Jon Mason <jdmason@us.ibm.com>
--- linux-2.6.11-xenU/net/bridge/br_private.h 2005-03-02 01:37:50.000000000 -0600
+++ linux-2.6.11-xen0/net/bridge/br_private.h 2005-05-19 08:12:23.000000000 -0500
@@ -27,6 +27,10 @@
#define BR_PORT_BITS 10
#define BR_MAX_PORTS (1<<BR_PORT_BITS)
+#define BR_FEAT_MASK (NETIF_F_HW_CSUM | NETIF_F_SG \
+ | NETIF_F_FRAGLIST | NETIF_F_IP_CSUM \
+ | NETIF_F_HIGHDMA | NETIF_F_TSO)
+
typedef struct bridge_id bridge_id;
typedef struct mac_addr mac_addr;
typedef __u16 port_id;
--- linux-2.6.11-xenU/net/bridge/br_device.c 2005-05-19 06:19:42.000000000 -0500
+++ linux-2.6.11-xen0/net/bridge/br_device.c 2005-05-19 08:11:19.000000000 -0500
@@ -107,4 +107,5 @@ void br_dev_setup(struct net_device *dev
dev->tx_queue_len = 0;
dev->set_mac_address = NULL;
dev->priv_flags = IFF_EBRIDGE;
+ dev->features = BR_FEAT_MASK;
}
--- linux-2.6.11-xenU/net/bridge/br_if.c 2005-05-19 08:43:03.000000000 -0500
+++ linux-2.6.11-xen0/net/bridge/br_if.c 2005-05-19 08:43:58.000000000 -0500
@@ -314,6 +314,27 @@ int br_min_mtu(const struct net_bridge *
return mtu;
}
+/*
+ * If slave device (@dev) doesn't support special features,
+ * turn them off globally.
+ */
+static inline void br_features_change(struct net_bridge *br, struct net_device *dev)
+{
+ br->dev->features &= dev->features | NETIF_F_HW_CSUM | NETIF_F_SG;
+}
+
+/*
+ * Recomputes features using slave's features
+ */
+static void br_features_recompute(struct net_bridge *br)
+{
+ struct net_bridge_port *p;
+
+ br->dev->features = BR_FEAT_MASK;
+ list_for_each_entry(p, &br->port_list, list)
+ br_features_change(br, p->dev);
+}
+
/* called with RTNL */
int br_add_if(struct net_bridge *br, struct net_device *dev)
{
@@ -332,6 +353,8 @@ int br_add_if(struct net_bridge *br, str
if (IS_ERR(p = new_nbp(br, dev, br_initial_port_cost(dev))))
return PTR_ERR(p);
+ br_features_change(br, dev);
+
if ((err = br_fdb_insert(br, p, dev->dev_addr, 1)))
destroy_nbp(p);
@@ -368,6 +391,7 @@ int br_del_if(struct net_bridge *br, str
spin_lock_bh(&br->lock);
br_stp_recalculate_bridge_id(br);
+ br_features_recompute(br);
spin_unlock_bh(&br->lock);
return 0;
next prev parent reply other threads:[~2005-05-19 19:00 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-19 15:28 [PATCH] [BRIDGE] Set features based on slave's ones (was Ethernet Bridging: Enable Hardware Checksumming) Catalin(ux aka Dino) BOIE
2005-05-19 15:59 ` Nivedita Singhvi
2005-05-19 18:52 ` [PATCH] [BRIDGE] Set features based on slave's ones David S. Miller
2005-05-19 16:06 ` [PATCH] [BRIDGE] Set features based on slave's ones (was Ethernet Bridging: Enable Hardware Checksumming) Jon Mason
2005-05-19 17:22 ` Catalin(ux aka Dino) BOIE
2005-05-19 17:47 ` Jon Mason
2005-05-19 18:58 ` [PATCH] [BRIDGE] Set features based on slave's ones David S. Miller
2005-05-19 19:07 ` Jon Mason
2005-05-19 19:00 ` Jon Mason [this message]
2005-05-19 19:21 ` David S. Miller
2005-05-19 20:20 ` Jon Mason
2005-05-19 18:53 ` David S. Miller
2005-05-19 20:39 ` [PATCH] [BRIDGE] Set features based on slave's ones (was Ethernet Bridging: Enable Hardware Checksumming) Stephen Hemminger
2005-05-19 21:20 ` Stephen Hemminger
2005-05-19 21:40 ` Jon Mason
2005-05-20 6:07 ` Catalin(ux aka Dino) BOIE
2005-05-20 18:54 ` Jon Mason
2005-05-23 9:39 ` Catalin(ux aka Dino) BOIE
2005-05-23 9:40 ` Catalin(ux aka Dino) BOIE
2005-05-23 19:14 ` Jon Mason
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=20050519190032.GA19620@us.ibm.com \
--to=jdmason@us.ibm.com \
--cc=davem@davemloft.net \
--cc=netdev@oss.sgi.com \
--cc=util@deuroconsult.ro \
/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).