I also fix commit 8b32ab9e6ef1: use nla_total_size_64bit() for OVS_FLOW_ATTR_USED in ovs_flow_cmd_msg_size().
Unified · Split
| @@ -84,6 +84,7 @@ enum ovs_datapath_attr { · 83 unmodified lines | ||
| 84 | 84 | OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */ |
| 85 | 85 | OVS_DP_ATTR_MEGAFLOW_STATS, /* struct ovs_dp_megaflow_stats */ |
| 86 | 86 | OVS_DP_ATTR_USER_FEATURES, /* OVS_DP_F_* */ |
| 87 | + OVS_DP_ATTR_PAD, | |
| 87 | 88 | __OVS_DP_ATTR_MAX |
| 88 | 89 | }; |
| 89 | 90 | |
| @@ -253,6 +254,7 @@ enum ovs_vport_attr { · 163 unmodified lines | ||
| 253 | 254 | OVS_VPORT_ATTR_UPCALL_PID, /* array of u32 Netlink socket PIDs for */ |
| 254 | 255 | /* receiving upcalls */ |
| 255 | 256 | OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */ |
| 257 | + OVS_VPORT_ATTR_PAD, | |
| 256 | 258 | __OVS_VPORT_ATTR_MAX |
| 257 | 259 | }; |
| 258 | 260 | |
| @@ -738,9 +738,9 @@ static size_t ovs_flow_cmd_msg_size(const struct sw_flow_actions *acts, · 737 unmodified lines | ||
| 738 | 738 | len += nla_total_size(acts->orig_len); |
| 739 | 739 | |
| 740 | 740 | return len |
| 741 | − + nla_total_size(sizeof(struct ovs_flow_stats)) /* OVS_FLOW_ATTR_STATS */ | |
| 741 | + + nla_total_size_64bit(sizeof(struct ovs_flow_stats)) /* OVS_FLOW_ATTR_STATS */ | |
| 742 | 742 | + nla_total_size(1) /* OVS_FLOW_ATTR_TCP_FLAGS */ |
| 743 | − + nla_total_size(8); /* OVS_FLOW_ATTR_USED */ | |
| 743 | + + nla_total_size_64bit(8); /* OVS_FLOW_ATTR_USED */ | |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | 746 | /* Called with ovs_mutex or RCU read lock. */ |
| @@ -759,7 +759,9 @@ static int ovs_flow_cmd_fill_stats(const struct sw_flow *flow, · 12 unmodified lines | ||
| 759 | 759 | return -EMSGSIZE; |
| 760 | 760 | |
| 761 | 761 | if (stats.n_packets && |
| 762 | − nla_put(skb, OVS_FLOW_ATTR_STATS, sizeof(struct ovs_flow_stats), &stats)) | |
| 762 | + nla_put_64bit(skb, OVS_FLOW_ATTR_STATS, | |
| 763 | + sizeof(struct ovs_flow_stats), &stats, | |
| 764 | + OVS_FLOW_ATTR_PAD)) | |
| 763 | 765 | return -EMSGSIZE; |
| 764 | 766 | |
| 765 | 767 | if ((u8)ntohs(tcp_flags) && |
| @@ -1435,8 +1437,8 @@ static size_t ovs_dp_cmd_msg_size(void) · 669 unmodified lines | ||
| 1435 | 1437 | size_t msgsize = NLMSG_ALIGN(sizeof(struct ovs_header)); |
| 1436 | 1438 | |
| 1437 | 1439 | msgsize += nla_total_size(IFNAMSIZ); |
| 1438 | − msgsize += nla_total_size(sizeof(struct ovs_dp_stats)); | |
| 1439 | − msgsize += nla_total_size(sizeof(struct ovs_dp_megaflow_stats)); | |
| 1440 | + msgsize += nla_total_size_64bit(sizeof(struct ovs_dp_stats)); | |
| 1441 | + msgsize += nla_total_size_64bit(sizeof(struct ovs_dp_megaflow_stats)); | |
| 1440 | 1442 | msgsize += nla_total_size(sizeof(u32)); /* OVS_DP_ATTR_USER_FEATURES */ |
| 1441 | 1443 | |
| 1442 | 1444 | return msgsize; |
| @@ -1463,13 +1465,13 @@ static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb, · 20 unmodified lines | ||
| 1463 | 1465 | goto nla_put_failure; |
| 1464 | 1466 | |
| 1465 | 1467 | get_dp_stats(dp, &dp_stats, &dp_megaflow_stats); |
| 1466 | − if (nla_put(skb, OVS_DP_ATTR_STATS, sizeof(struct ovs_dp_stats), | |
| 1467 | − &dp_stats)) | |
| 1468 | + if (nla_put_64bit(skb, OVS_DP_ATTR_STATS, sizeof(struct ovs_dp_stats), | |
| 1469 | + &dp_stats, OVS_DP_ATTR_PAD)) | |
| 1468 | 1470 | goto nla_put_failure; |
| 1469 | 1471 | |
| 1470 | − if (nla_put(skb, OVS_DP_ATTR_MEGAFLOW_STATS, | |
| 1471 | − sizeof(struct ovs_dp_megaflow_stats), | |
| 1472 | − &dp_megaflow_stats)) | |
| 1472 | + if (nla_put_64bit(skb, OVS_DP_ATTR_MEGAFLOW_STATS, | |
| 1473 | + sizeof(struct ovs_dp_megaflow_stats), | |
| 1474 | + &dp_megaflow_stats, OVS_DP_ATTR_PAD)) | |
| 1473 | 1475 | goto nla_put_failure; |
| 1474 | 1476 | |
| 1475 | 1477 | if (nla_put_u32(skb, OVS_DP_ATTR_USER_FEATURES, dp->user_features)) |
| @@ -1838,8 +1840,9 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, · 362 unmodified lines | ||
| 1838 | 1840 | goto nla_put_failure; |
| 1839 | 1841 | |
| 1840 | 1842 | ovs_vport_get_stats(vport, &vport_stats); |
| 1841 | − if (nla_put(skb, OVS_VPORT_ATTR_STATS, sizeof(struct ovs_vport_stats), | |
| 1842 | − &vport_stats)) | |
| 1843 | + if (nla_put_64bit(skb, OVS_VPORT_ATTR_STATS, | |
| 1844 | + sizeof(struct ovs_vport_stats), &vport_stats, | |
| 1845 | + OVS_VPORT_ATTR_PAD)) | |
| 1843 | 1846 | goto nla_put_failure; |
| 1844 | 1847 | |
| 1845 | 1848 | if (ovs_vport_get_upcall_portids(vport, skb)) |