X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fnat%2Fnat44%2Finlines.h;fp=src%2Fplugins%2Fnat%2Fnat44_inlines.h;h=a7bb469b464bfcfa0474439c59cd95090499f744;hb=720435d03531da68e18c2a0dc867aa99d2daced6;hp=eb1077cdf34aa24c53a51e4f5e61039894779ff1;hpb=13e6fce7c5b3a16a6af0b27fc259ef3f65d8c861;p=vpp.git diff --git a/src/plugins/nat/nat44_inlines.h b/src/plugins/nat/nat44/inlines.h similarity index 88% rename from src/plugins/nat/nat44_inlines.h rename to src/plugins/nat/nat44/inlines.h index eb1077cdf34..a7bb469b464 100644 --- a/src/plugins/nat/nat44_inlines.h +++ b/src/plugins/nat/nat44/inlines.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Cisco and/or its affiliates. + * Copyright (c) 2020 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -15,12 +15,22 @@ /** * @brief The NAT44 inline functions */ -#ifndef __included_nat44_inlines_h__ -#define __included_nat44_inlines_h__ + +#ifndef included_nat44_inlines_h__ +#define included_nat44_inlines_h__ #include #include +static_always_inline u8 +nat44_maximum_sessions_exceeded (snat_main_t * sm, u32 thread_index) +{ + if (pool_elts (sm->per_thread_data[thread_index].sessions) >= + sm->max_translations) + return 1; + return 0; +} + static_always_inline void nat44_session_cleanup (snat_session_t * s, u32 thread_index) { @@ -98,7 +108,7 @@ nat44_session_try_cleanup (ip4_address_t * addr, thread_index, now); } -#endif /* __included_nat44_inlines_h__ */ +#endif /* included_nat44_inlines_h__ */ /* * fd.io coding-style-patch-verification: ON