/* * This file is part of the Chelsio T4/T5/T6 Ethernet driver for Linux. * * Copyright (c) 2017 Chelsio Communications, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.
*/
for (e = &s->smtab[0], end = &s->smtab[s->smt_size]; e != end; ++e) { if (e->refcnt == 0) { if (!first_free)
first_free = e;
} else { if (e->state == SMT_STATE_SWITCHING) { /* This entry is actually in use. See if we can * re-use it ?
*/ if (memcmp(e->src_mac, smac, ETH_ALEN) == 0) goto found_reuse;
}
}
}
if (first_free) {
e = first_free; goto found;
} return NULL;
found:
e->state = SMT_STATE_UNUSED;
found_reuse: return e;
}
staticvoid t4_smte_free(struct smt_entry *e)
{ if (e->refcnt == 0) { /* hasn't been recycled */
e->state = SMT_STATE_UNUSED;
}
}
/** * cxgb4_smt_release - Release SMT entry * @e: smt entry to release * * Releases ref count and frees up an smt entry from SMT table
*/ void cxgb4_smt_release(struct smt_entry *e)
{
spin_lock_bh(&e->lock); if ((--e->refcnt) == 0)
t4_smte_free(e);
spin_unlock_bh(&e->lock);
}
EXPORT_SYMBOL(cxgb4_smt_release);
/** * cxgb4_smt_alloc_switching - Allocates an SMT entry for switch filters. * @dev: net_device pointer * @smac: MAC address to add to SMT * Returns pointer to the SMT entry created * * Allocates an SMT entry to be used by switching rule of a filter.
*/ struct smt_entry *cxgb4_smt_alloc_switching(struct net_device *dev, u8 *smac)
{ struct adapter *adap = netdev2adap(dev);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.