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

net: openvswitch: add misc error drop reasons

Use drop reasons from include/net/dropreason-core.h when a reasonable
candidate exists.

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Adrian Moreno and committed by
David S. Miller
43d95b30 f329d1bc

+18 -8
+10 -7
net/openvswitch/actions.c
··· 782 782 struct vport *vport = data->vport; 783 783 784 784 if (skb_cow_head(skb, data->l2_len) < 0) { 785 - kfree_skb(skb); 785 + kfree_skb_reason(skb, SKB_DROP_REASON_NOMEM); 786 786 return -ENOMEM; 787 787 } 788 788 ··· 853 853 struct sk_buff *skb, u16 mru, 854 854 struct sw_flow_key *key) 855 855 { 856 + enum ovs_drop_reason reason; 856 857 u16 orig_network_offset = 0; 857 858 858 859 if (eth_p_mpls(skb->protocol)) { ··· 863 862 864 863 if (skb_network_offset(skb) > MAX_L2_LEN) { 865 864 OVS_NLERR(1, "L2 header too long to fragment"); 865 + reason = OVS_DROP_FRAG_L2_TOO_LONG; 866 866 goto err; 867 867 } 868 868 ··· 904 902 WARN_ONCE(1, "Failed fragment ->%s: eth=%04x, MRU=%d, MTU=%d.", 905 903 ovs_vport_name(vport), ntohs(key->eth.type), mru, 906 904 vport->dev->mtu); 905 + reason = OVS_DROP_FRAG_INVALID_PROTO; 907 906 goto err; 908 907 } 909 908 910 909 return; 911 910 err: 912 - kfree_skb(skb); 911 + ovs_kfree_skb_reason(skb, reason); 913 912 } 914 913 915 914 static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port, ··· 937 934 938 935 ovs_fragment(net, vport, skb, mru, key); 939 936 } else { 940 - kfree_skb(skb); 937 + kfree_skb_reason(skb, SKB_DROP_REASON_PKT_TOO_BIG); 941 938 } 942 939 } else { 943 - kfree_skb(skb); 940 + kfree_skb_reason(skb, SKB_DROP_REASON_DEV_READY); 944 941 } 945 942 } 946 943 ··· 1014 1011 return clone_execute(dp, skb, key, 0, nla_data(actions), 1015 1012 nla_len(actions), true, false); 1016 1013 1017 - consume_skb(skb); 1014 + ovs_kfree_skb_reason(skb, OVS_DROP_IP_TTL); 1018 1015 return 0; 1019 1016 } 1020 1017 ··· 1567 1564 /* Out of per CPU action FIFO space. Drop the 'skb' and 1568 1565 * log an error. 1569 1566 */ 1570 - kfree_skb(skb); 1567 + ovs_kfree_skb_reason(skb, OVS_DROP_DEFERRED_LIMIT); 1571 1568 1572 1569 if (net_ratelimit()) { 1573 1570 if (actions) { /* Sample action */ ··· 1619 1616 if (unlikely(level > OVS_RECURSION_LIMIT)) { 1620 1617 net_crit_ratelimited("ovs: recursion limit reached on datapath %s, probable configuration error\n", 1621 1618 ovs_dp_name(dp)); 1622 - kfree_skb(skb); 1619 + ovs_kfree_skb_reason(skb, OVS_DROP_RECURSION_LIMIT); 1623 1620 err = -ENETDOWN; 1624 1621 goto out; 1625 1622 }
+2 -1
net/openvswitch/conntrack.c
··· 29 29 #include <net/netfilter/nf_conntrack_act_ct.h> 30 30 31 31 #include "datapath.h" 32 + #include "drop.h" 32 33 #include "conntrack.h" 33 34 #include "flow.h" 34 35 #include "flow_netlink.h" ··· 1036 1035 1037 1036 skb_push_rcsum(skb, nh_ofs); 1038 1037 if (err) 1039 - kfree_skb(skb); 1038 + ovs_kfree_skb_reason(skb, OVS_DROP_CONNTRACK); 1040 1039 return err; 1041 1040 } 1042 1041
+6
net/openvswitch/drop.h
··· 14 14 R(OVS_DROP_EXPLICIT) \ 15 15 R(OVS_DROP_EXPLICIT_WITH_ERROR) \ 16 16 R(OVS_DROP_METER) \ 17 + R(OVS_DROP_RECURSION_LIMIT) \ 18 + R(OVS_DROP_DEFERRED_LIMIT) \ 19 + R(OVS_DROP_FRAG_L2_TOO_LONG) \ 20 + R(OVS_DROP_FRAG_INVALID_PROTO) \ 21 + R(OVS_DROP_CONNTRACK) \ 22 + R(OVS_DROP_IP_TTL) \ 17 23 /* deliberate comment for trailing \ */ 18 24 19 25 enum ovs_drop_reason {