Commit graph

19 commits

Author SHA1 Message Date
Karthikeya Venkat Muppalla bb09c35592 lib: use memcpy in bf_copy
use memcpy in bf_copy() instead of copy word by word in for loop

Signed-off-by: Karthikeya Venkat Muppalla <kmuppalla@nvidia.com>
2025-03-07 11:59:20 -08:00
Mark Stapp cad880c2df lib: init new bitfield word after realloc
Realloc doesn't init - ensure a newly-allocated word is inited.

Signed-off-by: Mark Stapp <mjs@labn.net>
2024-01-29 12:56:28 -05:00
Mark Stapp 82cde1f85b libs: use XREALLOC in bitfield lib module
Use FRR mem api instead of raw realloc() in bitfield module.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-08-09 16:19:40 -04:00
Donald Sharp 8383d53e43
Merge pull request #12780 from opensourcerouting/spdx-license-id
*: convert to SPDX License identifiers
2023-02-17 09:43:05 -05:00
Hiroki Shirokura c86a325285 lib: add copy function for bitfield_t
Add a function to copy a bitfield_t structure.

Add a ‘void *’ to ‘word_t *’ converstion in bf_init() to avoid the
following error:

> ./lib/bitfield.h: In function ‘bf_copy’:
> ./lib/bitfield.h:75:12: error: request for implicit conversion from ‘void *’ to ‘word_t *’ {aka ‘unsigned int *’} not permitted in C++ [-Werror=c++-compat]
>    (v).data = XCALLOC(MTYPE_BITFIELD, ((v).m * sizeof(word_t)));  \
>             ^
> ./lib/bitfield.h:278:2: note: in expansion of macro ‘bf_init’
>   bf_init(dst, WORD_SIZE * (src.m - 1));
>   ^~~~~~~

Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-02-09 15:48:39 +01:00
David Lamparter acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
G. Paul Ziemba 80853c2ec7 bgpd: improve labelpool performance at scale
- double the size of each new chunk request from zebra
    - use bitfields to track label allocations in a chunk
    - When allocating:
        - skip chunks with no free labels
        - search biggest chunks first
        - start search in chunk where last search ended
    - Improve API documentation in comments (bgp_lp_get() and callback)
    - Tweak formatting of "show bgp labelpool chunks"
    - Add test features (compiled conditionally on BGP_LABELPOOL_ENABLE_TESTS)

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2022-08-31 08:21:27 -07:00
Pat Ruddy 0e2deb5878 lib: add an MTYPE for bitfields
it is handy to be able to see allocated bitfields in the show
memory output.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-06-18 09:34:43 +01:00
Anuradha Karuppiah 89fbf168c2 lib: bitfield: new macros for bit processing
New macros have been added for the following -
1. to efficiently iterate and execute functions on already set bits
2. to check if a bit is in use
3. to check if a bitfield has been initialized (this is to safetly
handle cases where the bitfield is freed and re-allocated).
4. to check if two bitfields have the same bits set

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-08-05 06:46:12 -07:00
Quentin Young 1ac10b15b1 lib: dont null check bitfield pointer before free
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-17 20:19:38 -04:00
Mark Stapp 193848fff6 lib: clear data pointer in bf_free
Help avoid double-free by clearing data pointer.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-04-17 16:53:37 -04:00
Renato Westphal 5e2444690b lib: add extern "C" {} blocks to all libfrr headers
These are necessary to use functions defined in these headers from C++.

Signed-off-by: David Lamparter <equinox@diac24.net>
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-02-11 22:34:12 -02:00
whitespace / reindent d62a17aede *: reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17 14:04:07 +02:00
vivek 4e9da20145 lib: Additional APIs in bitfield library
Added APIs to:
a) pre-assign 0th bit in the bitfield
b) free 0th bit in the bitfield
c) free the allocated bitfield data

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Vivek Venkatraman <vivek@cumulusnetworks.com>
2017-05-25 10:20:03 -07:00
David Lamparter 896014f4bc *: make consistent & update GPLv2 file headers
The FSF's address changed, and we had a mixture of comment styles for
the GPL file header.  (The style with * at the beginning won out with
580 to 141 in existing files.)

Note: I've intentionally left intact other "variations" of the copyright
header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 16:37:41 +02:00
David Lamparter 6a49d0cc12 Merge remote-tracking branch 'cmaster-next' into cmaster-next-releng 2016-11-19 11:58:52 +01:00
Donald Sharp 50e24903ba *: Fix up licensing to be right
These files were submitted by Cumulus but did
not properly setup the licensing of them.
This fixes that issue.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-11-18 10:14:03 -05:00
David Lamparter 45ef430000 build: fix -Wmaybe-uninitialized warnings
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-15 11:17:50 +09:00
Donald Sharp c3c0ac8395 ospf6d: ospfv3-abr-ecmp-support.patch
OSPFv3: Add ABR support and make ECMP > 4.

Signed-off-by: Dinesh G Dutt <ddutt at cumulusnetworks.com>
Signed-off-by: Pradosh Mohapatra <pmohapat at cumulusnetworks.com>
2015-05-19 18:03:39 -07:00