Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 07689b0a authored by David S. Miller's avatar David S. Miller
Browse files


Paul Gortmaker says:

====================
This is the same eight commits as sent for review last week[1],
with just the incorporation of the pr_fmt change as suggested
by JoeP.  There was no additional change requests, so unless you
can see something else you'd like me to change, please pull.
 ...
Erik Hugne (5):
      tipc: use standard printk shortcut macros (pr_err etc.)
      tipc: remove TIPC packet debugging functions and macros
      tipc: simplify print buffer handling in tipc_printf
      tipc: phase out most of the struct print_buf usage
      tipc: remove print_buf and deprecated log buffer code

Paul Gortmaker (3):
      tipc: factor stats struct out of the larger link struct
      tipc: limit error messages relating to memory leak to one line
      tipc: simplify link_print by divorcing it from using tipc_printf
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 51d7cccf 869dd466
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -102,8 +102,8 @@
#define  TIPC_CMD_SET_LINK_TOL      0x4107    /* tx link_config, rx none */
#define  TIPC_CMD_SET_LINK_PRI      0x4108    /* tx link_config, rx none */
#define  TIPC_CMD_SET_LINK_WINDOW   0x4109    /* tx link_config, rx none */
#define  TIPC_CMD_SET_LOG_SIZE      0x410A    /* tx unsigned, rx none */
#define  TIPC_CMD_DUMP_LOG          0x410B    /* tx none, rx ultra_string */
#define  TIPC_CMD_SET_LOG_SIZE      0x410A    /* obsoleted */
#define  TIPC_CMD_DUMP_LOG          0x410B    /* obsoleted */
#define  TIPC_CMD_RESET_LINK_STATS  0x410C    /* tx link_name, rx none */

/*
+0 −25
Original line number Diff line number Diff line
@@ -41,29 +41,4 @@ config TIPC_PORTS
	  Setting this to a smaller value saves some memory,
	  setting it to higher allows for more ports.

config TIPC_LOG
	int "Size of log buffer"
	depends on TIPC_ADVANCED
	range 0 32768
	default "0"
	help
	  Size (in bytes) of TIPC's internal log buffer, which records the
	  occurrence of significant events.  Can range from 0 to 32768 bytes;
	  default is 0.

	  There is no need to enable the log buffer unless the node will be
	  managed remotely via TIPC.

config TIPC_DEBUG
	bool "Enable debugging support"
	default n
	help
	  Saying Y here enables TIPC debugging capabilities used by developers.
	  Most users do not need to bother; if unsure, just say N.

	  Enabling debugging support causes TIPC to display data about its
	  internal state when certain abnormal conditions occur. It also
	  makes it easy for developers to capture additional information of
	  interest using the dbg() or msg_dbg() macros.

endif # TIPC
+30 −35
Original line number Diff line number Diff line
@@ -701,48 +701,43 @@ void tipc_bcbearer_sort(void)

int tipc_bclink_stats(char *buf, const u32 buf_size)
{
	struct print_buf pb;
	int ret;
	struct tipc_stats *s;

	if (!bcl)
		return 0;

	tipc_printbuf_init(&pb, buf, buf_size);

	spin_lock_bh(&bc_lock);

	tipc_printf(&pb, "Link <%s>\n"
	s = &bcl->stats;

	ret = tipc_snprintf(buf, buf_size, "Link <%s>\n"
			    "  Window:%u packets\n",
			    bcl->name, bcl->queue_limit[0]);
	tipc_printf(&pb, "  RX packets:%u fragments:%u/%u bundles:%u/%u\n",
		    bcl->stats.recv_info,
		    bcl->stats.recv_fragments,
		    bcl->stats.recv_fragmented,
		    bcl->stats.recv_bundles,
		    bcl->stats.recv_bundled);
	tipc_printf(&pb, "  TX packets:%u fragments:%u/%u bundles:%u/%u\n",
		    bcl->stats.sent_info,
		    bcl->stats.sent_fragments,
		    bcl->stats.sent_fragmented,
		    bcl->stats.sent_bundles,
		    bcl->stats.sent_bundled);
	tipc_printf(&pb, "  RX naks:%u defs:%u dups:%u\n",
		    bcl->stats.recv_nacks,
		    bcl->stats.deferred_recv,
		    bcl->stats.duplicates);
	tipc_printf(&pb, "  TX naks:%u acks:%u dups:%u\n",
		    bcl->stats.sent_nacks,
		    bcl->stats.sent_acks,
		    bcl->stats.retransmitted);
	tipc_printf(&pb, "  Congestion bearer:%u link:%u  Send queue max:%u avg:%u\n",
		    bcl->stats.bearer_congs,
		    bcl->stats.link_congs,
		    bcl->stats.max_queue_sz,
		    bcl->stats.queue_sz_counts
		    ? (bcl->stats.accu_queue_sz / bcl->stats.queue_sz_counts)
		    : 0);
	ret += tipc_snprintf(buf + ret, buf_size - ret,
			     "  RX packets:%u fragments:%u/%u bundles:%u/%u\n",
			     s->recv_info, s->recv_fragments,
			     s->recv_fragmented, s->recv_bundles,
			     s->recv_bundled);
	ret += tipc_snprintf(buf + ret, buf_size - ret,
			     "  TX packets:%u fragments:%u/%u bundles:%u/%u\n",
			     s->sent_info, s->sent_fragments,
			     s->sent_fragmented, s->sent_bundles,
			     s->sent_bundled);
	ret += tipc_snprintf(buf + ret, buf_size - ret,
			     "  RX naks:%u defs:%u dups:%u\n",
			     s->recv_nacks, s->deferred_recv, s->duplicates);
	ret += tipc_snprintf(buf + ret, buf_size - ret,
			     "  TX naks:%u acks:%u dups:%u\n",
			     s->sent_nacks, s->sent_acks, s->retransmitted);
	ret += tipc_snprintf(buf + ret, buf_size - ret,
			     "  Congestion bearer:%u link:%u  Send queue max:%u avg:%u\n",
			     s->bearer_congs, s->link_congs, s->max_queue_sz,
			     s->queue_sz_counts ?
			     (s->accu_queue_sz / s->queue_sz_counts) : 0);

	spin_unlock_bh(&bc_lock);
	return tipc_printbuf_validate(&pb);
	return ret;
}

int tipc_bclink_reset_stats(void)
@@ -880,7 +875,7 @@ void tipc_port_list_add(struct tipc_port_list *pl_ptr, u32 port)
		if (!item->next) {
			item->next = kmalloc(sizeof(*item), GFP_ATOMIC);
			if (!item->next) {
				warn("Incomplete multicast delivery, no memory\n");
				pr_warn("Incomplete multicast delivery, no memory\n");
				return;
			}
			item->next->next = NULL;
+34 −28
Original line number Diff line number Diff line
@@ -123,28 +123,30 @@ int tipc_register_media(struct tipc_media *m_ptr)
exit:
	write_unlock_bh(&tipc_net_lock);
	if (res)
		warn("Media <%s> registration error\n", m_ptr->name);
		pr_warn("Media <%s> registration error\n", m_ptr->name);
	return res;
}

/**
 * tipc_media_addr_printf - record media address in print buffer
 */
