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

net: ipv4: Notify about changes to ip_forward_update_priority

Drivers may make offloading decision based on whether
ip_forward_update_priority is enabled or not. Therefore distribute
netevent notifications to give them a chance to react to a change.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Petr Machata and committed by
David S. Miller
d18c5d19 432e05d3

+19 -1
+1
include/net/netevent.h
··· 28 28 NETEVENT_DELAY_PROBE_TIME_UPDATE, /* arg is struct neigh_parms ptr */ 29 29 NETEVENT_IPV4_MPATH_HASH_UPDATE, /* arg is struct net ptr */ 30 30 NETEVENT_IPV6_MPATH_HASH_UPDATE, /* arg is struct net ptr */ 31 + NETEVENT_IPV4_FWD_UPDATE_PRIORITY_UPDATE, /* arg is struct net ptr */ 31 32 }; 32 33 33 34 int register_netevent_notifier(struct notifier_block *nb);
+18 -1
net/ipv4/sysctl_net_ipv4.c
··· 201 201 return ret; 202 202 } 203 203 204 + static int ipv4_fwd_update_priority(struct ctl_table *table, int write, 205 + void __user *buffer, 206 + size_t *lenp, loff_t *ppos) 207 + { 208 + struct net *net; 209 + int ret; 210 + 211 + net = container_of(table->data, struct net, 212 + ipv4.sysctl_ip_fwd_update_priority); 213 + ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); 214 + if (write && ret == 0) 215 + call_netevent_notifiers(NETEVENT_IPV4_FWD_UPDATE_PRIORITY_UPDATE, 216 + net); 217 + 218 + return ret; 219 + } 220 + 204 221 static int proc_tcp_congestion_control(struct ctl_table *ctl, int write, 205 222 void __user *buffer, size_t *lenp, loff_t *ppos) 206 223 { ··· 685 668 .data = &init_net.ipv4.sysctl_ip_fwd_update_priority, 686 669 .maxlen = sizeof(int), 687 670 .mode = 0644, 688 - .proc_handler = proc_dointvec_minmax, 671 + .proc_handler = ipv4_fwd_update_priority, 689 672 .extra1 = &zero, 690 673 .extra2 = &one, 691 674 },