Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Commit 51f34f4

Browse files
authored
Free packet/packet buffer pool spinlocks on pool destroy
1 parent 4666318 commit 51f34f4

File tree

2 files changed

+112
-110
lines changed

2 files changed

+112
-110
lines changed

src/bcmpkt/buf/bcmpkt_bpool.c

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -13,89 +13,89 @@
1313
* allocated buffer into it.
1414
*/
1515
/*
16-
* Copyright: (c) 2018 Broadcom. All Rights Reserved. "Broadcom" refers to
16+
* Copyright: (c) 2018 Broadcom. All Rights Reserved. "Broadcom" refers to
1717
* Broadcom Limited and/or its subsidiaries.
18-
*
18+
*
1919
* Broadcom Switch Software License
20-
*
21-
* This license governs the use of the accompanying Broadcom software. Your
22-
* use of the software indicates your acceptance of the terms and conditions
23-
* of this license. If you do not agree to the terms and conditions of this
20+
*
21+
* This license governs the use of the accompanying Broadcom software. Your
22+
* use of the software indicates your acceptance of the terms and conditions
23+
* of this license. If you do not agree to the terms and conditions of this
2424
* license, do not use the software.
2525
* 1. Definitions
2626
* "Licensor" means any person or entity that distributes its Work.
27-
* "Software" means the original work of authorship made available under
27+
* "Software" means the original work of authorship made available under
2828
* this license.
29-
* "Work" means the Software and any additions to or derivative works of
29+
* "Work" means the Software and any additions to or derivative works of
3030
* the Software that are made available under this license.
31-
* The terms "reproduce," "reproduction," "derivative works," and
31+
* The terms "reproduce," "reproduction," "derivative works," and
3232
* "distribution" have the meaning as provided under U.S. copyright law.
33-
* Works, including the Software, are "made available" under this license
34-
* by including in or with the Work either (a) a copyright notice
35-
* referencing the applicability of this license to the Work, or (b) a copy
33+
* Works, including the Software, are "made available" under this license
34+
* by including in or with the Work either (a) a copyright notice
35+
* referencing the applicability of this license to the Work, or (b) a copy
3636
* of this license.
3737
* 2. Grant of Copyright License
38-
* Subject to the terms and conditions of this license, each Licensor
39-
* grants to you a perpetual, worldwide, non-exclusive, and royalty-free
40-
* copyright license to reproduce, prepare derivative works of, publicly
41-
* display, publicly perform, sublicense and distribute its Work and any
38+
* Subject to the terms and conditions of this license, each Licensor
39+
* grants to you a perpetual, worldwide, non-exclusive, and royalty-free
40+
* copyright license to reproduce, prepare derivative works of, publicly
41+
* display, publicly perform, sublicense and distribute its Work and any
4242
* resulting derivative works in any form.
4343
* 3. Grant of Patent License
44-
* Subject to the terms and conditions of this license, each Licensor
45-
* grants to you a perpetual, worldwide, non-exclusive, and royalty-free
46-
* patent license to make, have made, use, offer to sell, sell, import, and
47-
* otherwise transfer its Work, in whole or in part. This patent license
48-
* applies only to the patent claims licensable by Licensor that would be
49-
* infringed by Licensor's Work (or portion thereof) individually and
44+
* Subject to the terms and conditions of this license, each Licensor
45+
* grants to you a perpetual, worldwide, non-exclusive, and royalty-free
46+
* patent license to make, have made, use, offer to sell, sell, import, and
47+
* otherwise transfer its Work, in whole or in part. This patent license
48+
* applies only to the patent claims licensable by Licensor that would be
49+
* infringed by Licensor's Work (or portion thereof) individually and
5050
* excluding any combinations with any other materials or technology.
51-
* If you institute patent litigation against any Licensor (including a
52-
* cross-claim or counterclaim in a lawsuit) to enforce any patents that
53-
* you allege are infringed by any Work, then your patent license from such
54-
* Licensor to the Work shall terminate as of the date such litigation is
51+
* If you institute patent litigation against any Licensor (including a
52+
* cross-claim or counterclaim in a lawsuit) to enforce any patents that
53+
* you allege are infringed by any Work, then your patent license from such
54+
* Licensor to the Work shall terminate as of the date such litigation is
5555
* filed.
5656
* 4. Redistribution
57-
* You may reproduce or distribute the Work only if (a) you do so under
58-
* this License, (b) you include a complete copy of this License with your
59-
* distribution, and (c) you retain without modification any copyright,
57+
* You may reproduce or distribute the Work only if (a) you do so under
58+
* this License, (b) you include a complete copy of this License with your
59+
* distribution, and (c) you retain without modification any copyright,
6060
* patent, trademark, or attribution notices that are present in the Work.
6161
* 5. Derivative Works
62-
* You may specify that additional or different terms apply to the use,
63-
* reproduction, and distribution of your derivative works of the Work
64-
* ("Your Terms") only if (a) Your Terms provide that the limitations of
65-
* Section 7 apply to your derivative works, and (b) you identify the
66-
* specific derivative works that are subject to Your Terms.
67-
* Notwithstanding Your Terms, this license (including the redistribution
62+
* You may specify that additional or different terms apply to the use,
63+
* reproduction, and distribution of your derivative works of the Work
64+
* ("Your Terms") only if (a) Your Terms provide that the limitations of
65+
* Section 7 apply to your derivative works, and (b) you identify the
66+
* specific derivative works that are subject to Your Terms.
67+
* Notwithstanding Your Terms, this license (including the redistribution
6868
* requirements in Section 4) will continue to apply to the Work itself.
6969
* 6. Trademarks
70-
* This license does not grant any rights to use any Licensor's or its
71-
* affiliates' names, logos, or trademarks, except as necessary to
70+
* This license does not grant any rights to use any Licensor's or its
71+
* affiliates' names, logos, or trademarks, except as necessary to
7272
* reproduce the notices described in this license.
7373
* 7. Limitations
74-
* Platform. The Work and any derivative works thereof may only be used, or
74+
* Platform. The Work and any derivative works thereof may only be used, or
7575
* intended for use, with a Broadcom switch integrated circuit.
76-
* No Reverse Engineering. You will not use the Work to disassemble,
77-
* reverse engineer, decompile, or attempt to ascertain the underlying
76+
* No Reverse Engineering. You will not use the Work to disassemble,
77+
* reverse engineer, decompile, or attempt to ascertain the underlying
7878
* technology of a Broadcom switch integrated circuit.
7979
* 8. Termination
80-
* If you violate any term of this license, then your rights under this
81-
* license (including the license grants of Sections 2 and 3) will
80+
* If you violate any term of this license, then your rights under this
81+
* license (including the license grants of Sections 2 and 3) will
8282
* terminate immediately.
8383
* 9. Disclaimer of Warranty
84-
* THE WORK IS PROVIDED "AS IS" WITHOUT WARRANTIES OR CONDITIONS OF ANY
85-
* KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OR CONDITIONS OF
86-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR
87-
* NON-INFRINGEMENT. YOU BEAR THE RISK OF UNDERTAKING ANY ACTIVITIES UNDER
88-
* THIS LICENSE. SOME STATES' CONSUMER LAWS DO NOT ALLOW EXCLUSION OF AN
84+
* THE WORK IS PROVIDED "AS IS" WITHOUT WARRANTIES OR CONDITIONS OF ANY
85+
* KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OR CONDITIONS OF
86+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR
87+
* NON-INFRINGEMENT. YOU BEAR THE RISK OF UNDERTAKING ANY ACTIVITIES UNDER
88+
* THIS LICENSE. SOME STATES' CONSUMER LAWS DO NOT ALLOW EXCLUSION OF AN
8989
* IMPLIED WARRANTY, SO THIS DISCLAIMER MAY NOT APPLY TO YOU.
9090
* 10. Limitation of Liability
91-
* EXCEPT AS PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL
92-
* THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE
93-
* SHALL ANY LICENSOR BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT,
94-
* INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
95-
* OR RELATED TO THIS LICENSE, THE USE OR INABILITY TO USE THE WORK
96-
* (INCLUDING BUT NOT LIMITED TO LOSS OF GOODWILL, BUSINESS INTERRUPTION,
97-
* LOST PROFITS OR DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY OTHER
98-
* COMMERCIAL DAMAGES OR LOSSES), EVEN IF THE LICENSOR HAS BEEN ADVISED OF
91+
* EXCEPT AS PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL
92+
* THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE
93+
* SHALL ANY LICENSOR BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT,
94+
* INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
95+
* OR RELATED TO THIS LICENSE, THE USE OR INABILITY TO USE THE WORK
96+
* (INCLUDING BUT NOT LIMITED TO LOSS OF GOODWILL, BUSINESS INTERRUPTION,
97+
* LOST PROFITS OR DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY OTHER
98+
* COMMERCIAL DAMAGES OR LOSSES), EVEN IF THE LICENSOR HAS BEEN ADVISED OF
9999
* THE POSSIBILITY OF SUCH DAMAGES.
100100
*/
101101

