aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/chelsio/cxgb4/l2t.c
diff options
context:
space:
mode:
authorVipul Pandya <vipul@chelsio.com>2012-12-10 04:30:52 -0500
committerRoland Dreier <roland@purestorage.com>2012-12-19 12:28:19 -0500
commitf2b7e78dbc79e09fc1164b226adc03ed91a326cb (patch)
treef1ec25c2d5e09e89d6ef46e1e55676654cbfe357 /drivers/net/ethernet/chelsio/cxgb4/l2t.c
parent5bd665f28db2b04a8d6fe277342479906fc60b62 (diff)
cxgb4: Add T4 filter support
The T4 architecture is capable of filtering ingress packets at line rate using the rule in TCAM. If packet hits a rule in the TCAM then it can be either dropped or passed to the receive queues based on a rule settings. This patch adds framework for managing filters and to use T4's filter capabilities. It constructs a Firmware Filter Work Request which writes the filter at a specified index to get the work done. It hosts shadow copy of ingress filter entry to check field size limitations and save memory in the case where the filter table is large. Signed-off-by: Vipul Pandya <vipul@chelsio.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/net/ethernet/chelsio/cxgb4/l2t.c')
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/l2t.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/l2t.c b/drivers/net/ethernet/chelsio/cxgb4/l2t.c
index 6ac77a62f361..29878098101e 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/l2t.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/l2t.c
@@ -484,6 +484,38 @@ void t4_l2t_update(struct adapter *adap, struct neighbour *neigh)
484 handle_failed_resolution(adap, arpq); 484 handle_failed_resolution(adap, arpq);
485} 485}
486 486
487/* Allocate an L2T entry for use by a switching rule. Such need to be
488 * explicitly freed and while busy they are not on any hash chain, so normal
489 * address resolution updates do not see them.
490 */
491struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *d)
492{
493 struct l2t_entry *e;
494
495 write_lock_bh(&d->lock);
496 e = alloc_l2e(d);
497 if (e) {
498 spin_lock(&e->lock); /* avoid race with t4_l2t_free */
499 e->state = L2T_STATE_SWITCHING;
500 atomic_set(&e->refcnt, 1);
501 spin_unlock(&e->lock);
502 }
503 write_unlock_bh(&d->lock);
504 return e;
505}
506
507/* Sets/updates the contents of a switching L2T entry that has been allocated
508 * with an earlier call to @t4_l2t_alloc_switching.
509 */
510int t4_l2t_set_switching(struct adapter *adap, struct l2t_entry *e, u16 vlan,
511 u8 port, u8 *eth_addr)
512{
513 e->vlan = vlan;
514 e->lport = port;
515 memcpy(e->dmac, eth_addr, ETH_ALEN);
516 return write_l2e(adap, e, 0);
517}
518
487struct l2t_data *t4_init_l2t(void) 519struct l2t_data *t4_init_l2t(void)
488{ 520{
489 int i; 521 int i;