void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a)
void tipc_media_addr_printf(char *buf, int len, struct tipc_media_addr *a)
{
	char addr_str[MAX_ADDR_STR];
	struct tipc_media *m_ptr;
	int ret;

	m_ptr = media_find_id(a->media_id);

	if (m_ptr && !m_ptr->addr2str(a, addr_str, sizeof(addr_str)))
		tipc_printf(pb, "%s(%s)", m_ptr->name, addr_str);
		ret = tipc_snprintf(buf, len, "%s(%s)", m_ptr->name, addr_str);
	else {
		u32 i;

		tipc_printf(pb, "UNKNOWN(%u)", a->media_id);
		ret = tipc_snprintf(buf, len, "UNKNOWN(%u)", a->media_id);
		for (i = 0; i < sizeof(a->value); i++)
			tipc_printf(pb, "-%02x", a->value[i]);
			ret += tipc_snprintf(buf - ret, len + ret,
					    "-%02x", a->value[i]);
	}
}

@@ -418,12 +420,12 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
	int res = -EINVAL;

	if (!tipc_own_addr) {
		warn("Bearer <%s> rejected, not supported in standalone mode\n",
		pr_warn("Bearer <%s> rejected, not supported in standalone mode\n",
			name);
		return -ENOPROTOOPT;
	}
	if (!bearer_name_validate(name, &b_names)) {
		warn("Bearer <%s> rejected, illegal name\n", name);
		pr_warn("Bearer <%s> rejected, illegal name\n", name);
		return -EINVAL;
	}
	if (tipc_addr_domain_valid(disc_domain) &&
@@ -435,12 +437,13 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
			res = 0;   /* accept specified node in own cluster */
	}
	if (res) {
		warn("Bearer <%s> rejected, illegal discovery domain\n", name);
		pr_warn("Bearer <%s> rejected, illegal discovery domain\n",
			name);
		return -EINVAL;
	}
	if ((priority > TIPC_MAX_LINK_PRI) &&
	    (priority != TIPC_MEDIA_LINK_PRI)) {
		warn("Bearer <%s> rejected, illegal priority\n", name);
		pr_warn("Bearer <%s> rejected, illegal priority\n", name);
		return -EINVAL;
	}

@@ -448,8 +451,8 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)

	m_ptr = tipc_media_find(b_names.media_name);
	if (!m_ptr) {
		warn("Bearer <%s> rejected, media <%s> not registered\n", name,
		     b_names.media_name);
		pr_warn("Bearer <%s> rejected, media <%s> not registered\n",
			name, b_names.media_name);
		goto exit;
	}

