compat_6510.c (21266B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 * 7 * RPC Compatibility with <=sdk-6.5.10 routines 8 */ 9 10 #ifdef BCM_RPC_SUPPORT 11 #include <shared/alloc.h> 12 13 #include <bcm/types.h> 14 #include <bcm/error.h> 15 #include <bcm/l2.h> 16 17 #include <bcm_int/compat/compat_6510.h> 18 19 /* 20 * Function: 21 * _bcm_compat6510in_l2_addr_t 22 * Purpose: 23 * Convert the bcm_l2_addr_t datatype from <=6.5.10 to 24 * SDK 6.5.10+ 25 * Parameters: 26 * from - (IN) The <=6.5.10 version of the datatype 27 * to - (OUT) The SDK 6.5.10+ version of the datatype 28 * Returns: 29 * Nothing 30 */ 31 STATIC void 32 _bcm_compat6510in_l2_addr_t(bcm_compat6510_l2_addr_t *from, 33 bcm_l2_addr_t *to) 34 { 35 to->flags = from->flags; 36 to->station_flags = from->station_flags; 37 sal_memcpy(to->mac, from->mac, sizeof(bcm_mac_t)); 38 to->vid = from->vid; 39 to->port = from->port; 40 to->modid = from->modid; 41 to->tgid = from->tgid; 42 to->cos_dst = from->cos_dst; 43 to->cos_src = from->cos_src; 44 to->l2mc_group = from->l2mc_group; 45 to->block_bitmap = from->block_bitmap; 46 to->auth = from->auth; 47 to->group = from->group; 48 to->distribution_class = from->distribution_class; 49 to->encap_id = from->encap_id; 50 to->age_state = from->age_state; 51 to->flow_handle = from-> flow_handle; 52 to->flow_option_handle = from->flow_option_handle; 53 sal_memcpy(to->logical_fields, from->logical_fields, 54 BCM_FLOW_MAX_NOF_LOGICAL_FIELDS * sizeof(bcm_flow_logical_field_t)); 55 to->num_of_fields = from->num_of_fields; 56 to->sa_source_filter_pbmp = from->sa_source_filter_pbmp; 57 to->tsn_flowset = from->tsn_flowset; 58 to->sr_flowset = from->sr_flowset; 59 to->policer_id = from->policer_id; 60 to->taf_gate_primap = from->taf_gate_primap; 61 to->flags2 = 0; 62 to->egress_if = 0; 63 } 64 65 /* 66 * Function: 67 * _bcm_compat6510out_l2_addr_t 68 * Purpose: 69 * Convert the bcm_l2_addr_t datatype from 6.5.10+ to 70 * <=6.5.10 71 * Parameters: 72 * from - (IN) The SDK 6.5.10+ version of the datatype 73 * to - (OUT) The <=6.5.10 version of the datatype 74 * Returns: 75 * Nothing 76 */ 77 STATIC void 78 _bcm_compat6510out_l2_addr_t(bcm_l2_addr_t *from, 79 bcm_compat6510_l2_addr_t *to) 80 { 81 to->flags = from->flags; 82 to->station_flags = from->station_flags; 83 sal_memcpy(to->mac, from->mac, sizeof(bcm_mac_t)); 84 to->vid = from->vid; 85 to->port = from->port; 86 to->modid = from->modid; 87 to->tgid = from->tgid; 88 to->cos_dst = from->cos_dst; 89 to->cos_src = from->cos_src; 90 to->l2mc_group = from->l2mc_group; 91 to->block_bitmap = from->block_bitmap; 92 to->auth = from->auth; 93 to->group = from->group; 94 to->distribution_class = from->distribution_class; 95 to->encap_id = from->encap_id; 96 to->age_state = from->age_state; 97 to->flow_handle = from-> flow_handle; 98 to->flow_option_handle = from->flow_option_handle; 99 sal_memcpy(to->logical_fields, from->logical_fields, 100 BCM_FLOW_MAX_NOF_LOGICAL_FIELDS * sizeof(bcm_flow_logical_field_t)); 101 to->num_of_fields = from->num_of_fields; 102 to->sa_source_filter_pbmp = from->sa_source_filter_pbmp; 103 to->tsn_flowset = from->tsn_flowset; 104 to->sr_flowset = from->sr_flowset; 105 to->policer_id = from->policer_id; 106 to->taf_gate_primap = from->taf_gate_primap; 107 } 108 109 /* 110 * Function: bcm_compat6510_l2_addr_add 111 * 112 * Purpose: 113 * Compatibility function for RPC call to bcm_l2_addr_add. 114 * 115 * Parameters: 116 * unit - (IN) BCM device number. 117 * l2addr - (IN) l2 address entry with old format 118 * 119 * Returns: 120 * BCM_E_XXX 121 */ 122 int 123 bcm_compat6510_l2_addr_add(int unit, 124 bcm_compat6510_l2_addr_t *l2addr) 125 { 126 int rv = BCM_E_NONE; 127 bcm_l2_addr_t *newl2addr = NULL; 128 129 if (NULL != l2addr) { 130 /* Create from heap to avoid the stack to bloat */ 131 newl2addr = (bcm_l2_addr_t *) 132 sal_alloc(sizeof(bcm_l2_addr_t), "New l2 addr"); 133 if (NULL == newl2addr) { 134 return BCM_E_MEMORY; 135 } 136 137 /* Transform the entry from the old format to new one */ 138 _bcm_compat6510in_l2_addr_t(l2addr, newl2addr); 139 } else { 140 return BCM_E_PARAM; 141 } 142 143 /* Call the BCM API with new format */ 144 rv = bcm_l2_addr_add(unit, newl2addr); 145 146 /* Transform the entry from the new format to old one */ 147 _bcm_compat6510out_l2_addr_t(newl2addr, l2addr); 148 149 /* Deallocate memory*/ 150 sal_free(newl2addr); 151 152 return rv; 153 } 154 155 /* 156 * Function: bcm_compat6510_l2_addr_multi_add 157 * 158 * Purpose: 159 * Compatibility function for RPC call to bcm_l2_addr_multi_add. 160 * 161 * Parameters: 162 * unit - (IN) BCM device number. 163 * l2addr - (IN) l2 address entry with old format. 164 * count - (IN) count of l2 address to add. 165 * 166 * Returns: 167 * BCM_E_XXX 168 */ 169 int 170 bcm_compat6510_l2_addr_multi_add(int unit, 171 bcm_compat6510_l2_addr_t *l2addr, 172 int count) 173 { 174 int rv = BCM_E_NONE; 175 bcm_l2_addr_t *newl2addr = NULL; 176 177 if (NULL != l2addr) { 178 /* Create from heap to avoid the stack to bloat */ 179 newl2addr = (bcm_l2_addr_t *) 180 sal_alloc(sizeof(bcm_l2_addr_t), "New l2 addr"); 181 if (NULL == newl2addr) { 182 return BCM_E_MEMORY; 183 } 184 185 /* Transform the entry from the old format to new one */ 186 _bcm_compat6510in_l2_addr_t(l2addr, newl2addr); 187 } else { 188 return BCM_E_PARAM; 189 } 190 191 /* Call the BCM API with new format */ 192 rv = bcm_l2_addr_multi_add(unit, newl2addr,count); 193 194 /* Transform the entry from the new format to old one */ 195 _bcm_compat6510out_l2_addr_t(newl2addr, l2addr); 196 197 /* Deallocate memory*/ 198 sal_free(newl2addr); 199 200 return rv; 201 } 202 203 /* 204 * Function: bcm_compat6510_l2_addr_multi_delete 205 * 206 * Purpose: 207 * Compatibility function for RPC call to bcm_l2_addr_multi_delete. 208 * 209 * Parameters: 210 * unit - (IN) BCM device number. 211 * l2addr - (IN) L2 address entry with old format. 212 * count - (IN) count of l2 address to delete. 213 * 214 * Returns: 215 * BCM_E_XXX 216 */ 217 int 218 bcm_compat6510_l2_addr_multi_delete(int unit, 219 bcm_compat6510_l2_addr_t *l2addr, 220 int count) 221 { 222 int rv = BCM_E_NONE; 223 bcm_l2_addr_t *newl2addr = NULL; 224 225 if (NULL != l2addr) { 226 /* Create from heap to avoid the stack to bloat */ 227 newl2addr = (bcm_l2_addr_t *) 228 sal_alloc(sizeof(bcm_l2_addr_t), "New l2 addr"); 229 if (NULL == newl2addr) { 230 return BCM_E_MEMORY; 231 } 232 233 /* Transform the entry from the old format to new one */ 234 _bcm_compat6510in_l2_addr_t(l2addr, newl2addr); 235 } else { 236 return BCM_E_PARAM; 237 } 238 239 /* Call the BCM API with new format */ 240 rv = bcm_l2_addr_multi_delete(unit, newl2addr,count); 241 242 /* Transform the entry from the new format to old one */ 243 _bcm_compat6510out_l2_addr_t(newl2addr, l2addr); 244 245 /* Deallocate memory*/ 246 sal_free(newl2addr); 247 248 return rv; 249 } 250 251 /* 252 * Function: bcm_compat6510_l2_addr_get 253 * 254 * Purpose: 255 * Compatibility function for RPC call to bcm_l2_addr_get. 256 * 257 * Parameters: 258 * unit - (IN) BCM device number. 259 * mac_addr - (IN) Input mac address entry to search. 260 * vid - (IN) Input VLAN ID to search. 261 * l2addr - (OUT) l2 address entry with old format. 262 * 263 * Returns: 264 * BCM_E_XXX 265 */ 266 int 267 bcm_compat6510_l2_addr_get(int unit, 268 bcm_mac_t mac_addr, bcm_vlan_t vid, 269 bcm_compat6510_l2_addr_t *l2addr) 270 { 271 int rv = BCM_E_NONE; 272 bcm_l2_addr_t *newl2addr = NULL; 273 274 if (NULL != l2addr) { 275 /* Create from heap to avoid the stack to bloat */ 276 newl2addr = (bcm_l2_addr_t *) 277 sal_alloc(sizeof(bcm_l2_addr_t), "New l2 addr"); 278 if (NULL == newl2addr) { 279 return BCM_E_MEMORY; 280 } 281 282 /* Transform the entry from the old format to new one */ 283 _bcm_compat6510in_l2_addr_t(l2addr, newl2addr); 284 } else { 285 return BCM_E_PARAM; 286 } 287 288 /* Call the BCM API with new format */ 289 rv = bcm_l2_addr_get(unit, mac_addr, vid, newl2addr); 290 291 /* Transform the entry from the new format to old one */ 292 _bcm_compat6510out_l2_addr_t(newl2addr, l2addr); 293 294 /* Deallocate memory*/ 295 sal_free(newl2addr); 296 297 return rv; 298 } 299 300 /* 301 * Function: bcm_compat6510_l2_conflict_get 302 * 303 * Purpose: 304 * Compatibility function for RPC call to bcm_l2_conflict_get. 305 * 306 * Parameters: 307 * unit - (IN) BCM device number. 308 * addr - (IN) l2 address entry with old format. 309 * cf_array - (OUT) conflicting address array. 310 * cf_max - (IN) maximum conflicting address. 311 * cf_count - (OUT) actual count of conflicting address found. 312 * 313 * Returns: 314 * BCM_E_XXX 315 */ 316 int 317 bcm_compat6510_l2_conflict_get(int unit, bcm_compat6510_l2_addr_t *addr, 318 bcm_compat6510_l2_addr_t *cf_array, int cf_max, 319 int *cf_count) 320 { 321 int rv = BCM_E_NONE; 322 bcm_l2_addr_t naddr; 323 bcm_l2_addr_t *ncf_array = NULL; 324 int i = 0; 325 326 if ((NULL != addr) && (NULL != cf_array) && (0 < cf_max)) { 327 /* Create from heap to avoid the stack to bloat */ 328 ncf_array = (bcm_l2_addr_t *) 329 sal_alloc(cf_max * sizeof(bcm_l2_addr_t), 330 "compat6510_l2_conflict_get"); 331 if (NULL == ncf_array) { 332 return BCM_E_MEMORY; 333 } 334 } else { 335 return BCM_E_PARAM; 336 } 337 338 /* Transform the entry from the old format to new one */ 339 _bcm_compat6510in_l2_addr_t(addr, &naddr); 340 341 /* Call the BCM API with new format */ 342 rv = bcm_l2_conflict_get(unit, &naddr, ncf_array, cf_max, cf_count); 343 344 if (rv >= 0) { 345 for(i = 0; i < *cf_count; i++) { 346 _bcm_compat6510out_l2_addr_t(&ncf_array[i], &cf_array[i]); 347 } 348 } 349 350 /* Deallocate memory*/ 351 sal_free(ncf_array); 352 return rv; 353 } 354 355 /* 356 * Function: bcm_compat6510_l2_replace 357 * 358 * Purpose: 359 * Compatibility function for RPC call to bcm_l2_replace. 360 * 361 * Parameters: 362 * unit - (IN) BCM device number. 363 * flags - (IN) L2 replace flags. 364 * match_addr - (IN) L2 address entry with old format. 365 * new_module - (IN) module id. 366 * new_port - (IN) port. 367 * new_trunk - (IN) trunk group id. 368 * 369 * Returns: 370 * BCM_E_XXX 371 */ 372 int 373 bcm_compat6510_l2_replace(int unit, uint32 flags, 374 bcm_compat6510_l2_addr_t *match_addr, 375 bcm_module_t new_module, 376 bcm_port_t new_port, bcm_trunk_t new_trunk) 377 { 378 int rv = BCM_E_NONE; 379 bcm_l2_addr_t *newmatch_addr = NULL; 380 381 if (NULL != match_addr) { 382 /* Create from heap to avoid the stack to bloat */ 383 newmatch_addr = (bcm_l2_addr_t *) 384 sal_alloc(sizeof(bcm_l2_addr_t), "New l2 addr"); 385 if (NULL == newmatch_addr) { 386 return BCM_E_MEMORY; 387 } 388 389 /* Transform the entry from the old format to new one */ 390 _bcm_compat6510in_l2_addr_t(match_addr, newmatch_addr); 391 } else { 392 return BCM_E_PARAM; 393 } 394 395 /* Call the BCM API with new format */ 396 rv = bcm_l2_replace(unit, flags, newmatch_addr, new_module, new_port, new_trunk); 397 398 /* Transform the entry from the new format to old one */ 399 _bcm_compat6510out_l2_addr_t(newmatch_addr, match_addr); 400 401 /* Deallocate memory*/ 402 sal_free(newmatch_addr); 403 404 return rv; 405 } 406 407 /* 408 * Function: bcm_compat6510_l2_replace_match 409 * 410 * Purpose: 411 * Compatibility function for RPC call to bcm_l2_replace_match. 412 * 413 * Parameters: 414 * unit - (IN) BCM device number. 415 * match_addr - (IN) l2 address entry with old format. 416 * mask_addr - (IN) mask l2 address entry with old format. 417 * replace_addr - (IN) replace l2 address entry in old format. 418 * replace_mask_addr - (IN) replace l2 mask address entry in old format. 419 * 420 * Returns: 421 * BCM_E_XXX 422 */ 423 int 424 bcm_compat6510_l2_replace_match(int unit, uint32 flags, 425 bcm_compat6510_l2_addr_t *match_addr, 426 bcm_compat6510_l2_addr_t *mask_addr, 427 bcm_compat6510_l2_addr_t *replace_addr, 428 bcm_compat6510_l2_addr_t *replace_mask_addr) 429 { 430 int rv = BCM_E_NONE; 431 bcm_l2_addr_t *newmatch_addr = NULL; 432 bcm_l2_addr_t *newmask_addr = NULL; 433 bcm_l2_addr_t *newreplace_addr = NULL; 434 bcm_l2_addr_t *newreplace_mask_addr = NULL; 435 436 if ((NULL != match_addr) && (NULL != mask_addr) && 437 (NULL != replace_addr) && (NULL != replace_mask_addr)) { 438 /* Create from heap to avoid the stack to bloat */ 439 newmatch_addr = (bcm_l2_addr_t *) 440 sal_alloc(sizeof(bcm_l2_addr_t), "New l2 addr"); 441 if (NULL == newmatch_addr) { 442 return BCM_E_MEMORY; 443 } 444 445 newmask_addr = (bcm_l2_addr_t *) 446 sal_alloc(sizeof(bcm_l2_addr_t), "New l2 addr mask"); 447 if (NULL == newmask_addr) { 448 sal_free(newmatch_addr); 449 return BCM_E_MEMORY; 450 } 451 452 newreplace_addr = (bcm_l2_addr_t *) 453 sal_alloc(sizeof(bcm_l2_addr_t), "Replace l2 addr"); 454 if (NULL == newreplace_addr) { 455 sal_free(newmatch_addr); 456 sal_free(newmask_addr); 457 return BCM_E_MEMORY; 458 } 459 460 newreplace_mask_addr = (bcm_l2_addr_t *) 461 sal_alloc(sizeof(bcm_l2_addr_t), "Replace l2 addr mask"); 462 if (NULL == newreplace_mask_addr) { 463 sal_free(newmatch_addr); 464 sal_free(newmask_addr); 465 sal_free(newreplace_addr); 466 return BCM_E_MEMORY; 467 } 468 469 /* Transform the entry from the old format to new one */ 470 _bcm_compat6510in_l2_addr_t(match_addr, newmatch_addr); 471 _bcm_compat6510in_l2_addr_t(mask_addr, newmask_addr); 472 _bcm_compat6510in_l2_addr_t(replace_addr, newreplace_addr); 473 _bcm_compat6510in_l2_addr_t(replace_mask_addr, newreplace_mask_addr); 474 } else { 475 return BCM_E_PARAM; 476 } 477 478 /* Call the BCM API with new format */ 479 rv = bcm_l2_replace_match(unit, flags, newmatch_addr, newmask_addr, 480 newreplace_addr, newreplace_mask_addr); 481 482 /* Transform the entry from the new format to old one */ 483 _bcm_compat6510out_l2_addr_t(newmatch_addr, match_addr); 484 _bcm_compat6510out_l2_addr_t(newmask_addr, mask_addr); 485 _bcm_compat6510out_l2_addr_t(newreplace_addr, replace_addr); 486 _bcm_compat6510out_l2_addr_t(newreplace_mask_addr, replace_mask_addr); 487 488 /* Deallocate memory*/ 489 sal_free(newmatch_addr); 490 sal_free(newmask_addr); 491 sal_free(newreplace_addr); 492 sal_free(newreplace_mask_addr); 493 494 return rv; 495 } 496 497 /* 498 * Function: bcm_compat6510_l2_stat_get 499 * 500 * Purpose: 501 * Compatibility function for RPC call to bcm_l2_stat_get. 502 * 503 * Parameters: 504 * unit - (IN) BCM device number. 505 * l2addr - (IN) l2 address entry with old format. 506 * stat - (IN) stat to collect. 507 * val - (OUT) stat value. 508 * 509 * Returns: 510 * BCM_E_XXX 511 */ 512 int 513 bcm_compat6510_l2_stat_get(int unit, 514 bcm_compat6510_l2_addr_t *l2addr, 515 bcm_l2_stat_t stat, uint64 *val) 516 { 517 int rv = BCM_E_NONE; 518 bcm_l2_addr_t *newl2addr = NULL; 519 520 if (NULL != l2addr) { 521 /* Create from heap to avoid the stack to bloat */ 522 newl2addr = (bcm_l2_addr_t *) 523 sal_alloc(sizeof(bcm_l2_addr_t), "New l2 addr"); 524 if (NULL == newl2addr) { 525 return BCM_E_MEMORY; 526 } 527 528 /* Transform the entry from the old format to new one */ 529 _bcm_compat6510in_l2_addr_t(l2addr, newl2addr); 530 } else { 531 return BCM_E_PARAM; 532 } 533 534 /* Call the BCM API with new format */ 535 rv = bcm_l2_stat_get(unit, newl2addr, stat, val); 536 537 /* Transform the entry from the new format to old one */ 538 _bcm_compat6510out_l2_addr_t(newl2addr, l2addr); 539 540 /* Deallocate memory*/ 541 sal_free(newl2addr); 542 543 return rv; 544 } 545 546 /* 547 * Function: bcm_compat6510_l2_stat_get32 548 * 549 * Purpose: 550 * Compatibility function for RPC call to bcm_l2_stat_get32. 551 * 552 * Parameters: 553 * unit - (IN) BCM device number. 554 * l2addr - (IN) l2 address entry with old format. 555 * stat - (IN) stat to collect. 556 * val - (OUT) stat value. 557 * 558 * Returns: 559 * BCM_E_XXX 560 */ 561 int 562 bcm_compat6510_l2_stat_get32(int unit, 563 bcm_compat6510_l2_addr_t *l2addr, 564 bcm_l2_stat_t stat, uint32 *val) 565 { 566 int rv = BCM_E_NONE; 567 bcm_l2_addr_t *newl2addr = NULL; 568 569 if (NULL != l2addr) { 570 /* Create from heap to avoid the stack to bloat */ 571 newl2addr = (bcm_l2_addr_t *) 572 sal_alloc(sizeof(bcm_l2_addr_t), "New l2 addr"); 573 if (NULL == newl2addr) { 574 return BCM_E_MEMORY; 575 } 576 577 /* Transform the entry from the old format to new one */ 578 _bcm_compat6510in_l2_addr_t(l2addr, newl2addr); 579 } else { 580 return BCM_E_PARAM; 581 } 582 583 /* Call the BCM API with new format */ 584 rv = bcm_l2_stat_get32(unit, newl2addr, stat, val); 585 586 /* Transform the entry from the new format to old one */ 587 _bcm_compat6510out_l2_addr_t(newl2addr, l2addr); 588 589 /* Deallocate memory*/ 590 sal_free(newl2addr); 591 592 return rv; 593 } 594 595 /* 596 * Function: bcm_compat6510_l2_stat_set 597 * 598 * Purpose: 599 * Compatibility function for RPC call to bcm_l2_stat_set. 600 * 601 * Parameters: 602 * unit - (IN) BCM device number. 603 * l2addr - (IN) l2 address entry with old format. 604 * stat - (IN) stat to set. 605 * val - (IN) stat value. 606 * 607 * Returns: 608 * BCM_E_XXX 609 */ 610 int 611 bcm_compat6510_l2_stat_set(int unit, 612 bcm_compat6510_l2_addr_t *l2addr, 613 bcm_l2_stat_t stat, uint64 val) 614 { 615 int rv = BCM_E_NONE; 616 bcm_l2_addr_t *newl2addr = NULL; 617 618 if (NULL != l2addr) { 619 /* Create from heap to avoid the stack to bloat */ 620 newl2addr = (bcm_l2_addr_t *) 621 sal_alloc(sizeof(bcm_l2_addr_t), "New l2 addr"); 622 if (NULL == newl2addr) { 623 return BCM_E_MEMORY; 624 } 625 626 /* Transform the entry from the old format to new one */ 627 _bcm_compat6510in_l2_addr_t(l2addr, newl2addr); 628 } else { 629 return BCM_E_PARAM; 630 } 631 632 /* Call the BCM API with new format */ 633 rv = bcm_l2_stat_set(unit, newl2addr, stat, val); 634 635 /* Transform the entry from the new format to old one */ 636 _bcm_compat6510out_l2_addr_t(newl2addr, l2addr); 637 638 /* Deallocate memory*/ 639 sal_free(newl2addr); 640 641 return rv; 642 } 643 644 /* 645 * Function: bcm_compat6510_l2_stat_set32 646 * 647 * Purpose: 648 * Compatibility function for RPC call to bcm_l2_stat_set32. 649 * 650 * Parameters: 651 * unit - (IN) BCM device number. 652 * l2addr - (IN) l2 address entry with old format. 653 * stat - (IN) stat to set. 654 * val - (IN) stat value. 655 * 656 * Returns: 657 * BCM_E_XXX 658 */ 659 int 660 bcm_compat6510_l2_stat_set32(int unit, 661 bcm_compat6510_l2_addr_t *l2addr, 662 bcm_l2_stat_t stat, uint32 val) 663 { 664 int rv = BCM_E_NONE; 665 bcm_l2_addr_t *newl2addr = NULL; 666 667 if (NULL != l2addr) { 668 /* Create from heap to avoid the stack to bloat */ 669 newl2addr = (bcm_l2_addr_t *) 670 sal_alloc(sizeof(bcm_l2_addr_t), "New l2 addr"); 671 if (NULL == newl2addr) { 672 return BCM_E_MEMORY; 673 } 674 675 /* Transform the entry from the old format to new one */ 676 _bcm_compat6510in_l2_addr_t(l2addr, newl2addr); 677 } else { 678 return BCM_E_PARAM; 679 } 680 681 /* Call the BCM API with new format */ 682 rv = bcm_l2_stat_set32(unit, newl2addr, stat, val); 683 684 /* Transform the entry from the new format to old one */ 685 _bcm_compat6510out_l2_addr_t(newl2addr, l2addr); 686 687 /* Deallocate memory*/ 688 sal_free(newl2addr); 689 690 return rv; 691 } 692 693 /* 694 * Function: bcm_compat6510_l2_stat_enable_set 695 * 696 * Purpose: 697 * Compatibility function for RPC call to bcm_l2_stat_enable_set. 698 * 699 * Parameters: 700 * unit - (IN) BCM device number. 701 * l2addr - (IN) l2 address entry with old format. 702 * enable - (IN) enable value. 703 * 704 * Returns: 705 * BCM_E_XXX 706 */ 707 int 708 bcm_compat6510_l2_stat_enable_set(int unit, 709 bcm_compat6510_l2_addr_t *l2addr, 710 int enable) 711 { 712 int rv = BCM_E_NONE; 713 bcm_l2_addr_t *newl2addr = NULL; 714 715 if (NULL != l2addr) { 716 /* Create from heap to avoid the stack to bloat */ 717 newl2addr = (bcm_l2_addr_t *) 718 sal_alloc(sizeof(bcm_l2_addr_t), "New l2 addr"); 719 if (NULL == newl2addr) { 720 return BCM_E_MEMORY; 721 } 722 723 /* Transform the entry from the old format to new one */ 724 _bcm_compat6510in_l2_addr_t(l2addr, newl2addr); 725 } else { 726 return BCM_E_PARAM; 727 } 728 729 /* Call the BCM API with new format */ 730 rv = bcm_l2_stat_enable_set(unit, newl2addr, enable); 731 732 /* Transform the entry from the new format to old one */ 733 _bcm_compat6510out_l2_addr_t(newl2addr, l2addr); 734 735 /* Deallocate memory*/ 736 sal_free(newl2addr); 737 738 return rv; 739 } 740 #endif /* BCM_RPC_SUPPORT */