From patchwork Wed Feb 28 08:00:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Pettit X-Patchwork-Id: 878982 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zrp2T6SS7z9s0q for ; Wed, 28 Feb 2018 19:02:41 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2B8F1DC2; Wed, 28 Feb 2018 08:01:57 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id A52819CE for ; Wed, 28 Feb 2018 08:01:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 8AD46477 for ; Wed, 28 Feb 2018 08:01:52 +0000 (UTC) X-Originating-IP: 98.234.50.139 Received: from localhost.localdomain (unknown [98.234.50.139]) (Authenticated sender: jpettit@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id E158E41C0A3 for ; Wed, 28 Feb 2018 09:01:50 +0100 (CET) From: Justin Pettit To: dev@openvswitch.org Date: Wed, 28 Feb 2018 00:00:56 -0800 Message-Id: <1519804863-73126-2-git-send-email-jpettit@ovn.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519804863-73126-1-git-send-email-jpettit@ovn.org> References: <1519804863-73126-1-git-send-email-jpettit@ovn.org> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [shadow 1/8] Don't shadow global VLOG "rl" definition. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Signed-off-by: Justin Pettit Acked-by: Ben Pfaff --- lib/netdev-linux.c | 8 ++++---- lib/ofp-actions.c | 18 +++++++++--------- lib/ofp-port.c | 4 ++-- ofproto/connmgr.c | 4 ++-- ofproto/ofproto-dpif-upcall.c | 15 ++++++++------- ofproto/ofproto-dpif.c | 12 ++++++------ ofproto/ofproto.c | 4 ++-- 7 files changed, 33 insertions(+), 32 deletions(-) diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 4e0473cf331f..b3ef0f7c0615 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -635,7 +635,6 @@ netdev_linux_run(const struct netdev_class *netdev_class OVS_UNUSED) } do { - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); uint64_t buf_stub[4096 / 8]; struct ofpbuf buf; @@ -686,7 +685,8 @@ netdev_linux_run(const struct netdev_class *netdev_class OVS_UNUSED) } shash_destroy(&device_shash); } else if (error != EAGAIN) { - VLOG_WARN_RL(&rl, "error reading or parsing netlink (%s)", + static struct vlog_rate_limit rll = VLOG_RATE_LIMIT_INIT(1, 5); + VLOG_WARN_RL(&rll, "error reading or parsing netlink (%s)", ovs_strerror(error)); } ofpbuf_uninit(&buf); @@ -789,8 +789,8 @@ netdev_linux_common_construct(struct netdev *netdev_) struct netdev_linux *netdev = netdev_linux_cast(netdev_); const char *name = netdev_->name; if (!strcmp(name, "default") || !strcmp(name, "all")) { - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1); - VLOG_WARN_RL(&rl, "%s: Linux forbids network device with this name", + static struct vlog_rate_limit rll = VLOG_RATE_LIMIT_INIT(1, 1); + VLOG_WARN_RL(&rll, "%s: Linux forbids network device with this name", name); return EINVAL; } diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 7c076f65f985..db857162e566 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -1318,7 +1318,7 @@ decode_bundle(bool load, const struct nx_action_bundle *nab, const struct vl_mff_map *vl_mff_map, uint64_t *tlv_bitmap, struct ofpbuf *ofpacts) { - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); + static struct vlog_rate_limit rll = VLOG_RATE_LIMIT_INIT(1, 5); struct ofpact_bundle *bundle; uint32_t slave_type; size_t slaves_size, i; @@ -1335,20 +1335,20 @@ decode_bundle(bool load, const struct nx_action_bundle *nab, error = OFPERR_OFPBAC_BAD_ARGUMENT; if (!flow_hash_fields_valid(bundle->fields)) { - VLOG_WARN_RL(&rl, "unsupported fields %d", (int) bundle->fields); + VLOG_WARN_RL(&rll, "unsupported fields %d", (int) bundle->fields); } else if (bundle->n_slaves > BUNDLE_MAX_SLAVES) { - VLOG_WARN_RL(&rl, "too many slaves"); + VLOG_WARN_RL(&rll, "too many slaves"); } else if (bundle->algorithm != NX_BD_ALG_HRW && bundle->algorithm != NX_BD_ALG_ACTIVE_BACKUP) { - VLOG_WARN_RL(&rl, "unsupported algorithm %d", (int) bundle->algorithm); + VLOG_WARN_RL(&rll, "unsupported algorithm %d", (int) bundle->algorithm); } else if (slave_type != mf_nxm_header(MFF_IN_PORT)) { - VLOG_WARN_RL(&rl, "unsupported slave type %"PRIu32, slave_type); + VLOG_WARN_RL(&rll, "unsupported slave type %"PRIu32, slave_type); } else { error = 0; } if (!is_all_zeros(nab->zero, sizeof nab->zero)) { - VLOG_WARN_RL(&rl, "reserved field is nonzero"); + VLOG_WARN_RL(&rll, "reserved field is nonzero"); error = OFPERR_OFPBAC_BAD_ARGUMENT; } @@ -1362,19 +1362,19 @@ decode_bundle(bool load, const struct nx_action_bundle *nab, } if (bundle->dst.n_bits < 16) { - VLOG_WARN_RL(&rl, "bundle_load action requires at least 16 bit " + VLOG_WARN_RL(&rll, "bundle_load action requires at least 16 bit " "destination."); error = OFPERR_OFPBAC_BAD_ARGUMENT; } } else { if (nab->ofs_nbits || nab->dst) { - VLOG_WARN_RL(&rl, "bundle action has nonzero reserved fields"); + VLOG_WARN_RL(&rll, "bundle action has nonzero reserved fields"); error = OFPERR_OFPBAC_BAD_ARGUMENT; } } if (slaves_size < bundle->n_slaves * sizeof(ovs_be16)) { - VLOG_WARN_RL(&rl, "Nicira action %s only has %"PRIuSIZE" bytes " + VLOG_WARN_RL(&rll, "Nicira action %s only has %"PRIuSIZE" bytes " "allocated for slaves. %"PRIuSIZE" bytes are required " "for %u slaves.", load ? "bundle_load" : "bundle", slaves_size, diff --git a/lib/ofp-port.c b/lib/ofp-port.c index 86562c9b47a5..cff37290eb33 100644 --- a/lib/ofp-port.c +++ b/lib/ofp-port.c @@ -91,8 +91,8 @@ ofputil_port_from_ofp11(ovs_be32 ofp11_port, ofp_port_t *ofp10_port) } else { *ofp10_port = OFPP_NONE; - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); - VLOG_WARN_RL(&rl, "port %"PRIu32" is outside the supported " + static struct vlog_rate_limit rll = VLOG_RATE_LIMIT_INIT(1, 5); + VLOG_WARN_RL(&rll, "port %"PRIu32" is outside the supported " "range 0 through %d or 0x%"PRIx32" through 0x%"PRIx32, ofp11_port_h, ofp_to_u16(OFPP_MAX) - 1, ofp11_to_u32(OFPP11_MAX), UINT32_MAX); diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c index e0e78a1e1a78..bf43fbd73182 100644 --- a/ofproto/connmgr.c +++ b/ofproto/connmgr.c @@ -1761,9 +1761,9 @@ do_send_packet_ins(struct ofconn *ofconn, struct ovs_list *txq) LIST_FOR_EACH_POP (pin, list_node, txq) { if (rconn_send_with_limit(ofconn->rconn, pin, ofconn->packet_in_counter, 100) == EAGAIN) { - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 5); + static struct vlog_rate_limit rll = VLOG_RATE_LIMIT_INIT(5, 5); - VLOG_INFO_RL(&rl, "%s: dropping packet-in due to queue overflow", + VLOG_INFO_RL(&rll, "%s: dropping packet-in due to queue overflow", rconn_get_name(ofconn->rconn)); } } diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index 23e459b06c66..e282a437e84a 100644 --- a/ofproto/ofproto-dpif-upcall.c +++ b/ofproto/ofproto-dpif-upcall.c @@ -1252,7 +1252,6 @@ upcall_cb(const struct dp_packet *packet, const struct flow *flow, ovs_u128 *ufi const struct nlattr *userdata, struct ofpbuf *actions, struct flow_wildcards *wc, struct ofpbuf *put_actions, void *aux) { - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1); struct udpif *udpif = aux; struct upcall upcall; bool megaflow; @@ -1287,7 +1286,8 @@ upcall_cb(const struct dp_packet *packet, const struct flow *flow, ovs_u128 *ufi } if (upcall.ukey && !ukey_install(udpif, upcall.ukey)) { - VLOG_WARN_RL(&rl, "upcall_cb failure: ukey installation fails"); + static struct vlog_rate_limit rll = VLOG_RATE_LIMIT_INIT(1, 1); + VLOG_WARN_RL(&rll, "upcall_cb failure: ukey installation fails"); error = ENOSPC; } out: @@ -2355,9 +2355,8 @@ push_dp_ops(struct udpif *udpif, struct ukey_op *ops, size_t n_ops) error = xlate_key(udpif, key, key_len, push, &ctx); if (error) { - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); - - VLOG_WARN_RL(&rl, "xlate_key failed (%s)!", + static struct vlog_rate_limit rll = VLOG_RATE_LIMIT_INIT(1, 5); + VLOG_WARN_RL(&rll, "xlate_key failed (%s)!", ovs_strerror(error)); } else { xlate_out_uninit(&ctx.xout); @@ -2390,13 +2389,15 @@ push_ukey_ops(struct udpif *udpif, struct umap *umap, static void log_unexpected_flow(const struct dpif_flow *flow, int error) { - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(10, 60); struct ds ds = DS_EMPTY_INITIALIZER; ds_put_format(&ds, "Failed to acquire udpif_key corresponding to " "unexpected flow (%s): ", ovs_strerror(error)); odp_format_ufid(&flow->ufid, &ds); - VLOG_WARN_RL(&rl, "%s", ds_cstr(&ds)); + + static struct vlog_rate_limit rll = VLOG_RATE_LIMIT_INIT(10, 60); + VLOG_WARN_RL(&rll, "%s", ds_cstr(&ds)); + ds_destroy(&ds); } diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 0fee6f9c5065..e28ce64c1934 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -3210,7 +3210,6 @@ bundle_remove(struct ofport *port_) static void send_pdu_cb(void *port_, const void *pdu, size_t pdu_size) { - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 10); struct ofport_dpif *port = port_; struct eth_addr ea; int error; @@ -3228,7 +3227,8 @@ send_pdu_cb(void *port_, const void *pdu, size_t pdu_size) ofproto_dpif_send_packet(port, false, &packet); dp_packet_uninit(&packet); } else { - VLOG_ERR_RL(&rl, "port %s: cannot obtain Ethernet address of iface " + static struct vlog_rate_limit rll = VLOG_RATE_LIMIT_INIT(1, 10); + VLOG_ERR_RL(&rll, "port %s: cannot obtain Ethernet address of iface " "%s (%s)", port->bundle->name, netdev_get_name(port->up.netdev), ovs_strerror(error)); } @@ -3275,8 +3275,8 @@ bundle_send_learning_packets(struct ofbundle *bundle) } if (n_errors) { - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); - VLOG_WARN_RL(&rl, "bond %s: %d errors sending %d gratuitous learning " + static struct vlog_rate_limit rll = VLOG_RATE_LIMIT_INIT(1, 5); + VLOG_WARN_RL(&rll, "bond %s: %d errors sending %d gratuitous learning " "packets, last error was: %s", bundle->name, n_errors, n_packets, ovs_strerror(error)); } else { @@ -4296,8 +4296,8 @@ check_mask(struct ofproto_dpif *ofproto, const struct miniflow *flow) static void report_unsupported_act(const char *action, const char *detail) { - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); - VLOG_WARN_RL(&rl, "Rejecting %s action because datapath does not support" + static struct vlog_rate_limit rll = VLOG_RATE_LIMIT_INIT(1, 5); + VLOG_WARN_RL(&rll, "Rejecting %s action because datapath does not support" "%s%s (your kernel module may be out of date)", action, detail ? " " : "", detail ? detail : ""); } diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index a982de9d8db4..0e73d4e82dd5 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -5131,8 +5131,8 @@ ofproto_flow_mod_learn(struct ofproto_flow_mod *ofm, bool keep_ref, ofproto_flow_mod_learn_finish(ofm, NULL); } } else { - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); - VLOG_INFO_RL(&rl, "Learn limit for flow %"PRIu64" reached.", + static struct vlog_rate_limit rll = VLOG_RATE_LIMIT_INIT(1, 5); + VLOG_INFO_RL(&rll, "Learn limit for flow %"PRIu64" reached.", rule->flow_cookie); ofproto_flow_mod_uninit(ofm);