@@ -465,23 +468,24 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
			continue;
		}
		if (!strcmp(name, tipc_bearers[i].name)) {
			warn("Bearer <%s> rejected, already enabled\n", name);
			pr_warn("Bearer <%s> rejected, already enabled\n",
				name);
			goto exit;
		}
		if ((tipc_bearers[i].priority == priority) &&
		    (++with_this_prio > 2)) {
			if (priority-- == 0) {
				warn("Bearer <%s> rejected, duplicate priority\n",
				pr_warn("Bearer <%s> rejected, duplicate priority\n",
					name);
				goto exit;
			}
			warn("Bearer <%s> priority adjustment required %u->%u\n",
			pr_warn("Bearer <%s> priority adjustment required %u->%u\n",
				name, priority + 1, priority);
			goto restart;
		}
	}
	if (bearer_id >= MAX_BEARERS) {
		warn("Bearer <%s> rejected, bearer limit reached (%u)\n",
		pr_warn("Bearer <%s> rejected, bearer limit reached (%u)\n",
			name, MAX_BEARERS);
		goto exit;
	}
@@ -490,7 +494,8 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
	strcpy(b_ptr->name, name);
	res = m_ptr->enable_bearer(b_ptr);
	if (res) {
		warn("Bearer <%s> rejected, enable failure (%d)\n", name, -res);
		pr_warn("Bearer <%s> rejected, enable failure (%d)\n",
			name, -res);
		goto exit;
	}

@@ -508,12 +513,13 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
	res = tipc_disc_create(b_ptr, &m_ptr->bcast_addr, disc_domain);
	if (res) {
		bearer_disable(b_ptr);
		warn("Bearer <%s> rejected, discovery object creation failed\n",
		pr_warn("Bearer <%s> rejected, discovery object creation failed\n",
			name);
		goto exit;
	}
	info("Enabled bearer <%s>, discovery domain %s, priority %u\n",
	     name, tipc_addr_string_fill(addr_string, disc_domain), priority);
	pr_info("Enabled bearer <%s>, discovery domain %s, priority %u\n",
		name,
		tipc_addr_string_fill(addr_string, disc_domain), priority);
exit:
	write_unlock_bh(&tipc_net_lock);
	return res;
@@ -531,12 +537,12 @@ int tipc_block_bearer(const char *name)
	read_lock_bh(&tipc_net_lock);
	b_ptr = tipc_bearer_find(name);
	if (!b_ptr) {
		warn("Attempt to block unknown bearer <%s>\n", name);
		pr_warn("Attempt to block unknown bearer <%s>\n", name);
		read_unlock_bh(&tipc_net_lock);
		return -EINVAL;
	}

	info("Blocking bearer <%s>\n", name);
	pr_info("Blocking bearer <%s>\n", name);
	spin_lock_bh(&b_ptr->lock);
	b_ptr->blocked = 1;
	list_splice_init(&b_ptr->cong_links, &b_ptr->links);
@@ -562,7 +568,7 @@ static void bearer_disable(struct tipc_bearer *b_ptr)
	struct tipc_link *l_ptr;
	struct tipc_link *temp_l_ptr;

	info("Disabling bearer <%s>\n", b_ptr->name);
	pr_info("Disabling bearer <%s>\n", b_ptr->name);
	spin_lock_bh(&b_ptr->lock);
	b_ptr->blocked = 1;
	b_ptr->media->disable_bearer(b_ptr);
@@ -584,7 +590,7 @@ int tipc_disable_bearer(const char *name)
	write_lock_bh(&tipc_net_lock);
	b_ptr = tipc_bearer_find(name);
	if (b_ptr == NULL) {
		warn("Attempt to disable unknown bearer <%s>\n", name);
		pr_warn("Attempt to disable unknown bearer <%s>\n", name);
		res = -EINVAL;
	} else {
		bearer_disable(b_ptr);
+1 −1
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ void tipc_eth_media_stop(void);

int tipc_media_set_priority(const char *name, u32 new_value);
int tipc_media_set_window(const char *name, u32 new_value);
void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a);
void tipc_media_addr_printf(char *buf, int len, struct tipc_media_addr *a);
struct sk_buff *tipc_media_get_names(void);

struct sk_buff *tipc_bearer_get_names(void);
Loading