octeontx2-af: Constify npc_kpu_profile_{action,cam}
PATCH 1/1 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
--- .../net/ethernet/marvell/octeontx2/af/npc.h | 4 +- .../marvell/octeontx2/af/npc_profile.h | 68 +++++++++---------- .../ethernet/marvell/octeontx2/af/rvu_npc.c | 6 +- 3 files changed, 39 insertions(+), 39 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/npc.h +2 -2
@@ -173,8 +173,8 @@ struct npc_kpu_profile_action {struct npc_kpu_profile {int cam_entries;int action_entries; -struct npc_kpu_profile_cam *cam; -struct npc_kpu_profile_action *action; +const struct npc_kpu_profile_cam *cam; +const struct npc_kpu_profile_action *action; };/* NPC KPU register formats */
drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h +34 -34
272 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +3 -3
@@ -906,7 +906,7 @@ static void npc_load_mkex_profile(struct rvu *rvu, int blkaddr) }static void npc_config_kpuaction (struct rvu *rvu,int blkaddr, -struct npc_kpu_profile_action *kpuaction, +const struct npc_kpu_profile_action *kpuaction,int kpu,int entry,bool pkind) {struct npc_kpu_action0 action0 = {0 };
@@ -948,7 +948,7 @@ static void npc_config_kpuaction(struct rvu *rvu, int blkaddr, }static void npc_config_kpucam (struct rvu *rvu,int blkaddr, -struct npc_kpu_profile_cam *kpucam, +const struct npc_kpu_profile_cam *kpucam,int kpu,int entry) {struct npc_kpu_cam cam0 = {0 };
@@ -976,7 +976,7 @@ static inline u64 enable_mask(int count) }static void npc_program_kpu_profile (struct rvu *rvu,int blkaddr,int kpu, -struct npc_kpu_profile *profile) +const struct npc_kpu_profile *profile) {int entry, num_entries, max_entries;
Signature · 1 line
2.28.0
From: Rikard Falkeborn <[email protected]>
Date: Sat, 12 Sep 2020 00:00:15 +0200
Quoted 8 lines
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 589a3drivers/net/ethernet/marvell/octeontx2/af/octeontx2_af.ko
Quoted 5 lines
After:
text data bss dec hex filename
321003 40664 1248 362915 589a3drivers/net/ethernet/marvell/octeontx2/af/octeontx2_af.koSigned-off-by Rikard Falkeborn <[email protected]>
Applied, thank you.
Quoted 3 lines · Rikard Falkeborn
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.
Nice.
Did you find this by tool or inspection?
Quoted 10 lines · Joe Perches
Quoted 3 lines · Rikard Falkeborn
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.
Nice.
Did you find this by tool or inspection?
Inspection, aided by some semi-clever greping.