From: Joe Perches <joe@perches.com>
To: Arvid Brodin <Arvid.Brodin@xdin.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"shemminger@vyatta.com" <shemminger@vyatta.com>,
"jboticario@gmail.com" <jboticario@gmail.com>,
"balferreira@googlemail.com" <balferreira@googlemail.com>
Subject: Re: [RFC v4 1/1] net/hsr: Support for the HSR protocol (IEC:2010 / HSR v0)
Date: Fri, 12 Oct 2012 14:39:35 -0700 [thread overview]
Message-ID: <1350077975.26909.17.camel@joe-AO722> (raw)
In-Reply-To: <50784F2D.1060200@xdin.com>
On Fri, 2012-10-12 at 17:11 +0000, Arvid Brodin wrote:
> This would add support for the High-availability Seamless Redundancy network
> protocol, version 0 (2010).
>
> This RFC is NOT meant for mainline inclusion at the moment since we're trying
> to figure out how to handle a probable incompatibility with the newer
> HSR v1 (2012) standard.
just trivial comments, ignore as you choose.
> diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
[]
> +void hsr_set_operstate(struct net_device *hsr_dev, struct net_device *slave1,
> + struct net_device *slave2)
> +{
> + if (!is_admin_up(hsr_dev)) {
> + __hsr_set_operstate(hsr_dev, IF_OPER_DOWN);
> + return;
> + }
> +
> + if (is_operstate_up(slave1) || is_operstate_up(slave2))
> + __hsr_set_operstate(hsr_dev, IF_OPER_UP);
> + else
> + __hsr_set_operstate(hsr_dev, IF_OPER_LOWERLAYERDOWN);
> +}
sometimes it's better to have a single call like
{
int type;
if (!is_admin_up(hsr_dev))
type = IF_OPER_DOWN;
else if (is_operstate_up(slave1) || is_operstate_up(slave2))
type = IF_OPER_UP;
else
type = IF_OPER_LOWERLAYERDOWN;
__hsr_set_operstate(hsr_dev, type);
}
[]
> +static int hsr_dev_xmit(struct sk_buff *skb, struct net_device *dev)
> +{
> + struct hsr_priv *hsr_priv;
> + struct hsr_ethhdr *hsr_ethhdr;
> + struct sk_buff *skb2;
> + int res1, res2;
> +
> + hsr_priv = netdev_priv(dev);
> + hsr_ethhdr = (struct hsr_ethhdr *) skb->data;
> +
> + if ((ntohs(skb->protocol) != ETH_P_HSR) ||
> + (ntohs(hsr_ethhdr->ethhdr.h_proto) != ETH_P_HSR)) {
These ntohs calls are done at runtime.
The conversion could be done at compile time instead using
if (skb->protocol != ntohs(ETH_P_HSR) ||
hsr_ethhdr->ethhdr.h_proto != ntohs(ETH_P_HSR)) {
[]
> +static void restore_slaves(struct net_device *hsr_dev)
> +{
[]
> + netdev_info(hsr_dev, "HSR: Cannot restore slave "
> + "promiscuity (%s, %d)\n",
> + hsr_priv->slave[i]->name, res);
It's nicer to coalesce formats for easier grep
netdev_info(hsr_dev, "HSR: Cannot restore slave promiscuity (%s, %d)\n",
hsr_priv->slave[i]->name, res);
or maybe use special wrappers for something like:
int hsr_info(hsr, slave, fmt, ...)
{
}
[]
> diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c
> +static struct node_entry *find_node_by_AddrB(struct list_head *node_db,
> + unsigned char addr[ETH_ALEN])
> +{
> + struct node_entry *node;
> +
> + list_for_each_entry_rcu(node, node_db, mac_list)
> + if (!compare_ether_addr(node->MacAddressB, addr))
> + return node;
please use braces when the list/for has an if
next prev parent reply other threads:[~2012-10-12 21:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-04 0:12 [RFC v2 1/2] net/hsr: Add support for IEC 62439-3 High-availability Seamless Redundancy Arvid Brodin
2012-07-04 0:30 ` Joe Perches
2012-07-04 22:02 ` Arvid Brodin
2012-08-16 19:12 ` [RFC v3 0/1] " Arvid Brodin
2012-08-16 19:17 ` [RFC v3 1/1] " Arvid Brodin
2012-08-16 20:30 ` David Miller
2012-08-16 21:16 ` Arvid Brodin
2012-08-16 21:46 ` David Miller
2012-10-12 17:11 ` [RFC v4 1/1] net/hsr: Support for the HSR protocol (IEC:2010 / HSR v0) Arvid Brodin
2012-10-12 18:57 ` Stephen Hemminger
2012-10-12 21:39 ` Joe Perches [this message]
2012-07-04 4:20 ` [RFC v2 1/2] net/hsr: Add support for IEC 62439-3 High-availability Seamless Redundancy Stephen Hemminger
2012-07-04 22:34 ` Arvid Brodin
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=1350077975.26909.17.camel@joe-AO722 \
--to=joe@perches.com \
--cc=Arvid.Brodin@xdin.com \
--cc=balferreira@googlemail.com \
--cc=jboticario@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.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