diff options
author | Ariel Elior <ariele@broadcom.com> | 2011-12-05 16:52:24 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-06 13:06:05 -0500 |
commit | ed5162a04f929f6298b6a3b6d7644ecae1933085 (patch) | |
tree | cef3f4265a582a2f2014962ca51f81df507e1576 /drivers/net/ethernet/broadcom | |
parent | 50f0a562f8cc9ed9d9f7f7380434c3c8646172d5 (diff) |
bnx2x: support classification config query
To support copying MAC addresses to firmware query structure.
[ Fixed up style and formatting errors noted by DaveM and Joe Perches ]
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c | 33 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h | 13 |
2 files changed, 46 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c index a34362e9fd9c..5ac616093f9f 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c | |||
@@ -30,6 +30,8 @@ | |||
30 | 30 | ||
31 | #define BNX2X_MAX_EMUL_MULTI 16 | 31 | #define BNX2X_MAX_EMUL_MULTI 16 |
32 | 32 | ||
33 | #define MAC_LEADING_ZERO_CNT (ALIGN(ETH_ALEN, sizeof(u32)) - ETH_ALEN) | ||
34 | |||
33 | /**** Exe Queue interfaces ****/ | 35 | /**** Exe Queue interfaces ****/ |
34 | 36 | ||
35 | /** | 37 | /** |
@@ -441,6 +443,36 @@ static bool bnx2x_put_credit_vlan_mac(struct bnx2x_vlan_mac_obj *o) | |||
441 | return true; | 443 | return true; |
442 | } | 444 | } |
443 | 445 | ||
446 | static int bnx2x_get_n_elements(struct bnx2x *bp, struct bnx2x_vlan_mac_obj *o, | ||
447 | int n, u8 *buf) | ||
448 | { | ||
449 | struct bnx2x_vlan_mac_registry_elem *pos; | ||
450 | u8 *next = buf; | ||
451 | int counter = 0; | ||
452 | |||
453 | /* traverse list */ | ||
454 | list_for_each_entry(pos, &o->head, link) { | ||
455 | if (counter < n) { | ||
456 | /* place leading zeroes in buffer */ | ||
457 | memset(next, 0, MAC_LEADING_ZERO_CNT); | ||
458 | |||
459 | /* place mac after leading zeroes*/ | ||
460 | memcpy(next + MAC_LEADING_ZERO_CNT, pos->u.mac.mac, | ||
461 | ETH_ALEN); | ||
462 | |||
463 | /* calculate address of next element and | ||
464 | * advance counter | ||
465 | */ | ||
466 | counter++; | ||
467 | next = buf + counter * ALIGN(ETH_ALEN, sizeof(u32)); | ||
468 | |||
469 | DP(BNX2X_MSG_SP, "copied element number %d to address %p element was %pM\n", | ||
470 | counter, next, pos->u.mac.mac); | ||
471 | } | ||
472 | } | ||
473 | return counter * ETH_ALEN; | ||
474 | } | ||
475 | |||
444 | /* check_add() callbacks */ | 476 | /* check_add() callbacks */ |
445 | static int bnx2x_check_mac_add(struct bnx2x_vlan_mac_obj *o, | 477 | static int bnx2x_check_mac_add(struct bnx2x_vlan_mac_obj *o, |
446 | union bnx2x_classification_ramrod_data *data) | 478 | union bnx2x_classification_ramrod_data *data) |
@@ -1886,6 +1918,7 @@ void bnx2x_init_mac_obj(struct bnx2x *bp, | |||
1886 | mac_obj->check_move = bnx2x_check_move; | 1918 | mac_obj->check_move = bnx2x_check_move; |
1887 | mac_obj->ramrod_cmd = | 1919 | mac_obj->ramrod_cmd = |
1888 | RAMROD_CMD_ID_ETH_CLASSIFICATION_RULES; | 1920 | RAMROD_CMD_ID_ETH_CLASSIFICATION_RULES; |
1921 | mac_obj->get_n_elements = bnx2x_get_n_elements; | ||
1889 | 1922 | ||
1890 | /* Exe Queue */ | 1923 | /* Exe Queue */ |
1891 | bnx2x_exe_queue_init(bp, | 1924 | bnx2x_exe_queue_init(bp, |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h index 9a517c2e9f1b..992308ff82e8 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h | |||
@@ -285,6 +285,19 @@ struct bnx2x_vlan_mac_obj { | |||
285 | /* RAMROD command to be used */ | 285 | /* RAMROD command to be used */ |
286 | int ramrod_cmd; | 286 | int ramrod_cmd; |
287 | 287 | ||
288 | /* copy first n elements onto preallocated buffer | ||
289 | * | ||
290 | * @param n number of elements to get | ||
291 | * @param buf buffer preallocated by caller into which elements | ||
292 | * will be copied. Note elements are 4-byte aligned | ||
293 | * so buffer size must be able to accomodate the | ||
294 | * aligned elements. | ||
295 | * | ||
296 | * @return number of copied bytes | ||
297 | */ | ||
298 | int (*get_n_elements)(struct bnx2x *bp, struct bnx2x_vlan_mac_obj *o, | ||
299 | int n, u8 *buf); | ||
300 | |||
288 | /** | 301 | /** |
289 | * Checks if ADD-ramrod with the given params may be performed. | 302 | * Checks if ADD-ramrod with the given params may be performed. |
290 | * | 303 | * |