[mpls-linux-devel] [RFC] Patch: Use generic internet flow cache for incoming label lookup
Status: Beta
Brought to you by:
jleu
|
From: Ramon C. <cas...@in...> - 2004-02-05 17:58:34
|
James, All,
do you think this is worth the hassle and that there is indeed a
performance gain ? (I am not even sure if this is a good approach...)
#define MPLS_ENABLE_FLOW_CACHE
#ifdef MPLS_ENABLE_FLOW_CACHE
static void
mpls_mii_resolver (struct flowi *key, u16 family, u8 dir,
void **objp, atomic_t **obj_refp)
{
/* Look up the mii object */
struct mpls_in_info* mii;
read_lock (&mpls_mii_lock);
mii = radix_tree_lookup (&mpls_mii_tree, key->fl6_flowlabel);
read_unlock (&mpls_mii_lock);
/* Give the object address and its refcount. */
*objp = mii;
*obj_refp = (mii)? &mii->kobj.refcount : NULL;
}
#endif
struct mpls_in_info*
mpls_get_mii_by_label (
struct mpls_push_data *mpr,
mpls_label_t *label,
int labelspace)
{
struct mpls_in_info *mii = NULL;
#ifdef MPLS_ENABLE_FLOW_CACHE
struct flowi in_flow;
/* RCAS: We use fl6_flowlabel as the MII key */
in_flow.fl6_flowlabel = mpls_label2key (labelspace,label);
/* RCAS: Lookup flow in percpu flow cache */
mii = flow_cache_lookup(&in_flow, AF_MPLS, MPLS_IN,
mpls_mii_resolver);
if (likely(mii)) {
mpls_in_info_hold(mii);
return mii;
}
/* If !mii it is either reserved or a bug. */
#endif
/* handle the reserved label range */
if (label->ml_type == MPLS_
.....
comments welcome
regards,
Ramon
// -------------------------------------------------------------------
// Ramon Casellas - GET/ENST/INFRES/RHD/A508 - cas...@in...
|