From: "Nicolas de Pesloüan" <nicolas.2p.debian@gmail•com>
To: Simon Chen <simonchennj@gmail•com>
Cc: netdev@vger•kernel.org
Subject: Re: bonding xmit_policy
Date: Sun, 13 Nov 2011 21:26:50 +0100 [thread overview]
Message-ID: <4EC0280A.3060100@gmail.com> (raw)
In-Reply-To: <CANj2Ebfj+7R+wCK7jJennBN7_6THJGqs8FWSAPOv7BYYsR=u9w@mail.gmail.com>
Le 13/11/2011 03:55, Simon Chen a écrit :
> Hi folks,
>
> It looks like that there are three entries in xmit_policy (hashing for
> deciding egress phy int) for bonded interfaces:
>
> const struct bond_parm_tbl xmit_hashtype_tbl[] = {
> { "layer2", BOND_XMIT_POLICY_LAYER2},
> { "layer3+4", BOND_XMIT_POLICY_LAYER34},
> { "layer2+3", BOND_XMIT_POLICY_LAYER23},
> { NULL, -1},
> };
>
>
> We can set the xmit_policy either at module initiation, or later via
> /sys. However, this xmit_policy isn't really read anywhere. Are
> different policies really implemented?
The table is used in two different locations:
In drivers/net/bonding/bond_main.c:
xmit_hashtype = bond_parse_parm(xmit_hash_policy, xmit_hashtype_tbl);
[...]
params->xmit_policy = xmit_hashtype;
In drivers/net/bonding/bond_sysfs.c:
new_value = bond_parse_parm(buf, xmit_hashtype_tbl);
[...]
bonds->params.xmit_policy = new_value;
Then, in drivers/net/bonding/bond_main.c, the value in bonds->params.xmit_policy is used to setup a
callback into bond->xmit_hash_policy.
static void bond_set_xmit_hash_policy(struct bonding *bond)
{
switch (bond->params.xmit_policy) {
case BOND_XMIT_POLICY_LAYER23:
bond->xmit_hash_policy = bond_xmit_hash_policy_l23;
break;
case BOND_XMIT_POLICY_LAYER34:
bond->xmit_hash_policy = bond_xmit_hash_policy_l34;
break;
case BOND_XMIT_POLICY_LAYER2:
default:
bond->xmit_hash_policy = bond_xmit_hash_policy_l2;
break;
}
}
Then, in drivers/net/bonding/bond_3ad.c and in drivers/net/bonding/bond_main.c, the callback is used
to select a slave for xmit, for the two modes where xmit_hash_policy have a meaning:
slave_agg_no = bond->xmit_hash_policy(skb, slaves_in_agg);
slave_no = bond->xmit_hash_policy(skb, bond->slave_cnt);
So, yes, those policies are really implemented.
Nicolas.
next prev parent reply other threads:[~2011-11-13 20:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-13 2:55 bonding xmit_policy Simon Chen
2011-11-13 20:26 ` Nicolas de Pesloüan [this message]
2011-11-15 6:20 ` Simon Chen
2011-11-15 7:12 ` Eric Dumazet
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=4EC0280A.3060100@gmail.com \
--to=nicolas.2p.debian@gmail$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=simonchennj@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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