[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE4R7bCdpu+fUZdPJJkNMhxLBBdecdVF9hZFbooKhCWwWL-oXw@mail.gmail.com>
Date: Mon, 2 Mar 2015 09:10:28 -0800
From: Scott Feldman <sfeldma@...il.com>
To: roopa <roopa@...ulusnetworks.com>
Cc: Netdev <netdev@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Jiří Pírko <jiri@...nulli.us>
Subject: Re: [PATCH net-next v2 2/4] net: add IPv4 routing FIB support for switchdev
On Mon, Mar 2, 2015 at 6:30 AM, roopa <roopa@...ulusnetworks.com> wrote:
> On 3/2/15, 2:06 AM, sfeldma@...il.com wrote:
>>
>> From: Scott Feldman <sfeldma@...il.com>
>> + err = netdev_switch_fib_ipv4_add(key, plen, fi,
>> + new_fa->fa_tos,
>> + cfg->fc_type,
>> + tb->tb_id);
>> + if (err && err != -EOPNOTSUPP) {
>> + kmem_cache_free(fn_alias_kmem, new_fa);
>> + goto out;
>> + }
>> +
>> hlist_replace_rcu(&fa->fa_list, &new_fa->fa_list);
>> +
>> alias_free_mem_rcu(fa);
>> fib_release_info(fi_drop);
>
>
> This looks like the replace case: It will need a netdev_switch_fib_ipv4_del
> for fi_drop ?
It is the replace case. No del needed. Failure to replace in HW
results in replace not proceeding in SW and err return to user. So HW
and SW stay coherent and user can react to failure case.
>>
>> @@ -1197,12 +1208,18 @@ int fib_table_insert(struct fib_table *tb, struct
>> fib_config *cfg)
>> new_fa->fa_state = 0;
>> new_fa->fa_slen = slen;
>> + /* (Optionally) offload fib entry to switch hardware. */
>> + err = netdev_switch_fib_ipv4_add(key, plen, fi, tos,
>> + cfg->fc_type, tb->tb_id);
>
>
> This could be an NLM_F_APPEND case. Would be better for the switchdev API to
> also take
> nlflags as argument, to inform the switch driver of replace and append
> cases.
No, we can keep it simple. The ndo add op is used for adds or mods.
The driver/device will know if operation is a mod vs. add if object
exists (it's an add if object doesn't exist).
>> + /* Recusively search from fib_dev down until we find
>> + * a sw port dev. (A sw port dev supports
>> + * ndo_switch_parent_id_get).
>> + */
>> +
>> + if (ops->ndo_switch_parent_id_get)
>> + return dev;
>
>
> Maybe we can just check for NETIF_F_HW_SWITCH_OFFLOAD here ?
> similar to netdev_switch_port_bridge_newlink/dellink
Probably, yes.
-scott
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists