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

openvswitch: fix alignment issues

Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Mark Gray and committed by
David S. Miller
784dcfa5 e4252cb6

+16 -10
+2 -2
include/uapi/linux/openvswitch.h
··· 89 89 OVS_DP_ATTR_USER_FEATURES, /* OVS_DP_F_* */ 90 90 OVS_DP_ATTR_PAD, 91 91 OVS_DP_ATTR_MASKS_CACHE_SIZE, 92 - OVS_DP_ATTR_PER_CPU_PIDS, /* Netlink PIDS to receive upcalls in per-cpu 93 - * dispatch mode 92 + OVS_DP_ATTR_PER_CPU_PIDS, /* Netlink PIDS to receive upcalls in 93 + * per-cpu dispatch mode 94 94 */ 95 95 __OVS_DP_ATTR_MAX 96 96 };
+4 -2
net/openvswitch/actions.c
··· 924 924 break; 925 925 926 926 case OVS_USERSPACE_ATTR_PID: 927 - if (dp->user_features & OVS_DP_F_DISPATCH_UPCALL_PER_CPU) 927 + if (dp->user_features & 928 + OVS_DP_F_DISPATCH_UPCALL_PER_CPU) 928 929 upcall.portid = 929 - ovs_dp_get_upcall_portid(dp, smp_processor_id()); 930 + ovs_dp_get_upcall_portid(dp, 931 + smp_processor_id()); 930 932 else 931 933 upcall.portid = nla_get_u32(a); 932 934 break;
+10 -6
net/openvswitch/datapath.c
··· 244 244 upcall.cmd = OVS_PACKET_CMD_MISS; 245 245 246 246 if (dp->user_features & OVS_DP_F_DISPATCH_UPCALL_PER_CPU) 247 - upcall.portid = ovs_dp_get_upcall_portid(dp, smp_processor_id()); 247 + upcall.portid = 248 + ovs_dp_get_upcall_portid(dp, smp_processor_id()); 248 249 else 249 250 upcall.portid = ovs_vport_find_upcall_portid(p, skb); 250 251 ··· 1637 1636 if (dp_nlsk_pids) { 1638 1637 if (cpu_id < dp_nlsk_pids->n_pids) { 1639 1638 return dp_nlsk_pids->pids[cpu_id]; 1640 - } else if (dp_nlsk_pids->n_pids > 0 && cpu_id >= dp_nlsk_pids->n_pids) { 1641 - /* If the number of netlink PIDs is mismatched with the number of 1642 - * CPUs as seen by the kernel, log this and send the upcall to an 1643 - * arbitrary socket (0) in order to not drop packets 1639 + } else if (dp_nlsk_pids->n_pids > 0 && 1640 + cpu_id >= dp_nlsk_pids->n_pids) { 1641 + /* If the number of netlink PIDs is mismatched with 1642 + * the number of CPUs as seen by the kernel, log this 1643 + * and send the upcall to an arbitrary socket (0) in 1644 + * order to not drop packets 1644 1645 */ 1645 1646 pr_info_ratelimited("cpu_id mismatch with handler threads"); 1646 - return dp_nlsk_pids->pids[cpu_id % dp_nlsk_pids->n_pids]; 1647 + return dp_nlsk_pids->pids[cpu_id % 1648 + dp_nlsk_pids->n_pids]; 1647 1649 } else { 1648 1650 return 0; 1649 1651 }