Skip to content

Commit 5fab515

Browse files
RajuRangojudavem330
authored andcommitted
cxgb4: Add MPS TCAM refcounting for raw mac filters
This patch adds TCAM reference counting support for raw mac filters. Signed-off-by: Raju Rangoju <rajur@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 28b3870 commit 5fab515

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

drivers/net/ethernet/chelsio/cxgb4/cxgb4.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,5 +1919,21 @@ int cxgb4_alloc_encap_mac_filt(struct adapter *adap, unsigned int viid,
19191919
u8 dip_hit, u8 lookup_type, bool sleep_ok);
19201920
int cxgb4_free_encap_mac_filt(struct adapter *adap, unsigned int viid,
19211921
int idx, bool sleep_ok);
1922+
int cxgb4_free_raw_mac_filt(struct adapter *adap,
1923+
unsigned int viid,
1924+
const u8 *addr,
1925+
const u8 *mask,
1926+
unsigned int idx,
1927+
u8 lookup_type,
1928+
u8 port_id,
1929+
bool sleep_ok);
1930+
int cxgb4_alloc_raw_mac_filt(struct adapter *adap,
1931+
unsigned int viid,
1932+
const u8 *addr,
1933+
const u8 *mask,
1934+
unsigned int idx,
1935+
u8 lookup_type,
1936+
u8 port_id,
1937+
bool sleep_ok);
19221938

19231939
#endif /* __CXGB4_H__ */

drivers/net/ethernet/chelsio/cxgb4/cxgb4_mps.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,52 @@ static int cxgb4_mps_ref_inc(struct adapter *adap, const u8 *mac_addr,
5454
return ret;
5555
}
5656

57+
int cxgb4_free_raw_mac_filt(struct adapter *adap,
58+
unsigned int viid,
59+
const u8 *addr,
60+
const u8 *mask,
61+
unsigned int idx,
62+
u8 lookup_type,
63+
u8 port_id,
64+
bool sleep_ok)
65+
{
66+
int ret = 0;
67+
68+
if (!cxgb4_mps_ref_dec(adap, idx))
69+
ret = t4_free_raw_mac_filt(adap, viid, addr,
70+
mask, idx, lookup_type,
71+
port_id, sleep_ok);
72+
73+
return ret;
74+
}
75+
76+
int cxgb4_alloc_raw_mac_filt(struct adapter *adap,
77+
unsigned int viid,
78+
const u8 *addr,
79+
const u8 *mask,
80+
unsigned int idx,
81+
u8 lookup_type,
82+
u8 port_id,
83+
bool sleep_ok)
84+
{
85+
int ret;
86+
87+
ret = t4_alloc_raw_mac_filt(adap, viid, addr,
88+
mask, idx, lookup_type,
89+
port_id, sleep_ok);
90+
if (ret < 0)
91+
return ret;
92+
93+
if (cxgb4_mps_ref_inc(adap, addr, ret, mask)) {
94+
ret = -ENOMEM;
95+
t4_free_raw_mac_filt(adap, viid, addr,
96+
mask, idx, lookup_type,
97+
port_id, sleep_ok);
98+
}
99+
100+
return ret;
101+
}
102+
57103
int cxgb4_free_encap_mac_filt(struct adapter *adap, unsigned int viid,
58104
int idx, bool sleep_ok)
59105
{

0 commit comments

Comments
 (0)