aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
index 5ac616093f9f..cb6339c35571 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
@@ -50,6 +50,7 @@ static inline void bnx2x_exe_queue_init(struct bnx2x *bp,
50 int exe_len, 50 int exe_len,
51 union bnx2x_qable_obj *owner, 51 union bnx2x_qable_obj *owner,
52 exe_q_validate validate, 52 exe_q_validate validate,
53 exe_q_remove remove,
53 exe_q_optimize optimize, 54 exe_q_optimize optimize,
54 exe_q_execute exec, 55 exe_q_execute exec,
55 exe_q_get get) 56 exe_q_get get)
@@ -66,6 +67,7 @@ static inline void bnx2x_exe_queue_init(struct bnx2x *bp,
66 67
67 /* Owner specific callbacks */ 68 /* Owner specific callbacks */
68 o->validate = validate; 69 o->validate = validate;
70 o->remove = remove;
69 o->optimize = optimize; 71 o->optimize = optimize;
70 o->execute = exec; 72 o->execute = exec;
71 o->get = get; 73 o->get = get;
@@ -1340,6 +1342,35 @@ static int bnx2x_validate_vlan_mac(struct bnx2x *bp,
1340 } 1342 }
1341} 1343}
1342 1344
1345static int bnx2x_remove_vlan_mac(struct bnx2x *bp,
1346 union bnx2x_qable_obj *qo,
1347 struct bnx2x_exeq_elem *elem)
1348{
1349 int rc = 0;
1350
1351 /* If consumption wasn't required, nothing to do */
1352 if (test_bit(BNX2X_DONT_CONSUME_CAM_CREDIT,
1353 &elem->cmd_data.vlan_mac.vlan_mac_flags))
1354 return 0;
1355
1356 switch (elem->cmd_data.vlan_mac.cmd) {
1357 case BNX2X_VLAN_MAC_ADD:
1358 case BNX2X_VLAN_MAC_MOVE:
1359 rc = qo->vlan_mac.put_credit(&qo->vlan_mac);
1360 break;
1361 case BNX2X_VLAN_MAC_DEL:
1362 rc = qo->vlan_mac.get_credit(&qo->vlan_mac);
1363 break;
1364 default:
1365 return -EINVAL;
1366 }
1367
1368 if (rc != true)
1369 return -EINVAL;
1370
1371 return 0;
1372}
1373
1343/** 1374/**
1344 * bnx2x_wait_vlan_mac - passivly wait for 5 seconds until all work completes. 1375 * bnx2x_wait_vlan_mac - passivly wait for 5 seconds until all work completes.
1345 * 1376 *
@@ -1801,8 +1832,14 @@ static int bnx2x_vlan_mac_del_all(struct bnx2x *bp,
1801 1832
1802 list_for_each_entry_safe(exeq_pos, exeq_pos_n, &exeq->exe_queue, link) { 1833 list_for_each_entry_safe(exeq_pos, exeq_pos_n, &exeq->exe_queue, link) {
1803 if (exeq_pos->cmd_data.vlan_mac.vlan_mac_flags == 1834 if (exeq_pos->cmd_data.vlan_mac.vlan_mac_flags ==
1804 *vlan_mac_flags) 1835 *vlan_mac_flags) {
1836 rc = exeq->remove(bp, exeq->owner, exeq_pos);
1837 if (rc) {
1838 BNX2X_ERR("Failed to remove command\n");
1839 return rc;
1840 }
1805 list_del(&exeq_pos->link); 1841 list_del(&exeq_pos->link);
1842 }
1806 } 1843 }
1807 1844
1808 spin_unlock_bh(&exeq->lock); 1845 spin_unlock_bh(&exeq->lock);
@@ -1908,6 +1945,7 @@ void bnx2x_init_mac_obj(struct bnx2x *bp,
1908 bnx2x_exe_queue_init(bp, 1945 bnx2x_exe_queue_init(bp,
1909 &mac_obj->exe_queue, 1, qable_obj, 1946 &mac_obj->exe_queue, 1, qable_obj,
1910 bnx2x_validate_vlan_mac, 1947 bnx2x_validate_vlan_mac,
1948 bnx2x_remove_vlan_mac,
1911 bnx2x_optimize_vlan_mac, 1949 bnx2x_optimize_vlan_mac,
1912 bnx2x_execute_vlan_mac, 1950 bnx2x_execute_vlan_mac,
1913 bnx2x_exeq_get_mac); 1951 bnx2x_exeq_get_mac);
@@ -1924,6 +1962,7 @@ void bnx2x_init_mac_obj(struct bnx2x *bp,
1924 bnx2x_exe_queue_init(bp, 1962 bnx2x_exe_queue_init(bp,
1925 &mac_obj->exe_queue, CLASSIFY_RULES_COUNT, 1963 &mac_obj->exe_queue, CLASSIFY_RULES_COUNT,
1926 qable_obj, bnx2x_validate_vlan_mac, 1964 qable_obj, bnx2x_validate_vlan_mac,
1965 bnx2x_remove_vlan_mac,
1927 bnx2x_optimize_vlan_mac, 1966 bnx2x_optimize_vlan_mac,
1928 bnx2x_execute_vlan_mac, 1967 bnx2x_execute_vlan_mac,
1929 bnx2x_exeq_get_mac); 1968 bnx2x_exeq_get_mac);
@@ -1963,6 +2002,7 @@ void bnx2x_init_vlan_obj(struct bnx2x *bp,
1963 bnx2x_exe_queue_init(bp, 2002 bnx2x_exe_queue_init(bp,
1964 &vlan_obj->exe_queue, CLASSIFY_RULES_COUNT, 2003 &vlan_obj->exe_queue, CLASSIFY_RULES_COUNT,
1965 qable_obj, bnx2x_validate_vlan_mac, 2004 qable_obj, bnx2x_validate_vlan_mac,
2005 bnx2x_remove_vlan_mac,
1966 bnx2x_optimize_vlan_mac, 2006 bnx2x_optimize_vlan_mac,
1967 bnx2x_execute_vlan_mac, 2007 bnx2x_execute_vlan_mac,
1968 bnx2x_exeq_get_vlan); 2008 bnx2x_exeq_get_vlan);
@@ -2009,6 +2049,7 @@ void bnx2x_init_vlan_mac_obj(struct bnx2x *bp,
2009 bnx2x_exe_queue_init(bp, 2049 bnx2x_exe_queue_init(bp,
2010 &vlan_mac_obj->exe_queue, 1, qable_obj, 2050 &vlan_mac_obj->exe_queue, 1, qable_obj,
2011 bnx2x_validate_vlan_mac, 2051 bnx2x_validate_vlan_mac,
2052 bnx2x_remove_vlan_mac,
2012 bnx2x_optimize_vlan_mac, 2053 bnx2x_optimize_vlan_mac,
2013 bnx2x_execute_vlan_mac, 2054 bnx2x_execute_vlan_mac,
2014 bnx2x_exeq_get_vlan_mac); 2055 bnx2x_exeq_get_vlan_mac);
@@ -2025,6 +2066,7 @@ void bnx2x_init_vlan_mac_obj(struct bnx2x *bp,
2025 &vlan_mac_obj->exe_queue, 2066 &vlan_mac_obj->exe_queue,
2026 CLASSIFY_RULES_COUNT, 2067 CLASSIFY_RULES_COUNT,
2027 qable_obj, bnx2x_validate_vlan_mac, 2068 qable_obj, bnx2x_validate_vlan_mac,
2069 bnx2x_remove_vlan_mac,
2028 bnx2x_optimize_vlan_mac, 2070 bnx2x_optimize_vlan_mac,
2029 bnx2x_execute_vlan_mac, 2071 bnx2x_execute_vlan_mac,
2030 bnx2x_exeq_get_vlan_mac); 2072 bnx2x_exeq_get_vlan_mac);