compat_6515.c (49588B)
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.15 routines 8 */ 9 10 #ifdef BCM_RPC_SUPPORT 11 #include <shared/alloc.h> 12 #include <sal/core/libc.h> 13 #include <bcm/error.h> 14 #include <bcm_int/compat/compat_6515.h> 15 16 #ifdef INCLUDE_L3 17 /* 18 * Function: 19 * _bcm_compat6515in_mpls_tunnel_switch_t 20 * Purpose: 21 * Convert the bcm_mpls_tunnel_switch_t datatype from <=6.5.15 to 22 * SDK 6.5.15+ 23 * Parameters: 24 * from - (IN) The <=6.5.15 version of the datatype 25 * to - (OUT) The SDK 6.5.15+ version of the datatype 26 * Returns: 27 * Nothing 28 */ 29 STATIC void 30 _bcm_compat6515in_mpls_tunnel_switch_t( 31 bcm_compat6515_mpls_tunnel_switch_t *from, 32 bcm_mpls_tunnel_switch_t *to) 33 { 34 bcm_mpls_tunnel_switch_t_init(to); 35 to->flags = from->flags; 36 to->flags2 = from->flags2; 37 to->label = from->label; 38 to->second_label = from->second_label; 39 to->port = from->port; 40 to->action = from->action; 41 to->action_if_bos = from->action_if_bos; 42 to->action_if_not_bos = from->action_if_not_bos; 43 to->mc_group = from->mc_group; 44 to->exp_map = from->exp_map; 45 to->int_pri = from->int_pri; 46 to->policer_id = from->policer_id; 47 to->vpn = from->vpn; 48 sal_memcpy(&to->egress_label, &from->egress_label, sizeof(to->egress_label)); 49 to->egress_if = from->egress_if; 50 to->ingress_if = from->ingress_if; 51 to->mtu = from->mtu; 52 to->qos_map_id = from->qos_map_id; 53 to->failover_id = from->failover_id; 54 to->tunnel_id = from->tunnel_id; 55 to->failover_tunnel_id = from->failover_tunnel_id; 56 to->tunnel_if = from->tunnel_if; 57 to->egress_port = from->egress_port; 58 to->oam_global_context_id = from->oam_global_context_id; 59 to->class_id = from->class_id; 60 to->inlif_counting_profile = from->inlif_counting_profile; 61 to->ecn_map_id = from->ecn_map_id; 62 to->tunnel_term_ecn_map_id = from->tunnel_term_ecn_map_id; 63 } 64 65 /* 66 * Function: 67 * _bcm_compat6515out_mpls_tunnel_switch_t 68 * Purpose: 69 * Convert the bcm_mpls_tunnel_switch_t datatype from 6.5.15+ to 70 * <=6.5.15 71 * Parameters: 72 * from - (IN) The SDK 6.5.15+ version of the datatype 73 * to - (OUT) The <=6.5.15 version of the datatype 74 * Returns: 75 * Nothing 76 */ 77 STATIC void 78 _bcm_compat6515out_mpls_tunnel_switch_t( 79 bcm_mpls_tunnel_switch_t *from, 80 bcm_compat6515_mpls_tunnel_switch_t *to) 81 { 82 to->flags = from->flags; 83 to->flags2 = from->flags2; 84 to->label = from->label; 85 to->second_label = from->second_label; 86 to->port = from->port; 87 to->action = from->action; 88 to->action_if_bos = from->action_if_bos; 89 to->action_if_not_bos = from->action_if_not_bos; 90 to->mc_group = from->mc_group; 91 to->exp_map = from->exp_map; 92 to->int_pri = from->int_pri; 93 to->policer_id = from->policer_id; 94 to->vpn = from->vpn; 95 sal_memcpy(&to->egress_label, &from->egress_label, sizeof(to->egress_label)); 96 to->egress_if = from->egress_if; 97 to->ingress_if = from->ingress_if; 98 to->mtu = from->mtu; 99 to->qos_map_id = from->qos_map_id; 100 to->failover_id = from->failover_id; 101 to->tunnel_id = from->tunnel_id; 102 to->failover_tunnel_id = from->failover_tunnel_id; 103 to->tunnel_if = from->tunnel_if; 104 to->egress_port = from->egress_port; 105 to->oam_global_context_id = from->oam_global_context_id; 106 to->class_id = from->class_id; 107 to->inlif_counting_profile = from->inlif_counting_profile; 108 to->ecn_map_id = from->ecn_map_id; 109 to->tunnel_term_ecn_map_id = from->tunnel_term_ecn_map_id; 110 } 111 112 /* 113 * Function: 114 * bcm_compat6515_mpls_tunnel_switch_add 115 * Purpose: 116 * Compatibility function for RPC call to bcm_mpls_tunnel_switch_add. 117 * Parameters: 118 * unit - (IN) BCM device number. 119 * info - (IN) MPLS tunnel switch info. 120 * Returns: 121 * BCM_E_XXX 122 */ 123 int bcm_compat6515_mpls_tunnel_switch_add( 124 int unit, 125 bcm_compat6515_mpls_tunnel_switch_t *info) 126 { 127 int rv = 0; 128 bcm_mpls_tunnel_switch_t *new_info = NULL; 129 130 if (info != NULL) { 131 new_info = (bcm_mpls_tunnel_switch_t*) 132 sal_alloc(sizeof(bcm_mpls_tunnel_switch_t), "New tunnel switch info"); 133 if (new_info == NULL) { 134 return BCM_E_MEMORY; 135 } 136 137 _bcm_compat6515in_mpls_tunnel_switch_t(info, new_info); 138 } 139 140 rv = bcm_mpls_tunnel_switch_add(unit, new_info); 141 142 if (new_info != NULL) { 143 _bcm_compat6515out_mpls_tunnel_switch_t(new_info, info); 144 sal_free(new_info); 145 } 146 147 return rv; 148 } 149 150 /* 151 * Function: 152 * bcm_compat6515_mpls_tunnel_switch_delete 153 * Purpose: 154 * Compatibility function for RPC call to bcm_mpls_tunnel_switch_delete. 155 * Parameters: 156 * unit - (IN) BCM device number. 157 * info - (IN) MPLS tunnel switch info. 158 * Returns: 159 * BCM_E_XXX 160 */ 161 int bcm_compat6515_mpls_tunnel_switch_delete( 162 int unit, 163 bcm_compat6515_mpls_tunnel_switch_t *info) 164 { 165 int rv = 0; 166 bcm_mpls_tunnel_switch_t *new_info = NULL; 167 168 if (info != NULL) { 169 new_info = (bcm_mpls_tunnel_switch_t*) 170 sal_alloc(sizeof(bcm_mpls_tunnel_switch_t), "New tunnel switch info"); 171 if (new_info == NULL) { 172 return BCM_E_MEMORY; 173 } 174 175 _bcm_compat6515in_mpls_tunnel_switch_t(info, new_info); 176 } 177 178 rv = bcm_mpls_tunnel_switch_delete(unit, new_info); 179 180 if (new_info != NULL) { 181 _bcm_compat6515out_mpls_tunnel_switch_t(new_info, info); 182 sal_free(new_info); 183 } 184 185 return rv; 186 } 187 188 /* 189 * Function: 190 * bcm_compat6515_mpls_tunnel_switch_get 191 * Purpose: 192 * Compatibility function for RPC call to bcm_mpls_tunnel_switch_get. 193 * Parameters: 194 * unit - (IN) BCM device number. 195 * info - (IN) MPLS tunnel switch info. 196 * Returns: 197 * BCM_E_XXX 198 */ 199 int bcm_compat6515_mpls_tunnel_switch_get( 200 int unit, 201 bcm_compat6515_mpls_tunnel_switch_t *info) 202 { 203 int rv = 0; 204 bcm_mpls_tunnel_switch_t *new_info = NULL; 205 206 if (info != NULL) { 207 new_info = (bcm_mpls_tunnel_switch_t*) 208 sal_alloc(sizeof(bcm_mpls_tunnel_switch_t), "New tunnel switch info"); 209 if (new_info == NULL) { 210 return BCM_E_MEMORY; 211 } 212 213 _bcm_compat6515in_mpls_tunnel_switch_t(info, new_info); 214 } 215 216 rv = bcm_mpls_tunnel_switch_get(unit, new_info); 217 218 if (new_info != NULL) { 219 _bcm_compat6515out_mpls_tunnel_switch_t(new_info, info); 220 sal_free(new_info); 221 } 222 223 return rv; 224 } 225 /* 226 * Function: 227 * _bcm_compat6515in_ipmc_addr_t 228 * Purpose: 229 * Convert the bcm_ipmc_addr_t datatype from <=6.5.15 to 230 * SDK 6.5.15+ 231 * Parameters: 232 * from - (IN) The <=6.5.15 version of the datatype 233 * to - (OUT) The SDK 6.5.15+ version of the datatype 234 * Returns: 235 * Nothing 236 */ 237 STATIC void 238 _bcm_compat6515in_ipmc_addr_t( 239 bcm_compat6515_ipmc_addr_t *from, 240 bcm_ipmc_addr_t *to) 241 { 242 bcm_ipmc_addr_t_init(to); 243 to->s_ip_addr = from->s_ip_addr; 244 to->mc_ip_addr = from->mc_ip_addr; 245 sal_memcpy(&to->s_ip6_addr, &from->s_ip6_addr, sizeof(to->s_ip6_addr)); 246 sal_memcpy(&to->mc_ip6_addr, &from->mc_ip6_addr, sizeof(to->mc_ip6_addr)); 247 to->vid = from->vid; 248 to->vrf = from->vrf; 249 to->cos = from->cos; 250 to->ts = from->ts; 251 to->port_tgid = from->port_tgid; 252 to->v = from->v; 253 to->mod_id = from->mod_id; 254 to->group = from->group; 255 to->flags = from->flags; 256 to->lookup_class = from->lookup_class; 257 to->distribution_class = from->distribution_class; 258 to->l3a_intf = from->l3a_intf; 259 to->rp_id = from->rp_id; 260 to->s_ip_mask = from->s_ip_mask; 261 to->ing_intf = from->ing_intf; 262 to->mc_ip_mask = from->mc_ip_mask; 263 sal_memcpy(&to->mc_ip6_mask, &from->mc_ip6_mask, sizeof(to->mc_ip6_mask)); 264 to->group_l2 = from->group_l2; 265 to->stat_id = from->stat_id; 266 to->stat_pp_profile = from->stat_pp_profile; 267 sal_memcpy(&to->s_ip6_mask, &from->s_ip6_mask, sizeof(to->s_ip6_mask)); 268 to->priority = from->priority; 269 } 270 271 /* 272 * Function: 273 * _bcm_compat6515out_ipmc_addr_t 274 * Purpose: 275 * Convert the bcm_ipmc_addr_t datatype from 6.5.15+ to 276 * <=6.5.15 277 * Parameters: 278 * from - (IN) The SDK 6.5.15+ version of the datatype 279 * to - (OUT) The <=6.5.15 version of the datatype 280 * Returns: 281 * Nothing 282 */ 283 STATIC void 284 _bcm_compat6515out_ipmc_addr_t( 285 bcm_ipmc_addr_t *from, 286 bcm_compat6515_ipmc_addr_t *to) 287 { 288 to->s_ip_addr = from->s_ip_addr; 289 to->mc_ip_addr = from->mc_ip_addr; 290 sal_memcpy(&to->s_ip6_addr, &from->s_ip6_addr, sizeof(to->s_ip6_addr)); 291 sal_memcpy(&to->mc_ip6_addr, &from->mc_ip6_addr, sizeof(to->mc_ip6_addr)); 292 to->vid = from->vid; 293 to->vrf = from->vrf; 294 to->cos = from->cos; 295 to->ts = from->ts; 296 to->port_tgid = from->port_tgid; 297 to->v = from->v; 298 to->mod_id = from->mod_id; 299 to->group = from->group; 300 to->flags = from->flags; 301 to->lookup_class = from->lookup_class; 302 to->distribution_class = from->distribution_class; 303 to->l3a_intf = from->l3a_intf; 304 to->rp_id = from->rp_id; 305 to->s_ip_mask = from->s_ip_mask; 306 to->ing_intf = from->ing_intf; 307 to->mc_ip_mask = from->mc_ip_mask; 308 sal_memcpy(&to->mc_ip6_mask, &from->mc_ip6_mask, sizeof(to->mc_ip6_mask)); 309 to->group_l2 = from->group_l2; 310 to->stat_id = from->stat_id; 311 to->stat_pp_profile = from->stat_pp_profile; 312 sal_memcpy(&to->s_ip6_mask, &from->s_ip6_mask, sizeof(to->s_ip6_mask)); 313 to->priority = from->priority; 314 } 315 316 /* 317 * Function: 318 * bcm_compat6515_ipmc_add 319 * Purpose: 320 * Compatibility function for RPC call to bcm_ipmc_add. 321 * Parameters: 322 * unit - (IN) BCM device number. 323 * info - (IN) IPMC addr info. 324 * Returns: 325 * BCM_E_XXX 326 */ 327 int bcm_compat6515_ipmc_add( 328 int unit, 329 bcm_compat6515_ipmc_addr_t *info) 330 { 331 int rv = 0; 332 bcm_ipmc_addr_t *new_info = NULL; 333 334 if (info != NULL) { 335 new_info = (bcm_ipmc_addr_t*) 336 sal_alloc(sizeof(bcm_ipmc_addr_t), "New IPMC addr info"); 337 if (new_info == NULL) { 338 return BCM_E_MEMORY; 339 } 340 341 _bcm_compat6515in_ipmc_addr_t(info, new_info); 342 } 343 344 rv = bcm_ipmc_add(unit, new_info); 345 346 if (new_info != NULL) { 347 _bcm_compat6515out_ipmc_addr_t(new_info, info); 348 sal_free(new_info); 349 } 350 351 return rv; 352 } 353 354 /* 355 * Function: 356 * bcm_compat6515_ipmc_find 357 * Purpose: 358 * Compatibility function for RPC call to bcm_ipmc_find 359 * Parameters: 360 * unit - (IN) BCM device number. 361 * info - (IN) IPMC addr info. 362 * Returns: 363 * BCM_E_XXX 364 */ 365 int bcm_compat6515_ipmc_find( 366 int unit, 367 bcm_compat6515_ipmc_addr_t *info) 368 { 369 int rv = 0; 370 bcm_ipmc_addr_t *new_info = NULL; 371 372 if (info != NULL) { 373 new_info = (bcm_ipmc_addr_t*) 374 sal_alloc(sizeof(bcm_ipmc_addr_t), "IPMC addr info"); 375 if (new_info == NULL) { 376 return BCM_E_MEMORY; 377 } 378 379 _bcm_compat6515in_ipmc_addr_t(info, new_info); 380 } 381 382 rv = bcm_ipmc_find(unit, new_info); 383 384 if (new_info != NULL) { 385 _bcm_compat6515out_ipmc_addr_t(new_info, info); 386 sal_free(new_info); 387 } 388 389 return rv; 390 } 391 392 /* 393 * Function: 394 * bcm_compat6515_ipmc_remove 395 * Purpose: 396 * Compatibility function for RPC call to bcm_ipmc_remove. 397 * Parameters: 398 * unit - (IN) BCM device number. 399 * info - (IN) IPMC addr info. 400 * Returns: 401 * BCM_E_XXX 402 */ 403 int bcm_compat6515_ipmc_remove( 404 int unit, 405 bcm_compat6515_ipmc_addr_t *info) 406 { 407 int rv = 0; 408 bcm_ipmc_addr_t *new_info = NULL; 409 410 if (info != NULL) { 411 new_info = (bcm_ipmc_addr_t*) 412 sal_alloc(sizeof(bcm_ipmc_addr_t), "New IPMC addr info"); 413 if (new_info == NULL) { 414 return BCM_E_MEMORY; 415 } 416 417 _bcm_compat6515in_ipmc_addr_t(info, new_info); 418 } 419 420 rv = bcm_ipmc_remove(unit, new_info); 421 422 if (new_info != NULL) { 423 _bcm_compat6515out_ipmc_addr_t(new_info, info); 424 sal_free(new_info); 425 } 426 427 return rv; 428 } 429 430 #endif /* INCLUDE_L3 */ 431 432 /* 433 * Function: 434 * _bcm_compat6515in_port_match_info_t 435 * Purpose: 436 * Convert the bcm_port_match_info_t datatype from <=6.5.15 to 437 * SDK 6.5.15+ 438 * Parameters: 439 * from - (IN) The <=6.5.15 version of the datatype 440 * to - (OUT) The SDK 6.5.15+ version of the datatype 441 * Returns: 442 * Nothing 443 */ 444 STATIC void 445 _bcm_compat6515in_port_match_info_t( 446 bcm_compat6515_port_match_info_t *from, 447 bcm_port_match_info_t *to) 448 { 449 bcm_port_match_info_t_init(to); 450 451 to->match = from->match; 452 to->port = from->port; 453 to->match_vlan = from->match_vlan; 454 to->match_vlan_max = from->match_vlan_max; 455 to->match_inner_vlan = from->match_inner_vlan; 456 to->match_inner_vlan_max = from->match_inner_vlan_max; 457 to->match_tunnel_vlan = from->match_tunnel_vlan; 458 sal_memcpy(&to->match_tunnel_srcmac, &from->match_tunnel_srcmac, 459 sizeof(to->match_tunnel_srcmac)); 460 to->match_label = from->match_label; 461 to->flags = from->flags; 462 to->match_pon_tunnel = from->match_pon_tunnel; 463 to->match_ethertype = from->match_ethertype; 464 to->match_pcp = from->match_pcp; 465 to->action = from->action; 466 to->extended_port_vid = from->extended_port_vid; 467 to->vpn = from->vpn; 468 to->niv_port_vif = from->niv_port_vif; 469 to->isid = from->isid; 470 } 471 472 /* 473 * Function: 474 * _bcm_compat6515out_port_match_info_t 475 * Purpose: 476 * Convert the bcm_port_match_info_t datatype from 6.5.15+ to 477 * <=6.5.15 478 * Parameters: 479 * from - (IN) The SDK 6.5.15+ version of the datatype 480 * to - (OUT) The <=6.5.15 version of the datatype 481 * Returns: 482 * Nothing 483 */ 484 STATIC void 485 _bcm_compat6515out_port_match_info_t( 486 bcm_port_match_info_t *from, 487 bcm_compat6515_port_match_info_t *to) 488 { 489 to->match = from->match; 490 to->port = from->port; 491 to->match_vlan = from->match_vlan; 492 to->match_vlan_max = from->match_vlan_max; 493 to->match_inner_vlan = from->match_inner_vlan; 494 to->match_inner_vlan_max = from->match_inner_vlan_max; 495 to->match_tunnel_vlan = from->match_tunnel_vlan; 496 sal_memcpy(&to->match_tunnel_srcmac, &from->match_tunnel_srcmac, 497 sizeof(to->match_tunnel_srcmac)); 498 to->match_label = from->match_label; 499 to->flags = from->flags; 500 to->match_pon_tunnel = from->match_pon_tunnel; 501 to->match_ethertype = from->match_ethertype; 502 to->match_pcp = from->match_pcp; 503 to->action = from->action; 504 to->extended_port_vid = from->extended_port_vid; 505 to->vpn = from->vpn; 506 to->niv_port_vif = from->niv_port_vif; 507 to->isid = from->isid; 508 } 509 510 /* 511 * Function: 512 * bcm_compat6515_port_match_add 513 * Purpose: 514 * Compatibility function for RPC call to bcm_port_match_add. 515 * Parameters: 516 * unit - (IN) BCM device number. 517 * port - (IN) Port or gport 518 * match -(IN) Match criteria 519 * Returns: 520 * BCM_E_XXX 521 */ 522 int bcm_compat6515_port_match_add( 523 int unit, 524 bcm_gport_t port, 525 bcm_compat6515_port_match_info_t *match) 526 { 527 int rv = 0; 528 bcm_port_match_info_t *new_match = NULL; 529 530 if (match != NULL) { 531 new_match = (bcm_port_match_info_t *) 532 sal_alloc(sizeof(bcm_port_match_info_t), "New port match info"); 533 if (new_match == NULL) { 534 return BCM_E_MEMORY; 535 } 536 _bcm_compat6515in_port_match_info_t(match, new_match); 537 } 538 539 rv = bcm_port_match_add(unit, port, new_match); 540 541 if (new_match != NULL) { 542 sal_free(new_match); 543 } 544 545 return rv; 546 } 547 548 /* 549 * Function: 550 * bcm_compat6515_port_match_delete 551 * Purpose: 552 * Compatibility function for RPC call to bcm_port_match_delete. 553 * Parameters: 554 * unit - (IN) BCM device number. 555 * port - (IN) Port or gport 556 * match -(IN) Match criteria 557 * Returns: 558 * BCM_E_XXX 559 */ 560 int bcm_compat6515_port_match_delete( 561 int unit, 562 bcm_gport_t port, 563 bcm_compat6515_port_match_info_t *match) 564 { 565 int rv = 0; 566 bcm_port_match_info_t *new_match = NULL; 567 568 if (match != NULL) { 569 new_match = (bcm_port_match_info_t *) 570 sal_alloc(sizeof(bcm_port_match_info_t), "New port match info"); 571 if (new_match == NULL) { 572 return BCM_E_MEMORY; 573 } 574 _bcm_compat6515in_port_match_info_t(match, new_match); 575 } 576 577 rv = bcm_port_match_delete(unit, port, new_match); 578 579 if (new_match != NULL) { 580 sal_free(new_match); 581 } 582 583 return rv; 584 } 585 586 /* 587 * Function: 588 * bcm_compat6515_port_match_replace 589 * Purpose: 590 * Compatibility function for RPC call to bcm_port_match_replace. 591 * Parameters: 592 * unit - (IN) BCM device number. 593 * port - (IN) Port or gport 594 * old_match - (IN) Old match criteria 595 * new_match - (IN) New match criteria 596 * Returns: 597 * BCM_E_XXX 598 */ 599 int bcm_compat6515_port_match_replace( 600 int unit, 601 bcm_gport_t port, 602 bcm_compat6515_port_match_info_t *old_match, 603 bcm_compat6515_port_match_info_t *new_match) 604 { 605 int rv = 0; 606 bcm_port_match_info_t *new_old_match = NULL; 607 bcm_port_match_info_t *new_new_match = NULL; 608 609 if (old_match != NULL) { 610 new_old_match = (bcm_port_match_info_t *) 611 sal_alloc(sizeof(bcm_port_match_info_t), "New port match info"); 612 if (new_old_match == NULL) { 613 return BCM_E_MEMORY; 614 } 615 _bcm_compat6515in_port_match_info_t(old_match, new_old_match); 616 } 617 if (new_match != NULL) { 618 new_new_match = (bcm_port_match_info_t *) 619 sal_alloc(sizeof(bcm_port_match_info_t), "New port match info"); 620 if (new_new_match == NULL) { 621 sal_free(new_old_match); 622 return BCM_E_MEMORY; 623 } 624 _bcm_compat6515in_port_match_info_t(new_match, new_new_match); 625 } 626 627 rv = bcm_port_match_replace(unit, port, new_old_match, new_new_match); 628 629 if (new_old_match != NULL) { 630 sal_free(new_old_match); 631 } 632 if (new_new_match != NULL) { 633 sal_free(new_new_match); 634 } 635 636 return rv; 637 } 638 639 /* 640 * Function: 641 * bcm_compat6515_port_match_multi_get 642 * Purpose: 643 * Compatibility function for RPC call to bcm_port_match_multi_get. 644 * Parameters: 645 * unit - (IN) BCM device number. 646 * port - (IN) Port or gport 647 * size - (IN) Number of elements in match array 648 * match_array - (OUT) Match array 649 * count - (OUT) Match count 650 * Returns: 651 * BCM_E_XXX 652 */ 653 int bcm_compat6515_port_match_multi_get( 654 int unit, 655 bcm_gport_t port, 656 int size, 657 bcm_compat6515_port_match_info_t *match_array, 658 int *count) 659 { 660 int rv = 0, i = 0; 661 bcm_port_match_info_t *new_match_array = NULL; 662 663 if (match_array != NULL) { 664 new_match_array = (bcm_port_match_info_t *) 665 sal_alloc(size * sizeof(bcm_port_match_info_t), 666 "New port match info array"); 667 if (new_match_array == NULL) { 668 return BCM_E_MEMORY; 669 } 670 } 671 672 rv = bcm_port_match_multi_get(unit, port, size, new_match_array, count); 673 674 if (new_match_array != NULL) { 675 for (i = 0; i < size; i++) { 676 _bcm_compat6515out_port_match_info_t(&new_match_array[i], 677 &match_array[i]); 678 } 679 sal_free(new_match_array); 680 } 681 682 return rv; 683 } 684 685 /* 686 * Function: 687 * bcm_compat6515_port_match_set 688 * Purpose: 689 * Compatibility function for RPC call to bcm_port_match_set. 690 * Parameters: 691 * unit - (IN) BCM device number. 692 * port - (IN) Port or gport 693 * size - (IN) Number of elements in match array 694 * match_array - (IN) Match array 695 * Returns: 696 * BCM_E_XXX 697 */ 698 int bcm_compat6515_port_match_set( 699 int unit, 700 bcm_gport_t port, 701 int size, 702 bcm_compat6515_port_match_info_t *match_array) 703 { 704 int rv = 0, i = 0; 705 bcm_port_match_info_t *new_match_array = NULL; 706 707 if (match_array != NULL) { 708 new_match_array = (bcm_port_match_info_t *) 709 sal_alloc(size * sizeof(bcm_port_match_info_t), 710 "New port match info array"); 711 if (new_match_array == NULL) { 712 return BCM_E_MEMORY; 713 } 714 for (i = 0; i < size; i++) { 715 _bcm_compat6515in_port_match_info_t(&match_array[i], 716 &new_match_array[i]); 717 } 718 } 719 720 rv = bcm_port_match_set(unit, port, size, new_match_array); 721 722 if (new_match_array != NULL) { 723 sal_free(new_match_array); 724 } 725 726 return rv; 727 } 728 /* 729 * Function: 730 * _bcm_compat6515in_bcm_port_resource_t 731 * Purpose: 732 * Convert the bcm_mpls_tunnel_switch_t datatype from <=6.5.15 to 733 * SDK 6.5.15+ 734 * Parameters: 735 * from - (IN) The <=6.5.15 version of the datatype 736 * to - (OUT) The SDK 6.5.15+ version of the datatype 737 * Returns: 738 * Nothing 739 */ 740 STATIC void 741 _bcm_compat6515in_port_resource_t( 742 bcm_compat6515_port_resource_t *from, 743 bcm_port_resource_t *to) 744 { 745 bcm_port_resource_t_init(to); 746 to->flags = from->flags; 747 to->port = from->port; 748 to->physical_port = from->physical_port; 749 to->speed = from->speed; 750 to->lanes = from->lanes; 751 to->encap = from->encap; 752 to->fec_type = from->fec_type; 753 to->phy_lane_config = from->phy_lane_config; 754 to->link_training = from->link_training; 755 }; 756 /* 757 * Function: 758 * bcm_compat6515_port_resource_default_get 759 * Purpose: 760 * Compatibility function for RPC call to bcm_port_match_set. 761 * Parameters: 762 * unit - (IN) BCM device number. 763 * port - (IN) Port or gport 764 * flags - (IN)Flags 765 * match_array - (IN) Match array 766 * Returns: 767 * BCM_E_XXX 768 */ 769 int bcm_compat6515_port_resource_default_get( 770 int unit, 771 bcm_gport_t port, 772 int flags, 773 bcm_compat6515_port_resource_t *match_array) 774 { 775 int rv = 0, i = 0; 776 bcm_port_resource_t *new_match_array = NULL; 777 778 if (match_array != NULL) { 779 new_match_array = (bcm_port_resource_t *) 780 sal_alloc(sizeof(bcm_port_resource_t), 781 "New port match info array"); 782 if (new_match_array == NULL) { 783 return BCM_E_MEMORY; 784 } 785 _bcm_compat6515in_port_resource_t(&match_array[i], 786 &new_match_array[i]); 787 } 788 789 rv = bcm_port_resource_default_get(unit, port, flags, new_match_array); 790 791 if (new_match_array != NULL) { 792 sal_free(new_match_array); 793 } 794 795 return rv; 796 } 797 798 799 /* 800 * Function: 801 * bcm_compat6515_port_resource_get 802 * Purpose: 803 * Compatibility function for RPC call to bcm_port_resource_get. 804 * Parameters: 805 * unit - (IN) BCM device number. 806 * port - (IN) Port or gport 807 * match_array - (IN) Match array 808 * Returns: 809 * BCM_E_XXX 810 */ 811 int bcm_compat6515_port_resource_get( 812 int unit, 813 bcm_gport_t port, 814 bcm_compat6515_port_resource_t *match_array) 815 { 816 int rv = 0, i = 0; 817 bcm_port_resource_t *new_match_array = NULL; 818 819 if (match_array != NULL) { 820 new_match_array = (bcm_port_resource_t *) 821 sal_alloc(sizeof(bcm_port_resource_t), 822 "New port match info array"); 823 if (new_match_array == NULL) { 824 return BCM_E_MEMORY; 825 } 826 _bcm_compat6515in_port_resource_t(&match_array[i], 827 &new_match_array[i]); 828 } 829 830 rv = bcm_port_resource_get(unit, port, new_match_array); 831 832 if (new_match_array != NULL) { 833 sal_free(new_match_array); 834 } 835 836 return rv; 837 } 838 839 /* 840 * Function: 841 * bcm_compat6515_port_resource_set 842 * Purpose: 843 * Compatibility function for RPC call to bcm_port_resource_set. 844 * Parameters: 845 * unit - (IN) BCM device number. 846 * port - (IN) Port or gport 847 * match_array - (IN) Match array 848 * Returns: 849 * BCM_E_XXX 850 */ 851 int bcm_compat6515_port_resource_set( 852 int unit, 853 bcm_gport_t port, 854 bcm_compat6515_port_resource_t *match_array) 855 { 856 int rv = 0, i = 0; 857 bcm_port_resource_t *new_match_array = NULL; 858 859 if (match_array != NULL) { 860 new_match_array = (bcm_port_resource_t *) 861 sal_alloc(sizeof(bcm_port_resource_t), 862 "New port match info array"); 863 if (new_match_array == NULL) { 864 return BCM_E_MEMORY; 865 } 866 _bcm_compat6515in_port_resource_t(&match_array[i], 867 &new_match_array[i]); 868 } 869 870 rv = bcm_port_resource_set(unit, port, new_match_array); 871 872 if (new_match_array != NULL) { 873 sal_free(new_match_array); 874 } 875 876 return rv; 877 } 878 879 880 /* 881 * Function: 882 * bcm_compat6515_port_resource_speed_set_ 883 * Purpose: 884 * Compatibility function for RPC call to port_resource_speed_set. 885 * Parameters: 886 * unit - (IN) BCM device number. 887 * port - (IN) Port or gport 888 * match_array - (IN) Match array 889 * Returns: 890 * BCM_E_XXX 891 */ 892 int bcm_compat6515_port_resource_speed_set( 893 int unit, 894 bcm_gport_t port, 895 bcm_compat6515_port_resource_t *match_array) 896 { 897 int rv = 0, i = 0; 898 bcm_port_resource_t *new_match_array = NULL; 899 900 if (match_array != NULL) { 901 new_match_array = (bcm_port_resource_t *) 902 sal_alloc(sizeof(bcm_port_resource_t), 903 "New port match info array"); 904 if (new_match_array == NULL) { 905 return BCM_E_MEMORY; 906 } 907 _bcm_compat6515in_port_resource_t(&match_array[i], 908 &new_match_array[i]); 909 } 910 911 rv = bcm_port_resource_speed_set(unit, port, new_match_array); 912 913 if (new_match_array != NULL) { 914 sal_free(new_match_array); 915 } 916 917 return rv; 918 } 919 920 /* 921 * Function: 922 * bcm_compat6515_port_resource_speed_get_ 923 * Purpose: 924 * Compatibility function for RPC call to port_resource_speed_get. 925 * Parameters: 926 * unit - (IN) BCM device number. 927 * port - (IN) Port or gport 928 * match_array - (IN) Match array 929 * Returns: 930 * BCM_E_XXX 931 */ 932 int bcm_compat6515_port_resource_speed_get( 933 int unit, 934 bcm_gport_t port, 935 bcm_compat6515_port_resource_t *match_array) 936 { 937 int rv = 0, i = 0; 938 bcm_port_resource_t *new_match_array = NULL; 939 940 if (match_array != NULL) { 941 new_match_array = (bcm_port_resource_t *) 942 sal_alloc(sizeof(bcm_port_resource_t), 943 "New port match info array"); 944 if (new_match_array == NULL) { 945 return BCM_E_MEMORY; 946 } 947 _bcm_compat6515in_port_resource_t(&match_array[i], 948 &new_match_array[i]); 949 } 950 951 rv = bcm_port_resource_speed_get(unit, port, new_match_array); 952 953 if (new_match_array != NULL) { 954 sal_free(new_match_array); 955 } 956 957 return rv; 958 } 959 960 /* 961 * Function: 962 * bcm_compat6515_port_resource_speed_config_validate 963 * Purpose: 964 * Compatibility function for RPC call to port_resource_speed_config_validate. 965 * Parameters: 966 * unit - (IN) BCM device number. 967 * match_array - (IN) Match array 968 * pbmp - (IN) port pbmp 969 * Returns: 970 * BCM_E_XXX 971 */ 972 int bcm_compat6515_port_resource_speed_config_validate( 973 int unit, 974 bcm_compat6515_port_resource_t *match_array, 975 bcm_pbmp_t *pbmp) 976 { 977 int rv = 0, i = 0; 978 bcm_port_resource_t *new_match_array = NULL; 979 980 if (match_array != NULL) { 981 new_match_array = (bcm_port_resource_t *) 982 sal_alloc(sizeof(bcm_port_resource_t), 983 "New port match info array"); 984 if (new_match_array == NULL) { 985 return BCM_E_MEMORY; 986 } 987 _bcm_compat6515in_port_resource_t(&match_array[i], 988 &new_match_array[i]); 989 } 990 991 rv = bcm_port_resource_speed_config_validate(unit,new_match_array,pbmp); 992 993 if (new_match_array != NULL) { 994 sal_free(new_match_array); 995 } 996 997 return rv; 998 } 999 1000 1001 /* 1002 * Function: 1003 * bcm_compat6515_port_resource_multi_set 1004 * Purpose: 1005 * Compatibility function for RPC call to port_resource_speed_get. 1006 * Parameters: 1007 * unit - (IN) BCM device number. 1008 * port - (IN) Port or gport 1009 * match_array - (IN) Match array 1010 * Returns: 1011 * BCM_E_XXX 1012 */ 1013 int bcm_compat6515_port_resource_multi_set( 1014 int unit, 1015 int nport, 1016 bcm_compat6515_port_resource_t *match_array) 1017 { 1018 int rv = 0, i = 0; 1019 bcm_port_resource_t *new_match_array = NULL; 1020 1021 if (match_array != NULL) { 1022 new_match_array = (bcm_port_resource_t *) 1023 sal_alloc(nport * sizeof(bcm_port_resource_t), 1024 "New port match info array"); 1025 if (new_match_array == NULL) { 1026 return BCM_E_MEMORY; 1027 } 1028 for (i = 0 ; i < nport; i++) { 1029 _bcm_compat6515in_port_resource_t(&match_array[i], 1030 &new_match_array[i]); 1031 } 1032 } 1033 1034 rv = bcm_port_resource_multi_set(unit, nport, new_match_array); 1035 1036 if (new_match_array != NULL) { 1037 sal_free(new_match_array); 1038 } 1039 1040 return rv; 1041 } 1042 1043 1044 /* 1045 * Function: 1046 * bcm_compat6515_port_resource_speed_multi_set 1047 * Purpose: 1048 * Compatibility function for RPC call to port_resource_speed_multi_set. 1049 * Parameters: 1050 * unit - (IN) BCM device number. 1051 * port - (IN) Port or gport 1052 * match_array - (IN) Match array 1053 * Returns: 1054 * BCM_E_XXX 1055 */ 1056 int bcm_compat6515_port_resource_speed_multi_set( 1057 int unit, 1058 int nport, 1059 bcm_compat6515_port_resource_t *match_array) 1060 { 1061 int rv = 0, i = 0; 1062 bcm_port_resource_t *new_match_array = NULL; 1063 1064 if (match_array != NULL) { 1065 new_match_array = (bcm_port_resource_t *) 1066 sal_alloc(nport * sizeof(bcm_port_resource_t), 1067 "New port match info array"); 1068 if (new_match_array == NULL) { 1069 return BCM_E_MEMORY; 1070 } 1071 for (i = 0 ; i < nport; i++) { 1072 _bcm_compat6515in_port_resource_t(&match_array[i], 1073 &new_match_array[i]); 1074 } 1075 } 1076 1077 rv = bcm_port_resource_speed_multi_set(unit, nport, new_match_array); 1078 1079 if (new_match_array != NULL) { 1080 sal_free(new_match_array); 1081 } 1082 1083 return rv; 1084 } 1085 #ifdef INCLUDE_L3 1086 /* 1087 * Function: 1088 * _bcm_compat6515in_l3_egress_t 1089 * Purpose: 1090 * Convert the bcm_l3_egress_t datatype from 6.5.15 to 6.5.16 1091 * Parameters: 1092 * from - (IN) The 6.5.15 version of the datatype 1093 * to - (OUT) The SDK 6.5.16 version of the datatype 1094 * Returns: 1095 * Nothing 1096 */ 1097 STATIC void 1098 _bcm_compat6515in_l3_egress_t( 1099 bcm_compat6515_l3_egress_t *from, 1100 bcm_l3_egress_t *to) 1101 { 1102 int i = 0; 1103 bcm_l3_egress_t_init(to); 1104 to->flags = from->flags; 1105 to->flags2 = from->flags2; 1106 to->intf = from->intf; 1107 sal_memcpy(to->mac_addr, from->mac_addr, sizeof(bcm_mac_t)); 1108 to->vlan = from->vlan; 1109 to->module = from->module; 1110 to->port = from->port; 1111 to->trunk = from->trunk; 1112 to->mpls_flags = from->mpls_flags; 1113 to->mpls_label = from->mpls_label; 1114 to->mpls_action = from->mpls_action; 1115 to->mpls_qos_map_id = from->mpls_qos_map_id; 1116 to->mpls_ttl = from->mpls_ttl; 1117 to->mpls_pkt_pri = from->mpls_pkt_pri; 1118 to->mpls_pkt_cfi = from->mpls_pkt_cfi; 1119 to->mpls_exp = from->mpls_exp; 1120 to->qos_map_id = from->qos_map_id; 1121 to->encap_id = from->encap_id; 1122 to->failover_id = from->failover_id; 1123 to->failover_if_id = from->failover_if_id; 1124 to->failover_mc_group = from->failover_mc_group; 1125 to->dynamic_scaling_factor = from->dynamic_scaling_factor; 1126 to->dynamic_load_weight = from->dynamic_load_weight; 1127 to->dynamic_queue_size_weight = from->dynamic_queue_size_weight; 1128 to->intf_class = from->intf_class; 1129 to->multicast_flags = from->multicast_flags; 1130 to->oam_global_context_id = from->oam_global_context_id; 1131 to->vntag = from->vntag; 1132 to->vntag_action = from->vntag_action; 1133 to->etag = from->etag; 1134 to->etag_action = from->etag_action; 1135 to->flow_handle = from->flow_handle; 1136 to->flow_option_handle = from->flow_option_handle; 1137 to->flow_label_option_handle = from->flow_label_option_handle; 1138 for (i = 0; i < BCM_FLOW_MAX_NOF_LOGICAL_FIELDS; i++) { 1139 to->logical_fields[i] = from->logical_fields[i]; 1140 } 1141 to->num_of_fields = from->num_of_fields; 1142 to->counting_profile = from->counting_profile; 1143 to->mpls_ecn_map_id = from->mpls_ecn_map_id; 1144 to->urpf_mode = from->urpf_mode; 1145 to->mc_group = from->mc_group; 1146 sal_memcpy(to->src_mac_addr, from->src_mac_addr, sizeof(bcm_mac_t)); 1147 to->hierarchical_gport = from->hierarchical_gport; 1148 to->stat_id = from->stat_id; 1149 to->stat_pp_profile = from->stat_pp_profile; 1150 } 1151 1152 /* 1153 * Function: 1154 * _bcm_compat6515out_l3_egress_t 1155 * Purpose: 1156 * Convert the bcm_l3_egress_t datatype from 6.5.16 to 6.5.15 1157 * Parameters: 1158 * from - (IN) The SDK 6.5.16 version of the datatype 1159 * to - (OUT) The 6.5.15 version of the datatype 1160 * Returns: 1161 * Nothing 1162 */ 1163 STATIC void 1164 _bcm_compat6515out_l3_egress_t( 1165 bcm_l3_egress_t *from, 1166 bcm_compat6515_l3_egress_t *to) 1167 { 1168 int i = 0; 1169 to->flags = from->flags; 1170 to->flags2 = from->flags2; 1171 to->intf = from->intf; 1172 sal_memcpy(to->mac_addr, from->mac_addr, sizeof(bcm_mac_t)); 1173 to->vlan = from->vlan; 1174 to->module = from->module; 1175 to->port = from->port; 1176 to->trunk = from->trunk; 1177 to->mpls_flags = from->mpls_flags; 1178 to->mpls_label = from->mpls_label; 1179 to->mpls_action = from->mpls_action; 1180 to->mpls_qos_map_id = from->mpls_qos_map_id; 1181 to->mpls_ttl = from->mpls_ttl; 1182 to->mpls_pkt_pri = from->mpls_pkt_pri; 1183 to->mpls_pkt_cfi = from->mpls_pkt_cfi; 1184 to->mpls_exp = from->mpls_exp; 1185 to->qos_map_id = from->qos_map_id; 1186 to->encap_id = from->encap_id; 1187 to->failover_id = from->failover_id; 1188 to->failover_if_id = from->failover_if_id; 1189 to->failover_mc_group = from->failover_mc_group; 1190 to->dynamic_scaling_factor = from->dynamic_scaling_factor; 1191 to->dynamic_load_weight = from->dynamic_load_weight; 1192 to->dynamic_queue_size_weight = from->dynamic_queue_size_weight; 1193 to->intf_class = from->intf_class; 1194 to->multicast_flags = from->multicast_flags; 1195 to->oam_global_context_id = from->oam_global_context_id; 1196 to->vntag = from->vntag; 1197 to->vntag_action = from->vntag_action; 1198 to->etag = from->etag; 1199 to->etag_action = from->etag_action; 1200 to->flow_handle = from->flow_handle; 1201 to->flow_option_handle = from->flow_option_handle; 1202 to->flow_label_option_handle = from->flow_label_option_handle; 1203 for (i = 0; i < BCM_FLOW_MAX_NOF_LOGICAL_FIELDS; i++) { 1204 to->logical_fields[i] = from->logical_fields[i]; 1205 } 1206 to->num_of_fields = from->num_of_fields; 1207 to->counting_profile = from->counting_profile; 1208 to->mpls_ecn_map_id = from->mpls_ecn_map_id; 1209 to->urpf_mode = from->urpf_mode; 1210 to->mc_group = from->mc_group; 1211 sal_memcpy(to->src_mac_addr, from->src_mac_addr, sizeof(bcm_mac_t)); 1212 to->hierarchical_gport = from->hierarchical_gport; 1213 to->stat_id = from->stat_id; 1214 to->stat_pp_profile = from->stat_pp_profile; 1215 } 1216 1217 int bcm_compat6515_l3_egress_find( 1218 int unit, 1219 bcm_compat6515_l3_egress_t *egr, 1220 bcm_if_t *intf) 1221 { 1222 int rv = 0; 1223 bcm_l3_egress_t *new_egr = NULL; 1224 1225 if (egr != NULL) { 1226 new_egr = (bcm_l3_egress_t*) 1227 sal_alloc(sizeof(bcm_l3_egress_t), "Egr info"); 1228 if (new_egr == NULL) { 1229 return BCM_E_MEMORY; 1230 } 1231 _bcm_compat6515in_l3_egress_t(egr, new_egr); 1232 } 1233 1234 rv = bcm_l3_egress_find(unit, new_egr, intf); 1235 1236 if (new_egr != NULL) { 1237 sal_free(new_egr); 1238 } 1239 1240 return rv; 1241 } 1242 1243 int bcm_compat6515_l3_egress_create( 1244 int unit, 1245 uint32 flags, 1246 bcm_compat6515_l3_egress_t *egr, 1247 bcm_if_t *if_id) 1248 { 1249 int rv = 0; 1250 bcm_l3_egress_t *new_egr = NULL; 1251 1252 if (egr != NULL) { 1253 new_egr = (bcm_l3_egress_t*) 1254 sal_alloc(sizeof(bcm_l3_egress_t), "Egr info"); 1255 if (new_egr == NULL) { 1256 return BCM_E_MEMORY; 1257 } 1258 _bcm_compat6515in_l3_egress_t(egr, new_egr); 1259 } 1260 1261 rv = bcm_l3_egress_create(unit, flags, new_egr, if_id); 1262 1263 if (new_egr != NULL) { 1264 if (rv == BCM_E_NONE) { 1265 _bcm_compat6515out_l3_egress_t(new_egr, egr); 1266 } 1267 sal_free(new_egr); 1268 1269 } 1270 1271 return rv; 1272 } 1273 1274 int bcm_compat6515_l3_egress_get( 1275 int unit, 1276 bcm_if_t intf, 1277 bcm_compat6515_l3_egress_t *egr) 1278 { 1279 int rv = 0; 1280 bcm_l3_egress_t *new_egr = NULL; 1281 1282 if (egr != NULL) { 1283 new_egr = (bcm_l3_egress_t*) 1284 sal_alloc(sizeof(bcm_l3_egress_t), "Egr info"); 1285 if (new_egr == NULL) { 1286 return BCM_E_MEMORY; 1287 } 1288 _bcm_compat6515in_l3_egress_t(egr, new_egr); 1289 } 1290 1291 rv = bcm_l3_egress_get(unit, intf, new_egr); 1292 1293 if (new_egr != NULL) { 1294 if (rv == BCM_E_NONE) { 1295 _bcm_compat6515out_l3_egress_t(new_egr, egr); 1296 } 1297 sal_free(new_egr); 1298 } 1299 1300 return rv; 1301 } 1302 1303 int bcm_compat6515_failover_egress_set( 1304 int unit, 1305 bcm_if_t intf, 1306 bcm_compat6515_l3_egress_t *failover_egr) 1307 { 1308 int rv = 0; 1309 bcm_l3_egress_t *new_failover_egr = NULL; 1310 1311 if (failover_egr != NULL) { 1312 new_failover_egr = (bcm_l3_egress_t*) 1313 sal_alloc(sizeof(bcm_l3_egress_t), "Egr failover"); 1314 if (new_failover_egr == NULL) { 1315 return BCM_E_MEMORY; 1316 } 1317 _bcm_compat6515in_l3_egress_t(failover_egr, new_failover_egr); 1318 } 1319 1320 rv = bcm_failover_egress_set(unit, intf, new_failover_egr); 1321 1322 if (new_failover_egr != NULL) { 1323 if (rv == BCM_E_NONE) { 1324 _bcm_compat6515out_l3_egress_t(new_failover_egr, failover_egr); 1325 } 1326 sal_free(new_failover_egr); 1327 1328 } 1329 1330 return rv; 1331 } 1332 1333 int bcm_compat6515_failover_egress_get( 1334 int unit, 1335 bcm_if_t intf, 1336 bcm_compat6515_l3_egress_t *failover_egr) 1337 { 1338 int rv = 0; 1339 bcm_l3_egress_t *new_failover_egr = NULL; 1340 1341 if (failover_egr != NULL) { 1342 new_failover_egr = (bcm_l3_egress_t*) 1343 sal_alloc(sizeof(bcm_l3_egress_t), "Egr failover"); 1344 if (new_failover_egr == NULL) { 1345 return BCM_E_MEMORY; 1346 } 1347 _bcm_compat6515in_l3_egress_t(failover_egr, new_failover_egr); 1348 } 1349 1350 rv = bcm_failover_egress_get(unit, intf, new_failover_egr); 1351 1352 if (new_failover_egr != NULL) { 1353 if (rv == BCM_E_NONE) { 1354 _bcm_compat6515out_l3_egress_t(new_failover_egr, failover_egr); 1355 } 1356 sal_free(new_failover_egr); 1357 1358 } 1359 1360 return rv; 1361 } 1362 /* 1363 * Function: 1364 * _bcm_compat6515in_tunnel_terminator_t 1365 * Purpose: 1366 * Convert bcm_tunnel_terminator_t datatype from 6.5.15 to 6.5.16 1367 * Parameters: 1368 * from - (IN) The 6.5.15 version of the datatype 1369 * to - (OUT) The SDK 6.5.16 version of the datatype 1370 * Returns: 1371 * Nothing 1372 */ 1373 STATIC void 1374 _bcm_compat6515in_tunnel_terminator_t( 1375 bcm_compat6515_tunnel_terminator_t *from, 1376 bcm_tunnel_terminator_t *to) 1377 { 1378 bcm_tunnel_terminator_t_init(to); 1379 to->flags = from->flags; 1380 to->multicast_flag = from->multicast_flag; 1381 to->vrf = from->vrf; 1382 to->sip = from->sip; 1383 to->dip = from-> dip; 1384 to->sip_mask = from->sip_mask; 1385 to->dip_mask = from->dip_mask; 1386 sal_memcpy(to->sip6, from->sip6, sizeof(bcm_ip6_t)); 1387 sal_memcpy(to->dip6, from->dip6, sizeof(bcm_ip6_t)); 1388 sal_memcpy(to->sip6_mask, from->sip6_mask, sizeof(bcm_ip6_t)); 1389 sal_memcpy(to->dip6_mask, from->dip6_mask, sizeof(bcm_ip6_t)); 1390 to->udp_dst_port = from->udp_dst_port; 1391 to->udp_src_port = from->udp_src_port; 1392 to->type = from->type; 1393 to->pbmp = from->pbmp; 1394 to->vlan = from->vlan; 1395 to->remote_port = from->remote_port; 1396 to->tunnel_id = from->tunnel_id; 1397 to->if_class = from->if_class; 1398 to->failover_mc_group = from->failover_mc_group; 1399 to->ingress_failover_id = from->ingress_failover_id; 1400 to->failover_id = from->failover_id; 1401 to->failover_tunnel_id = from->failover_tunnel_id; 1402 to->tunnel_if = from->tunnel_if; 1403 to->tunnel_class = from->tunnel_class; 1404 to->qos_map_id = from->qos_map_id; 1405 to->inlif_counting_profile = from->inlif_counting_profile; 1406 to->tunnel_term_ecn_map_id = from->tunnel_term_ecn_map_id; 1407 to->ingress_qos_model.ingress_phb = 1408 from->ingress_qos_model.ingress_phb; 1409 to->ingress_qos_model.ingress_remark = 1410 from->ingress_qos_model.ingress_remark; 1411 to->ingress_qos_model.ingress_ttl = 1412 from->ingress_qos_model.ingress_ttl; 1413 } 1414 1415 /* 1416 * Function: 1417 * _bcm_compat6515out_tunnel_terminator_t 1418 * Purpose: 1419 * Convert bcm_tunnel_terminator_t datatype from 6.5.16 to 6.5.15 1420 * Parameters: 1421 * from - (IN) The SDK 6.5.16 version of the datatype 1422 * to - (OUT) The 6.5.15 version of the datatype 1423 * Returns: 1424 * Nothing 1425 */ 1426 STATIC void 1427 _bcm_compat6515out_tunnel_terminator_t( 1428 bcm_tunnel_terminator_t *from, 1429 bcm_compat6515_tunnel_terminator_t *to) 1430 { 1431 to->flags = from->flags; 1432 to->multicast_flag = from->multicast_flag; 1433 to->vrf = from->vrf; 1434 to->sip = from->sip; 1435 to->dip = from-> dip; 1436 to->sip_mask = from->sip_mask; 1437 to->dip_mask = from->dip_mask; 1438 sal_memcpy(to->sip6, from->sip6, sizeof(bcm_ip6_t)); 1439 sal_memcpy(to->dip6, from->dip6, sizeof(bcm_ip6_t)); 1440 sal_memcpy(to->sip6_mask, from->sip6_mask, sizeof(bcm_ip6_t)); 1441 sal_memcpy(to->dip6_mask, from->dip6_mask, sizeof(bcm_ip6_t)); 1442 to->udp_dst_port = from->udp_dst_port; 1443 to->udp_src_port = from->udp_src_port; 1444 to->type = from->type; 1445 to->pbmp = from->pbmp; 1446 to->vlan = from->vlan; 1447 to->remote_port = from->remote_port; 1448 to->tunnel_id = from->tunnel_id; 1449 to->if_class = from->if_class; 1450 to->failover_mc_group = from->failover_mc_group; 1451 to->ingress_failover_id = from->ingress_failover_id; 1452 to->failover_id = from->failover_id; 1453 to->failover_tunnel_id = from->failover_tunnel_id; 1454 to->tunnel_if = from->tunnel_if; 1455 to->tunnel_class = from->tunnel_class; 1456 to->qos_map_id = from->qos_map_id; 1457 to->inlif_counting_profile = from->inlif_counting_profile; 1458 to->tunnel_term_ecn_map_id = from->tunnel_term_ecn_map_id; 1459 to->ingress_qos_model.ingress_phb = 1460 from->ingress_qos_model.ingress_phb; 1461 to->ingress_qos_model.ingress_remark = 1462 from->ingress_qos_model.ingress_remark; 1463 to->ingress_qos_model.ingress_ttl = 1464 from->ingress_qos_model.ingress_ttl; 1465 } 1466 1467 int bcm_compat6515_l2gre_tunnel_terminator_get( 1468 int unit, 1469 bcm_compat6515_tunnel_terminator_t *info) 1470 { 1471 int rv = 0; 1472 bcm_tunnel_terminator_t *new_info = NULL; 1473 1474 if (info != NULL) { 1475 new_info = (bcm_tunnel_terminator_t*) 1476 sal_alloc(sizeof(bcm_tunnel_terminator_t), "Tnl terminator"); 1477 if (new_info == NULL) { 1478 return BCM_E_MEMORY; 1479 } 1480 _bcm_compat6515in_tunnel_terminator_t(info, new_info); 1481 } 1482 1483 rv = bcm_l2gre_tunnel_terminator_get(unit, new_info); 1484 1485 if (new_info != NULL) { 1486 if (rv == BCM_E_NONE) { 1487 _bcm_compat6515out_tunnel_terminator_t(new_info, info); 1488 } 1489 sal_free(new_info); 1490 } 1491 1492 return rv; 1493 } 1494 1495 extern int bcm_compat6515_l2gre_tunnel_terminator_create( 1496 int unit, 1497 bcm_compat6515_tunnel_terminator_t *info) 1498 { 1499 int rv = 0; 1500 bcm_tunnel_terminator_t *new_info = NULL; 1501 1502 if (info != NULL) { 1503 new_info = (bcm_tunnel_terminator_t*) 1504 sal_alloc(sizeof(bcm_tunnel_terminator_t), "Tnl terminator"); 1505 if (new_info == NULL) { 1506 return BCM_E_MEMORY; 1507 } 1508 _bcm_compat6515in_tunnel_terminator_t(info, new_info); 1509 } 1510 1511 rv = bcm_l2gre_tunnel_terminator_create(unit, new_info); 1512 1513 if (new_info != NULL) { 1514 if (rv == BCM_E_NONE) { 1515 _bcm_compat6515out_tunnel_terminator_t(new_info, info); 1516 } 1517 sal_free(new_info); 1518 } 1519 1520 return rv; 1521 } 1522 1523 extern int bcm_compat6515_l2gre_tunnel_terminator_update( 1524 int unit, 1525 bcm_compat6515_tunnel_terminator_t *info) 1526 { 1527 int rv = 0; 1528 bcm_tunnel_terminator_t *new_info = NULL; 1529 1530 if (info != NULL) { 1531 new_info = (bcm_tunnel_terminator_t*) 1532 sal_alloc(sizeof(bcm_tunnel_terminator_t), "Tnl terminator"); 1533 if (new_info == NULL) { 1534 return BCM_E_MEMORY; 1535 } 1536 _bcm_compat6515in_tunnel_terminator_t(info, new_info); 1537 } 1538 1539 rv = bcm_l2gre_tunnel_terminator_update(unit, new_info); 1540 1541 if (new_info != NULL) { 1542 if (rv == BCM_E_NONE) { 1543 _bcm_compat6515out_tunnel_terminator_t(new_info, info); 1544 } 1545 sal_free(new_info); 1546 } 1547 1548 return rv; 1549 } 1550 1551 int bcm_compat6515_vxlan_tunnel_terminator_get( 1552 int unit, 1553 bcm_compat6515_tunnel_terminator_t *info) 1554 { 1555 int rv = 0; 1556 bcm_tunnel_terminator_t *new_info = NULL; 1557 1558 if (info != NULL) { 1559 new_info = (bcm_tunnel_terminator_t*) 1560 sal_alloc(sizeof(bcm_tunnel_terminator_t), "Tnl terminator"); 1561 if (new_info == NULL) { 1562 return BCM_E_MEMORY; 1563 } 1564 _bcm_compat6515in_tunnel_terminator_t(info, new_info); 1565 } 1566 1567 rv = bcm_vxlan_tunnel_terminator_get(unit, new_info); 1568 1569 if (new_info != NULL) { 1570 if (rv == BCM_E_NONE) { 1571 _bcm_compat6515out_tunnel_terminator_t(new_info, info); 1572 } 1573 sal_free(new_info); 1574 } 1575 1576 return rv; 1577 } 1578 1579 extern int bcm_compat6515_vxlan_tunnel_terminator_create( 1580 int unit, 1581 bcm_compat6515_tunnel_terminator_t *info) 1582 { 1583 int rv = 0; 1584 bcm_tunnel_terminator_t *new_info = NULL; 1585 1586 if (info != NULL) { 1587 new_info = (bcm_tunnel_terminator_t*) 1588 sal_alloc(sizeof(bcm_tunnel_terminator_t), "Tnl terminator"); 1589 if (new_info == NULL) { 1590 return BCM_E_MEMORY; 1591 } 1592 _bcm_compat6515in_tunnel_terminator_t(info, new_info); 1593 } 1594 1595 rv = bcm_vxlan_tunnel_terminator_create(unit, new_info); 1596 1597 if (new_info != NULL) { 1598 if (rv == BCM_E_NONE) { 1599 _bcm_compat6515out_tunnel_terminator_t(new_info, info); 1600 } 1601 sal_free(new_info); 1602 } 1603 1604 return rv; 1605 } 1606 1607 extern int bcm_compat6515_vxlan_tunnel_terminator_update( 1608 int unit, 1609 bcm_compat6515_tunnel_terminator_t *info) 1610 { 1611 int rv = 0; 1612 bcm_tunnel_terminator_t *new_info = NULL; 1613 1614 if (info != NULL) { 1615 new_info = (bcm_tunnel_terminator_t*) 1616 sal_alloc(sizeof(bcm_tunnel_terminator_t), "Tnl terminator"); 1617 if (new_info == NULL) { 1618 return BCM_E_MEMORY; 1619 } 1620 _bcm_compat6515in_tunnel_terminator_t(info, new_info); 1621 } 1622 1623 rv = bcm_vxlan_tunnel_terminator_update(unit, new_info); 1624 1625 if (new_info != NULL) { 1626 if (rv == BCM_E_NONE) { 1627 _bcm_compat6515out_tunnel_terminator_t(new_info, info); 1628 } 1629 sal_free(new_info); 1630 } 1631 1632 return rv; 1633 } 1634 1635 int bcm_compat6515_tunnel_terminator_add( 1636 int unit, 1637 bcm_compat6515_tunnel_terminator_t *info) 1638 { 1639 int rv = 0; 1640 bcm_tunnel_terminator_t *new_info = NULL; 1641 1642 if (info != NULL) { 1643 new_info = (bcm_tunnel_terminator_t*) 1644 sal_alloc(sizeof(bcm_tunnel_terminator_t), "Tnl terminator"); 1645 if (new_info == NULL) { 1646 return BCM_E_MEMORY; 1647 } 1648 _bcm_compat6515in_tunnel_terminator_t(info, new_info); 1649 } 1650 1651 rv = bcm_tunnel_terminator_add(unit, new_info); 1652 1653 if (new_info != NULL) { 1654 sal_free(new_info); 1655 } 1656 1657 return rv; 1658 } 1659 1660 int bcm_compat6515_tunnel_terminator_create( 1661 int unit, 1662 bcm_compat6515_tunnel_terminator_t *info) 1663 { 1664 int rv = 0; 1665 bcm_tunnel_terminator_t *new_info = NULL; 1666 1667 if (info != NULL) { 1668 new_info = (bcm_tunnel_terminator_t*) 1669 sal_alloc(sizeof(bcm_tunnel_terminator_t), "Tnl terminator"); 1670 if (new_info == NULL) { 1671 return BCM_E_MEMORY; 1672 } 1673 _bcm_compat6515in_tunnel_terminator_t(info, new_info); 1674 } 1675 1676 rv = bcm_tunnel_terminator_create(unit, new_info); 1677 1678 if (new_info != NULL) { 1679 if (rv == BCM_E_NONE) { 1680 _bcm_compat6515out_tunnel_terminator_t(new_info, info); 1681 } 1682 sal_free(new_info); 1683 } 1684 1685 return rv; 1686 } 1687 1688 int bcm_compat6515_tunnel_terminator_delete( 1689 int unit, 1690 bcm_compat6515_tunnel_terminator_t *info) 1691 { 1692 int rv = 0; 1693 bcm_tunnel_terminator_t *new_info = NULL; 1694 1695 if (info != NULL) { 1696 new_info = (bcm_tunnel_terminator_t*) 1697 sal_alloc(sizeof(bcm_tunnel_terminator_t), "Tnl terminator"); 1698 if (new_info == NULL) { 1699 return BCM_E_MEMORY; 1700 } 1701 _bcm_compat6515in_tunnel_terminator_t(info, new_info); 1702 } 1703 1704 rv = bcm_tunnel_terminator_delete(unit, new_info); 1705 1706 if (new_info != NULL) { 1707 sal_free(new_info); 1708 } 1709 1710 return rv; 1711 } 1712 1713 int bcm_compat6515_tunnel_terminator_update( 1714 int unit, 1715 bcm_compat6515_tunnel_terminator_t *info) 1716 { 1717 int rv = 0; 1718 bcm_tunnel_terminator_t *new_info = NULL; 1719 1720 if (info != NULL) { 1721 new_info = (bcm_tunnel_terminator_t*) 1722 sal_alloc(sizeof(bcm_tunnel_terminator_t), "Tnl terminator"); 1723 if (new_info == NULL) { 1724 return BCM_E_MEMORY; 1725 } 1726 _bcm_compat6515in_tunnel_terminator_t(info, new_info); 1727 } 1728 1729 rv = bcm_tunnel_terminator_update(unit, new_info); 1730 1731 if (new_info != NULL) { 1732 sal_free(new_info); 1733 } 1734 1735 return rv; 1736 } 1737 1738 int bcm_compat6515_tunnel_terminator_get( 1739 int unit, 1740 bcm_compat6515_tunnel_terminator_t *info) 1741 { 1742 int rv = 0; 1743 bcm_tunnel_terminator_t *new_info = NULL; 1744 1745 if (info != NULL) { 1746 new_info = (bcm_tunnel_terminator_t*) 1747 sal_alloc(sizeof(bcm_tunnel_terminator_t), "Tnl terminator"); 1748 if (new_info == NULL) { 1749 return BCM_E_MEMORY; 1750 } 1751 _bcm_compat6515in_tunnel_terminator_t(info, new_info); 1752 } 1753 1754 rv = bcm_tunnel_terminator_get(unit, new_info); 1755 1756 if (new_info != NULL) { 1757 if (rv == BCM_E_NONE) { 1758 _bcm_compat6515out_tunnel_terminator_t(new_info, info); 1759 } 1760 sal_free(new_info); 1761 } 1762 1763 return rv; 1764 } 1765 1766 #endif /* INCLUDE_L3 */ 1767 #endif /* BCM_RPC_SUPPORT*/