Skip to content

Commit

Permalink
Combine switch_pd_routing.h header files (#122)
Browse files Browse the repository at this point in the history
- Combined the LNW_V2 and LNW_V3 versions of switch_pd_routing.h
  into a single conditionalized file.

Signed-off-by: Derek G Foster <[email protected]>
  • Loading branch information
ffoulkes authored Apr 16, 2024
1 parent 9df534f commit 2ac5de8
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 119 deletions.
1 change: 0 additions & 1 deletion switchapi/es2k/lnw_v2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
target_sources(switchapi_o PRIVATE
switch_pd_p4_name_routing.h
switch_pd_routing.c
switch_pd_routing.h
switch_pd_lag.c
switch_pd_lag.h
)
Expand Down
2 changes: 1 addition & 1 deletion switchapi/es2k/lnw_v2/switch_pd_routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

#include "switch_pd_routing.h"
#include "switchapi/es2k/switch_pd_routing.h"

#include "switchapi/es2k/switch_pd_p4_name_mapping.h"
#include "switchapi/es2k/switch_pd_utils.h"
Expand Down
105 changes: 0 additions & 105 deletions switchapi/es2k/lnw_v2/switch_pd_routing.h

This file was deleted.

1 change: 0 additions & 1 deletion switchapi/es2k/lnw_v3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
target_sources(switchapi_o PRIVATE
switch_pd_p4_name_routing.h
switch_pd_routing.c
switch_pd_routing.h
switch_pd_lag.c
switch_pd_lag.h
)
Expand Down
2 changes: 1 addition & 1 deletion switchapi/es2k/lnw_v3/switch_pd_routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

#include "switch_pd_routing.h"
#include "switchapi/es2k/switch_pd_routing.h"

#include "switchapi/es2k/switch_pd_p4_name_mapping.h"
#include "switchapi/es2k/switch_pd_utils.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
#ifndef __SWITCH_PD_ROUTING_H__
#define __SWITCH_PD_ROUTING_H__

#include "switchapi/es2k/lnw_v3/switch_pd_p4_name_routing.h"
#if defined(LNW_V2)
#include "lnw_v2/switch_pd_p4_name_routing.h"
#elif defined(LNW_V3)
#include "lnw_v3/switch_pd_p4_name_routing.h"
#endif

#include "switchapi/switch_base_types.h"
#include "switchapi/switch_handle.h"
#include "switchapi/switch_l3.h"
Expand Down Expand Up @@ -59,9 +64,15 @@ switch_status_t switch_pd_nexthop_table_entry(
switch_device_t device, const switch_pd_routing_info_t* api_nexthop_pd_info,
bool entry_add);

#if defined(LNW_V2)
switch_status_t switch_pd_neighbor_table_entry(
switch_device_t device,
const switch_pd_routing_info_t* api_neighbor_pd_info, bool entry_add);
#elif defined(LNW_V3)
switch_status_t switch_pd_ecmp_nexthop_table_entry(
switch_device_t device, const switch_pd_routing_info_t* api_nexthop_pd_info,
bool entry_add);
#endif

switch_status_t switch_pd_rmac_table_entry(switch_device_t device,
switch_rmac_entry_t* rmac_entry,
Expand Down
17 changes: 8 additions & 9 deletions switchapi/switch_pd_routing.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,21 @@
* limitations under the License.
*/

// Proxy for the target-specific switch_pd_routing header files.
// Proxy for the target-specific switch_pd_routing.h files.
//
// We use a unique include guard to avoid aliasing the ones in the
// target-specific header files (which would cause their contents
// to be ignored).
// This header file encapsulates the knowledge that there are different
// versions of the header file for DPDK and ES2K.
//
// Note that it must use a different include guard than the files it
// includes (which both use the same name).

#ifndef __SWITCH_PD_ROUTING_WRAPPER_H__
#define __SWITCH_PD_ROUTING_WRAPPER_H__

#if defined(DPDK_TARGET)
#include "dpdk/switch_pd_routing.h"
#elif defined(ES2K_TARGET)
#ifdef LNW_V2
#include "es2k/lnw_v2/switch_pd_routing.h"
#else // LNW_V3
#include "es2k/lnw_v3/switch_pd_routing.h"
#endif // LNW_V2
#include "es2k/switch_pd_routing.h"
#endif

#endif // __SWITCH_PD_ROUTING_WRAPPER_H__

0 comments on commit 2ac5de8

Please sign in to comment.