@@ -284,6 +284,7 @@ bcmpkt_bpool_destroy(int unit)
284284
} else {
285285
bcmdrd_hal_dma_free(unit, bp->mem_size, bp->mem, bp->dma_addr);
286286
}
287+
sal_spinlock_destroy(bp->lock);
287288
sal_memset(bp, 0, sizeof(*bp));
288289
exit:
289290
SHR_FUNC_EXIT();

src/bcmpkt/buf/bcmpkt_ppool.c

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -4,89 +4,89 @@
44
* for user to get efficiency.
55
*/
66
/*
7-
* Copyright: (c) 2018 Broadcom. All Rights Reserved. "Broadcom" refers to
7+
* Copyright: (c) 2018 Broadcom. All Rights Reserved. "Broadcom" refers to
88
* Broadcom Limited and/or its subsidiaries.
9-
*
9+
*
1010
* Broadcom Switch Software License
11-
*
12-
* This license governs the use of the accompanying Broadcom software. Your
13-
* use of the software indicates your acceptance of the terms and conditions
14-
* of this license. If you do not agree to the terms and conditions of this
11+
*
12+
* This license governs the use of the accompanying Broadcom software. Your
13+
* use of the software indicates your acceptance of the terms and conditions
14+
* of this license. If you do not agree to the terms and conditions of this
1515
* license, do not use the software.
1616
* 1. Definitions
1717
* "Licensor" means any person or entity that distributes its Work.
18-
* "Software" means the original work of authorship made available under
18+
* "Software" means the original work of authorship made available under
1919
* this license.
20-
* "Work" means the Software and any additions to or derivative works of
20+
* "Work" means the Software and any additions to or derivative works of
2121
* the Software that are made available under this license.
22-
* The terms "reproduce," "reproduction," "derivative works," and
22+
* The terms "reproduce," "reproduction," "derivative works," and
2323
* "distribution" have the meaning as provided under U.S. copyright law.
24-
* Works, including the Software, are "made available" under this license
25-
* by including in or with the Work either (a) a copyright notice
26-
* referencing the applicability of this license to the Work, or (b) a copy
24+
* Works, including the Software, are "made available" under this license
25+
* by including in or with the Work either (a) a copyright notice
26+
* referencing the applicability of this license to the Work, or (b) a copy
2727
* of this license.
2828
* 2. Grant of Copyright License
29-
* Subject to the terms and conditions of this license, each Licensor
30-
* grants to you a perpetual, worldwide, non-exclusive, and royalty-free
31-
* copyright license to reproduce, prepare derivative works of, publicly
32-
* display, publicly perform, sublicense and distribute its Work and any
29+
* Subject to the terms and conditions of this license, each Licensor
30+
* grants to you a perpetual, worldwide, non-exclusive, and royalty-free
31+
* copyright license to reproduce, prepare derivative works of, publicly
32+
* display, publicly perform, sublicense and distribute its Work and any
3333
* resulting derivative works in any form.
3434
* 3. Grant of Patent License
35-
* Subject to the terms and conditions of this license, each Licensor
36-
* grants to you a perpetual, worldwide, non-exclusive, and royalty-free
37-
* patent license to make, have made, use, offer to sell, sell, import, and
38-
* otherwise transfer its Work, in whole or in part. This patent license
39-
* applies only to the patent claims licensable by Licensor that would be
40-
* infringed by Licensor's Work (or portion thereof) individually and
35+
* Subject to the terms and conditions of this license, each Licensor
36+
* grants to you a perpetual, worldwide, non-exclusive, and royalty-free
37+
* patent license to make, have made, use, offer to sell, sell, import, and
38+
* otherwise transfer its Work, in whole or in part. This patent license
39+
* applies only to the patent claims licensable by Licensor that would be
40+
* infringed by Licensor's Work (or portion thereof) individually and
4141
* excluding any combinations with any other materials or technology.
42-
* If you institute patent litigation against any Licensor (including a
43-
* cross-claim or counterclaim in a lawsuit) to enforce any patents that
44-
* you allege are infringed by any Work, then your patent license from such
45-
* Licensor to the Work shall terminate as of the date such litigation is
42+
* If you institute patent litigation against any Licensor (including a
43+
* cross-claim or counterclaim in a lawsuit) to enforce any patents that
44+
* you allege are infringed by any Work, then your patent license from such
45+
* Licensor to the Work shall terminate as of the date such litigation is
4646
* filed.
4747
* 4. Redistribution
48-
* You may reproduce or distribute the Work only if (a) you do so under
49-
* this License, (b) you include a complete copy of this License with your
50-
* distribution, and (c) you retain without modification any copyright,
48+
* You may reproduce or distribute the Work only if (a) you do so under
49+
* this License, (b) you include a complete copy of this License with your
50+
* distribution, and (c) you retain without modification any copyright,
5151
* patent, trademark, or attribution notices that are present in the Work.
5252
* 5. Derivative Works
53-
* You may specify that additional or different terms apply to the use,
54-
* reproduction, and distribution of your derivative works of the Work
55-
* ("Your Terms") only if (a) Your Terms provide that the limitations of
56-
* Section 7 apply to your derivative works, and (b) you identify the
57-
* specific derivative works that are subject to Your Terms.
58-
* Notwithstanding Your Terms, this license (including the redistribution
53+
* You may specify that additional or different terms apply to the use,
54+
* reproduction, and distribution of your derivative works of the Work
55+
* ("Your Terms") only if (a) Your Terms provide that the limitations of
56+
* Section 7 apply to your derivative works, and (b) you identify the
57+
* specific derivative works that are subject to Your Terms.
58+
* Notwithstanding Your Terms, this license (including the redistribution
5959
* requirements in Section 4) will continue to apply to the Work itself.
6060
* 6. Trademarks
61-
* This license does not grant any rights to use any Licensor's or its
62-
* affiliates' names, logos, or trademarks, except as necessary to
61+
* This license does not grant any rights to use any Licensor's or its
62+
* affiliates' names, logos, or trademarks, except as necessary to
6363
* reproduce the notices described in this license.
6464
* 7. Limitations
65-
* Platform. The Work and any derivative works thereof may only be used, or
65+
* Platform. The Work and any derivative works thereof may only be used, or
6666
* intended for use, with a Broadcom switch integrated circuit.
67-
* No Reverse Engineering. You will not use the Work to disassemble,
68-
* reverse engineer, decompile, or attempt to ascertain the underlying
67+
* No Reverse Engineering. You will not use the Work to disassemble,
68+
* reverse engineer, decompile, or attempt to ascertain the underlying
6969
* technology of a Broadcom switch integrated circuit.
7070
* 8. Termination
71-
* If you violate any term of this license, then your rights under this
72-
* license (including the license grants of Sections 2 and 3) will
71+
* If you violate any term of this license, then your rights under this
72+
* license (including the license grants of Sections 2 and 3) will
7373
* terminate immediately.
7474
* 9. Disclaimer of Warranty
75-
* THE WORK IS PROVIDED "AS IS" WITHOUT WARRANTIES OR CONDITIONS OF ANY
76-
* KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OR CONDITIONS OF
77-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR
78-
* NON-INFRINGEMENT. YOU BEAR THE RISK OF UNDERTAKING ANY ACTIVITIES UNDER
79-
* THIS LICENSE. SOME STATES' CONSUMER LAWS DO NOT ALLOW EXCLUSION OF AN
75+
* THE WORK IS PROVIDED "AS IS" WITHOUT WARRANTIES OR CONDITIONS OF ANY
76+
* KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OR CONDITIONS OF
77+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR
78+
* NON-INFRINGEMENT. YOU BEAR THE RISK OF UNDERTAKING ANY ACTIVITIES UNDER
79+
* THIS LICENSE. SOME STATES' CONSUMER LAWS DO NOT ALLOW EXCLUSION OF AN
8080
* IMPLIED WARRANTY, SO THIS DISCLAIMER MAY NOT APPLY TO YOU.
8181
* 10. Limitation of Liability
82-
* EXCEPT AS PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL
83-
* THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE
84-
* SHALL ANY LICENSOR BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT,
85-
* INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
86-
* OR RELATED TO THIS LICENSE, THE USE OR INABILITY TO USE THE WORK
87-
* (INCLUDING BUT NOT LIMITED TO LOSS OF GOODWILL, BUSINESS INTERRUPTION,
88-
* LOST PROFITS OR DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY OTHER
89-
* COMMERCIAL DAMAGES OR LOSSES), EVEN IF THE LICENSOR HAS BEEN ADVISED OF
82+
* EXCEPT AS PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL
83+
* THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE
84+
* SHALL ANY LICENSOR BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT,
85+
* INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
86+
* OR RELATED TO THIS LICENSE, THE USE OR INABILITY TO USE THE WORK
87+
* (INCLUDING BUT NOT LIMITED TO LOSS OF GOODWILL, BUSINESS INTERRUPTION,
88+
* LOST PROFITS OR DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY OTHER
89+
* COMMERCIAL DAMAGES OR LOSSES), EVEN IF THE LICENSOR HAS BEEN ADVISED OF
9090
* THE POSSIBILITY OF SUCH DAMAGES.
9191
*/
9292

@@ -181,6 +181,7 @@ bcmpkt_ppool_destroy(void)
181181
pp.free_list = pp.free_list->next;
182182
sal_free(packet);
183183
}
184+
sal_spinlock_destroy(pp.lock);
184185
sal_memset(&pp, 0, sizeof(pp));
185186

186187
return SHR_E_NONE;

0 commit comments

Comments
 (0)