Skip to content

Commit 4a681bf

Browse files
rikardfalkeborndavem330
authored andcommitted
octeontx2-af: Constify npc_kpu_profile_{action,cam}
These are never modified, so constify them to allow the compiler to place them in read-only memory. This moves about 25kB to read-only memory as seen by the output of the size command. Before: text data bss dec hex filename 296203 65464 1248 362915 589a3 drivers/net/ethernet/marvell/octeontx2/af/octeontx2_af.ko After: text data bss dec hex filename 321003 40664 1248 362915 589a3 drivers/net/ethernet/marvell/octeontx2/af/octeontx2_af.ko Signed-off-by: Rikard Falkeborn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent cac7663 commit 4a681bf

File tree

3 files changed

+39
-39
lines changed

3 files changed

+39
-39
lines changed

drivers/net/ethernet/marvell/octeontx2/af/npc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ struct npc_kpu_profile_action {
173173
struct npc_kpu_profile {
174174
int cam_entries;
175175
int action_entries;
176-
struct npc_kpu_profile_cam *cam;
177-
struct npc_kpu_profile_action *action;
176+
const struct npc_kpu_profile_cam *cam;
177+
const struct npc_kpu_profile_action *action;
178178
};
179179

180180
/* NPC KPU register formats */

drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ enum NPC_ERRLEV_E {
418418
NPC_ERRLEV_ENUM_LAST = 16,
419419
};
420420

421-
static struct npc_kpu_profile_action ikpu_action_entries[] = {
421+
static const struct npc_kpu_profile_action ikpu_action_entries[] = {
422422
{
423423
NPC_ERRLEV_RE, NPC_EC_NOERR,
424424
12, 16, 20, 0, 0,
@@ -997,7 +997,7 @@ static struct npc_kpu_profile_action ikpu_action_entries[] = {
997997
},
998998
};
999999

1000-
static struct npc_kpu_profile_cam kpu1_cam_entries[] = {
1000+
static const struct npc_kpu_profile_cam kpu1_cam_entries[] = {
10011001
{
10021002
NPC_S_KPU1_ETHER, 0xff,
10031003
NPC_ETYPE_IP,
@@ -1666,7 +1666,7 @@ static struct npc_kpu_profile_cam kpu1_cam_entries[] = {
16661666
},
16671667
};
16681668

1669-
static struct npc_kpu_profile_cam kpu2_cam_entries[] = {
1669+
static const struct npc_kpu_profile_cam kpu2_cam_entries[] = {
16701670
{
16711671
NPC_S_KPU2_CTAG, 0xff,
16721672
NPC_ETYPE_IP,
@@ -2794,7 +2794,7 @@ static struct npc_kpu_profile_cam kpu2_cam_entries[] = {
27942794
},
27952795
};
27962796

2797-
static struct npc_kpu_profile_cam kpu3_cam_entries[] = {
2797+
static const struct npc_kpu_profile_cam kpu3_cam_entries[] = {
27982798
{
27992799
NPC_S_KPU3_CTAG, 0xff,
28002800
NPC_ETYPE_IP,
@@ -3913,7 +3913,7 @@ static struct npc_kpu_profile_cam kpu3_cam_entries[] = {
39133913
},
39143914
};
39153915

3916-
static struct npc_kpu_profile_cam kpu4_cam_entries[] = {
3916+
static const struct npc_kpu_profile_cam kpu4_cam_entries[] = {
39173917
{
39183918
NPC_S_KPU4_MPLS, 0xff,
39193919
NPC_MPLS_S,
@@ -4006,7 +4006,7 @@ static struct npc_kpu_profile_cam kpu4_cam_entries[] = {
40064006
},
40074007
};
40084008

4009-
static struct npc_kpu_profile_cam kpu5_cam_entries[] = {
4009+
static const struct npc_kpu_profile_cam kpu5_cam_entries[] = {
40104010
{
40114011
NPC_S_KPU5_IP, 0xff,
40124012
0x0000,
@@ -4576,7 +4576,7 @@ static struct npc_kpu_profile_cam kpu5_cam_entries[] = {
45764576
},
45774577
};
45784578

4579-
static struct npc_kpu_profile_cam kpu6_cam_entries[] = {
4579+
static const struct npc_kpu_profile_cam kpu6_cam_entries[] = {
45804580
{
45814581
NPC_S_KPU6_IP6_EXT, 0xff,
45824582
0x0000,
@@ -4921,7 +4921,7 @@ static struct npc_kpu_profile_cam kpu6_cam_entries[] = {
49214921
},
49224922
};
49234923

4924-
static struct npc_kpu_profile_cam kpu7_cam_entries[] = {
4924+
static const struct npc_kpu_profile_cam kpu7_cam_entries[] = {
49254925
{
49264926
NPC_S_KPU7_IP6_EXT, 0xff,
49274927
0x0000,
@@ -5140,7 +5140,7 @@ static struct npc_kpu_profile_cam kpu7_cam_entries[] = {
51405140
},
51415141
};
51425142

5143-
static struct npc_kpu_profile_cam kpu8_cam_entries[] = {
5143+
static const struct npc_kpu_profile_cam kpu8_cam_entries[] = {
51445144
{
51455145
NPC_S_KPU8_TCP, 0xff,
51465146
0x0000,
@@ -5872,7 +5872,7 @@ static struct npc_kpu_profile_cam kpu8_cam_entries[] = {
58725872
},
58735873
};
58745874

5875-
static struct npc_kpu_profile_cam kpu9_cam_entries[] = {
5875+
static const struct npc_kpu_profile_cam kpu9_cam_entries[] = {
58765876
{
58775877
NPC_S_KPU9_TU_MPLS_IN_GRE, 0xff,
58785878
NPC_MPLS_S,
@@ -6334,7 +6334,7 @@ static struct npc_kpu_profile_cam kpu9_cam_entries[] = {
63346334
},
63356335
};
63366336

6337-
static struct npc_kpu_profile_cam kpu10_cam_entries[] = {
6337+
static const struct npc_kpu_profile_cam kpu10_cam_entries[] = {
63386338
{
63396339
NPC_S_KPU10_TU_MPLS, 0xff,
63406340
NPC_MPLS_S,
@@ -6499,7 +6499,7 @@ static struct npc_kpu_profile_cam kpu10_cam_entries[] = {
64996499
},
65006500
};
65016501

6502-
static struct npc_kpu_profile_cam kpu11_cam_entries[] = {
6502+
static const struct npc_kpu_profile_cam kpu11_cam_entries[] = {
65036503
{
65046504
NPC_S_KPU11_TU_ETHER, 0xff,
65056505
NPC_ETYPE_IP,
@@ -6808,7 +6808,7 @@ static struct npc_kpu_profile_cam kpu11_cam_entries[] = {
68086808
},
68096809
};
68106810

6811-
static struct npc_kpu_profile_cam kpu12_cam_entries[] = {
6811+
static const struct npc_kpu_profile_cam kpu12_cam_entries[] = {
68126812
{
68136813
NPC_S_KPU12_TU_IP, 0xff,
68146814
NPC_IPNH_TCP,
@@ -7063,7 +7063,7 @@ static struct npc_kpu_profile_cam kpu12_cam_entries[] = {
70637063
},
70647064
};
70657065

7066-
static struct npc_kpu_profile_cam kpu13_cam_entries[] = {
7066+
static const struct npc_kpu_profile_cam kpu13_cam_entries[] = {
70677067
{
70687068
NPC_S_KPU13_TU_IP6_EXT, 0xff,
70697069
0x0000,
@@ -7075,7 +7075,7 @@ static struct npc_kpu_profile_cam kpu13_cam_entries[] = {
70757075
},
70767076
};
70777077

7078-
static struct npc_kpu_profile_cam kpu14_cam_entries[] = {
7078+
static const struct npc_kpu_profile_cam kpu14_cam_entries[] = {
70797079
{
70807080
NPC_S_KPU14_TU_IP6_EXT, 0xff,
70817081
0x0000,
@@ -7087,7 +7087,7 @@ static struct npc_kpu_profile_cam kpu14_cam_entries[] = {
70877087
},
70887088
};
70897089

7090-
static struct npc_kpu_profile_cam kpu15_cam_entries[] = {
7090+
static const struct npc_kpu_profile_cam kpu15_cam_entries[] = {
70917091
{
70927092
NPC_S_KPU15_TU_TCP, 0xff,
70937093
0x0000,
@@ -7288,7 +7288,7 @@ static struct npc_kpu_profile_cam kpu15_cam_entries[] = {
72887288
},
72897289
};
72907290

7291-
static struct npc_kpu_profile_cam kpu16_cam_entries[] = {
7291+
static const struct npc_kpu_profile_cam kpu16_cam_entries[] = {
72927292
{
72937293
NPC_S_KPU16_TCP_DATA, 0xff,
72947294
0x0000,
@@ -7345,7 +7345,7 @@ static struct npc_kpu_profile_cam kpu16_cam_entries[] = {
73457345
},
73467346
};
73477347

7348-
static struct npc_kpu_profile_action kpu1_action_entries[] = {
7348+
static const struct npc_kpu_profile_action kpu1_action_entries[] = {
73497349
{
73507350
NPC_ERRLEV_RE, NPC_EC_NOERR,
73517351
8, 0, 6, 3, 0,
@@ -7962,7 +7962,7 @@ static struct npc_kpu_profile_action kpu1_action_entries[] = {
79627962
},
79637963
};
79647964

7965-
static struct npc_kpu_profile_action kpu2_action_entries[] = {
7965+
static const struct npc_kpu_profile_action kpu2_action_entries[] = {
79667966
{
79677967
NPC_ERRLEV_RE, NPC_EC_NOERR,
79687968
8, 0, 6, 2, 0,
@@ -8965,7 +8965,7 @@ static struct npc_kpu_profile_action kpu2_action_entries[] = {
89658965
},
89668966
};
89678967

8968-
static struct npc_kpu_profile_action kpu3_action_entries[] = {
8968+
static const struct npc_kpu_profile_action kpu3_action_entries[] = {
89698969
{
89708970
NPC_ERRLEV_RE, NPC_EC_NOERR,
89718971
8, 0, 6, 1, 0,
@@ -9960,7 +9960,7 @@ static struct npc_kpu_profile_action kpu3_action_entries[] = {
99609960
},
99619961
};
99629962

9963-
static struct npc_kpu_profile_action kpu4_action_entries[] = {
9963+
static const struct npc_kpu_profile_action kpu4_action_entries[] = {
99649964
{
99659965
NPC_ERRLEV_RE, NPC_EC_NOERR,
99669966
0, 0, 0, 0, 0,
@@ -10043,7 +10043,7 @@ static struct npc_kpu_profile_action kpu4_action_entries[] = {
1004310043
},
1004410044
};
1004510045

10046-
static struct npc_kpu_profile_action kpu5_action_entries[] = {
10046+
static const struct npc_kpu_profile_action kpu5_action_entries[] = {
1004710047
{
1004810048
NPC_ERRLEV_LC, NPC_EC_IP_TTL_0,
1004910049
0, 0, 0, 0, 1,
@@ -10550,7 +10550,7 @@ static struct npc_kpu_profile_action kpu5_action_entries[] = {
1055010550
},
1055110551
};
1055210552

10553-
static struct npc_kpu_profile_action kpu6_action_entries[] = {
10553+
static const struct npc_kpu_profile_action kpu6_action_entries[] = {
1055410554
{
1055510555
NPC_ERRLEV_RE, NPC_EC_NOERR,
1055610556
0, 0, 0, 0, 1,
@@ -10857,7 +10857,7 @@ static struct npc_kpu_profile_action kpu6_action_entries[] = {
1085710857
},
1085810858
};
1085910859

10860-
static struct npc_kpu_profile_action kpu7_action_entries[] = {
10860+
static const struct npc_kpu_profile_action kpu7_action_entries[] = {
1086110861
{
1086210862
NPC_ERRLEV_RE, NPC_EC_NOERR,
1086310863
0, 0, 0, 0, 1,
@@ -11052,7 +11052,7 @@ static struct npc_kpu_profile_action kpu7_action_entries[] = {
1105211052
},
1105311053
};
1105411054

11055-
static struct npc_kpu_profile_action kpu8_action_entries[] = {
11055+
static const struct npc_kpu_profile_action kpu8_action_entries[] = {
1105611056
{
1105711057
NPC_ERRLEV_LD, NPC_EC_TCP_FLAGS_FIN_ONLY,
1105811058
0, 0, 0, 0, 1,
@@ -11703,7 +11703,7 @@ static struct npc_kpu_profile_action kpu8_action_entries[] = {
1170311703
},
1170411704
};
1170511705

11706-
static struct npc_kpu_profile_action kpu9_action_entries[] = {
11706+
static const struct npc_kpu_profile_action kpu9_action_entries[] = {
1170711707
{
1170811708
NPC_ERRLEV_RE, NPC_EC_NOERR,
1170911709
0, 0, 0, 0, 0,
@@ -12114,7 +12114,7 @@ static struct npc_kpu_profile_action kpu9_action_entries[] = {
1211412114
},
1211512115
};
1211612116

12117-
static struct npc_kpu_profile_action kpu10_action_entries[] = {
12117+
static const struct npc_kpu_profile_action kpu10_action_entries[] = {
1211812118
{
1211912119
NPC_ERRLEV_RE, NPC_EC_NOERR,
1212012120
8, 0, 6, 1, 0,
@@ -12261,7 +12261,7 @@ static struct npc_kpu_profile_action kpu10_action_entries[] = {
1226112261
},
1226212262
};
1226312263

12264-
static struct npc_kpu_profile_action kpu11_action_entries[] = {
12264+
static const struct npc_kpu_profile_action kpu11_action_entries[] = {
1226512265
{
1226612266
NPC_ERRLEV_RE, NPC_EC_NOERR,
1226712267
8, 0, 6, 0, 0,
@@ -12536,7 +12536,7 @@ static struct npc_kpu_profile_action kpu11_action_entries[] = {
1253612536
},
1253712537
};
1253812538

12539-
static struct npc_kpu_profile_action kpu12_action_entries[] = {
12539+
static const struct npc_kpu_profile_action kpu12_action_entries[] = {
1254012540
{
1254112541
NPC_ERRLEV_RE, NPC_EC_NOERR,
1254212542
2, 12, 0, 2, 0,
@@ -12763,7 +12763,7 @@ static struct npc_kpu_profile_action kpu12_action_entries[] = {
1276312763
},
1276412764
};
1276512765

12766-
static struct npc_kpu_profile_action kpu13_action_entries[] = {
12766+
static const struct npc_kpu_profile_action kpu13_action_entries[] = {
1276712767
{
1276812768
NPC_ERRLEV_RE, NPC_EC_NOERR,
1276912769
0, 0, 0, 0, 1,
@@ -12774,7 +12774,7 @@ static struct npc_kpu_profile_action kpu13_action_entries[] = {
1277412774
},
1277512775
};
1277612776

12777-
static struct npc_kpu_profile_action kpu14_action_entries[] = {
12777+
static const struct npc_kpu_profile_action kpu14_action_entries[] = {
1277812778
{
1277912779
NPC_ERRLEV_RE, NPC_EC_NOERR,
1278012780
0, 0, 0, 0, 1,
@@ -12785,7 +12785,7 @@ static struct npc_kpu_profile_action kpu14_action_entries[] = {
1278512785
},
1278612786
};
1278712787

12788-
static struct npc_kpu_profile_action kpu15_action_entries[] = {
12788+
static const struct npc_kpu_profile_action kpu15_action_entries[] = {
1278912789
{
1279012790
NPC_ERRLEV_LG, NPC_EC_TCP_FLAGS_FIN_ONLY,
1279112791
0, 0, 0, 0, 1,
@@ -12964,7 +12964,7 @@ static struct npc_kpu_profile_action kpu15_action_entries[] = {
1296412964
},
1296512965
};
1296612966

12967-
static struct npc_kpu_profile_action kpu16_action_entries[] = {
12967+
static const struct npc_kpu_profile_action kpu16_action_entries[] = {
1296812968
{
1296912969
NPC_ERRLEV_RE, NPC_EC_NOERR,
1297012970
0, 0, 0, 0, 1,
@@ -13015,7 +13015,7 @@ static struct npc_kpu_profile_action kpu16_action_entries[] = {
1301513015
},
1301613016
};
1301713017

13018-
static struct npc_kpu_profile npc_kpu_profiles[] = {
13018+
static const struct npc_kpu_profile npc_kpu_profiles[] = {
1301913019
{
1302013020
ARRAY_SIZE(kpu1_cam_entries),
1302113021
ARRAY_SIZE(kpu1_action_entries),

drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ static void npc_load_mkex_profile(struct rvu *rvu, int blkaddr)
906906
}
907907

908908
static void npc_config_kpuaction(struct rvu *rvu, int blkaddr,
909-
struct npc_kpu_profile_action *kpuaction,
909+
const struct npc_kpu_profile_action *kpuaction,
910910
int kpu, int entry, bool pkind)
911911
{
912912
struct npc_kpu_action0 action0 = {0};
@@ -948,7 +948,7 @@ static void npc_config_kpuaction(struct rvu *rvu, int blkaddr,
948948
}
949949

950950
static void npc_config_kpucam(struct rvu *rvu, int blkaddr,
951-
struct npc_kpu_profile_cam *kpucam,
951+
const struct npc_kpu_profile_cam *kpucam,
952952
int kpu, int entry)
953953
{
954954
struct npc_kpu_cam cam0 = {0};
@@ -976,7 +976,7 @@ static inline u64 enable_mask(int count)
976976
}
977977

978978
static void npc_program_kpu_profile(struct rvu *rvu, int blkaddr, int kpu,
979-
struct npc_kpu_profile *profile)
979+
const struct npc_kpu_profile *profile)
980980
{
981981
int entry, num_entries, max_entries;
982982

0 commit comments

Comments
 (0)