Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: replace ADDRLABEL with dynamic debug

ADDRLABEL only works when it was set in compilation phase. Replace it with
net_dbg_ratelimited().

Signed-off-by: Wang Liang <wangliang74@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250702104417.1526138-1-wangliang74@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Wang Liang and committed by
Paolo Abeni
5d288658 84a7d679

+11 -21
+11 -21
net/ipv6/addrlabel.c
··· 20 20 #include <linux/netlink.h> 21 21 #include <linux/rtnetlink.h> 22 22 23 - #if 0 24 - #define ADDRLABEL(x...) printk(x) 25 - #else 26 - #define ADDRLABEL(x...) do { ; } while (0) 27 - #endif 28 - 29 23 /* 30 24 * Policy Table 31 25 */ ··· 144 150 label = p ? p->label : IPV6_ADDR_LABEL_DEFAULT; 145 151 rcu_read_unlock(); 146 152 147 - ADDRLABEL(KERN_DEBUG "%s(addr=%pI6, type=%d, ifindex=%d) => %08x\n", 148 - __func__, addr, type, ifindex, label); 153 + net_dbg_ratelimited("%s(addr=%pI6, type=%d, ifindex=%d) => %08x\n", __func__, addr, type, 154 + ifindex, label); 149 155 150 156 return label; 151 157 } ··· 158 164 struct ip6addrlbl_entry *newp; 159 165 int addrtype; 160 166 161 - ADDRLABEL(KERN_DEBUG "%s(prefix=%pI6, prefixlen=%d, ifindex=%d, label=%u)\n", 162 - __func__, prefix, prefixlen, ifindex, (unsigned int)label); 167 + net_dbg_ratelimited("%s(prefix=%pI6, prefixlen=%d, ifindex=%d, label=%u)\n", __func__, 168 + prefix, prefixlen, ifindex, (unsigned int)label); 163 169 164 170 addrtype = ipv6_addr_type(prefix) & (IPV6_ADDR_MAPPED | IPV6_ADDR_COMPATv4 | IPV6_ADDR_LOOPBACK); 165 171 ··· 201 207 struct hlist_node *n; 202 208 int ret = 0; 203 209 204 - ADDRLABEL(KERN_DEBUG "%s(newp=%p, replace=%d)\n", __func__, newp, 205 - replace); 210 + net_dbg_ratelimited("%s(newp=%p, replace=%d)\n", __func__, newp, replace); 206 211 207 212 hlist_for_each_entry_safe(p, n, &net->ipv6.ip6addrlbl_table.head, list) { 208 213 if (p->prefixlen == newp->prefixlen && ··· 240 247 struct ip6addrlbl_entry *newp; 241 248 int ret = 0; 242 249 243 - ADDRLABEL(KERN_DEBUG "%s(prefix=%pI6, prefixlen=%d, ifindex=%d, label=%u, replace=%d)\n", 244 - __func__, prefix, prefixlen, ifindex, (unsigned int)label, 245 - replace); 250 + net_dbg_ratelimited("%s(prefix=%pI6, prefixlen=%d, ifindex=%d, label=%u, replace=%d)\n", 251 + __func__, prefix, prefixlen, ifindex, (unsigned int)label, replace); 246 252 247 253 newp = ip6addrlbl_alloc(prefix, prefixlen, ifindex, label); 248 254 if (IS_ERR(newp)) ··· 263 271 struct hlist_node *n; 264 272 int ret = -ESRCH; 265 273 266 - ADDRLABEL(KERN_DEBUG "%s(prefix=%pI6, prefixlen=%d, ifindex=%d)\n", 267 - __func__, prefix, prefixlen, ifindex); 274 + net_dbg_ratelimited("%s(prefix=%pI6, prefixlen=%d, ifindex=%d)\n", __func__, prefix, 275 + prefixlen, ifindex); 268 276 269 277 hlist_for_each_entry_safe(p, n, &net->ipv6.ip6addrlbl_table.head, list) { 270 278 if (p->prefixlen == prefixlen && ··· 286 294 struct in6_addr prefix_buf; 287 295 int ret; 288 296 289 - ADDRLABEL(KERN_DEBUG "%s(prefix=%pI6, prefixlen=%d, ifindex=%d)\n", 290 - __func__, prefix, prefixlen, ifindex); 297 + net_dbg_ratelimited("%s(prefix=%pI6, prefixlen=%d, ifindex=%d)\n", __func__, prefix, 298 + prefixlen, ifindex); 291 299 292 300 ipv6_addr_prefix(&prefix_buf, prefix, prefixlen); 293 301 spin_lock(&net->ipv6.ip6addrlbl_table.lock); ··· 303 311 struct hlist_node *n; 304 312 int err; 305 313 int i; 306 - 307 - ADDRLABEL(KERN_DEBUG "%s\n", __func__); 308 314 309 315 spin_lock_init(&net->ipv6.ip6addrlbl_table.lock); 310 316 INIT_HLIST_HEAD(&net->ipv6.ip6addrlbl_table.head);