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

Commit 8031a608 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "net: rmnet_data: Enhance logging macros to remove duplicated code"

parents 6fcd5a9d 1070484a
Loading
Loading
Loading
Loading
+25 −31
Original line number Diff line number Diff line
@@ -77,13 +77,13 @@ int rmnet_config_init(void)
	int rc;
	nl_socket_handle = _rmnet_config_start_netlink();
	if (!nl_socket_handle) {
		LOGE("%s(): Failed to init netlink socket\n", __func__);
		LOGE("%s", "Failed to init netlink socket");
		return RMNET_INIT_ERROR;
	}

	rc = register_netdevice_notifier(&rmnet_dev_notifier);
	if (rc != 0) {
		LOGE("%s(): Failed to register device notifier\n", __func__);
		LOGE("Failed to register device notifier; rc=%d", rc);
		/* TODO: Cleanup the nl socket */
		return RMNET_INIT_ERROR;
	}
@@ -438,8 +438,7 @@ static void _rmnet_netlink_add_del_vnd_tc_flow
								tc_flow_id);
		break;
	default:
		LOGM("%s(): called with unhandled command %d\n",
		     __func__, command);
		LOGM("Called with unhandled command %d", command);
		resp_rmnet->return_code = RMNET_CONFIG_INVALID_REQUEST;
		break;
	}
@@ -463,8 +462,7 @@ void rmnet_config_netlink_msg_handler(struct sk_buff *skb)
	nlmsg_header = (struct nlmsghdr *) skb->data;
	rmnet_header = (struct rmnet_nl_msg_s *) nlmsg_data(nlmsg_header);

	LOGL("%s(): Netlink message pid=%d, seq=%d, length=%d, rmnet_type=%d\n",
		__func__,
	LOGL("Netlink message pid=%d, seq=%d, length=%d, rmnet_type=%d",
		nlmsg_header->nlmsg_pid,
		nlmsg_header->nlmsg_seq,
		nlmsg_header->nlmsg_len,
@@ -477,7 +475,7 @@ void rmnet_config_netlink_msg_handler(struct sk_buff *skb)
				 GFP_KERNEL);

	if (!skb_response) {
		LOGH("%s(): Failed to allocate response buffer\n", __func__);
		LOGH("%s", "Failed to allocate response buffer");
		return;
	}

@@ -576,7 +574,7 @@ void rmnet_config_netlink_msg_handler(struct sk_buff *skb)
	}
	rtnl_unlock();
	nlmsg_unicast(nl_socket_handle, skb_response, return_pid);
	LOGD("%s(): Done processing command\n", __func__);
	LOGD("%s", "Done processing command");

}

@@ -603,7 +601,7 @@ int rmnet_unassociate_network_device(struct net_device *dev)
	struct rmnet_logical_ep_conf_s *epconfig_l;
	ASSERT_RTNL();

	LOGL("%s(%s);", __func__, dev->name);
	LOGL("(%s);", dev->name);

	if (!dev)
		return RMNET_CONFIG_NO_SUCH_DEVICE;
@@ -651,7 +649,7 @@ int rmnet_set_ingress_data_format(struct net_device *dev,
	struct rmnet_phys_ep_conf_s *config;
	ASSERT_RTNL();

	LOGL("%s(%s,0x%08X);", __func__, dev->name, ingress_data_format);
	LOGL("(%s,0x%08X);", dev->name, ingress_data_format);

	if (!dev)
		return RMNET_CONFIG_NO_SUCH_DEVICE;
@@ -688,8 +686,8 @@ int rmnet_set_egress_data_format(struct net_device *dev,
	struct rmnet_phys_ep_conf_s *config;
	ASSERT_RTNL();

	LOGL("%s(%s,0x%08X, %d, %d);",
	     __func__, dev->name, egress_data_format, agg_size, agg_count);
	LOGL("(%s,0x%08X, %d, %d);",
	     dev->name, egress_data_format, agg_size, agg_count);

	if (!dev)
		return RMNET_CONFIG_NO_SUCH_DEVICE;
@@ -726,18 +724,18 @@ int rmnet_associate_network_device(struct net_device *dev)
	int rc;
	ASSERT_RTNL();

	LOGL("%s(%s);\n", __func__, dev->name);
	LOGL("(%s);\n", dev->name);

	if (!dev)
		return RMNET_CONFIG_NO_SUCH_DEVICE;

	if (_rmnet_is_physical_endpoint_associated(dev)) {
		LOGM("%s(): %s is already regestered\n", __func__, dev->name);
		LOGM("%s is already regestered", dev->name);
		return RMNET_CONFIG_DEVICE_IN_USE;
	}

	if (rmnet_vnd_is_vnd(dev)) {
		LOGM("%s(): %s is a vnd\n", __func__, dev->name);
		LOGM("%s is a vnd", dev->name);
		return RMNET_CONFIG_INVALID_REQUEST;
	}

@@ -754,8 +752,7 @@ int rmnet_associate_network_device(struct net_device *dev)
	rc = netdev_rx_handler_register(dev, rmnet_rx_handler, config);

	if (rc) {
		LOGM("%s(): netdev_rx_handler_register returns %d\n",
		     __func__, rc);
		LOGM("netdev_rx_handler_register returns %d", rc);
		kfree(config);
		return RMNET_CONFIG_DEVICE_IN_USE;
	}
@@ -851,7 +848,7 @@ int _rmnet_unset_logical_endpoint_config(struct net_device *dev,
}

/**
 * rmnet_set_logical_endpoint_config() - Set logical endpoing configuration on a device
 * rmnet_set_logical_endpoint_config() - Set logical endpoint config on a device
 * @dev:            Device to set endpoint configuration on
 * @config_id:      logical endpoint id on device
 * @rmnet_mode:     endpoint mode. Values from: rmnet_config_endpoint_modes_e
@@ -879,8 +876,8 @@ int rmnet_set_logical_endpoint_config(struct net_device *dev,
{
	struct rmnet_logical_ep_conf_s epconfig;

	LOGL("%s(%s, %d, %d, %s);\n",
	      __func__, dev->name, config_id, rmnet_mode, egress_dev->name);
	LOGL("(%s, %d, %d, %s);",
		dev->name, config_id, rmnet_mode, egress_dev->name);

	if (!egress_dev
	    || ((!_rmnet_is_physical_endpoint_associated(egress_dev))
@@ -914,8 +911,7 @@ int rmnet_set_logical_endpoint_config(struct net_device *dev,
int rmnet_unset_logical_endpoint_config(struct net_device *dev,
					int config_id)
{
	LOGL("%s(%s, %d);\n",
	      __func__, dev->name, config_id);
	LOGL("(%s, %d);", dev->name, config_id);

	if (!dev
	    || ((!_rmnet_is_physical_endpoint_associated(dev))
@@ -937,7 +933,7 @@ int rmnet_create_vnd(int id)
{
	struct net_device *dev;
	ASSERT_RTNL();
	LOGL("%s(%d);\n", __func__, id);
	LOGL("(%d);", id);
	return rmnet_vnd_create_dev(id, &dev, NULL);
}

@@ -953,7 +949,7 @@ int rmnet_create_vnd_prefix(int id, const char *prefix)
{
	struct net_device *dev;
	ASSERT_RTNL();
	LOGL("%s(%d, \"%s\");\n", __func__, id, prefix);
	LOGL("(%d, \"%s\");", id, prefix);
	return rmnet_vnd_create_dev(id, &dev, prefix);
}

@@ -966,7 +962,7 @@ int rmnet_create_vnd_prefix(int id, const char *prefix)
 */
int rmnet_free_vnd(int id)
{
	LOGL("%s(%d);\n", __func__, id);
	LOGL("(%d);", id);
	return rmnet_vnd_free_dev(id);
}

@@ -985,8 +981,7 @@ static void rmnet_force_unassociate_device(struct net_device *dev)
		BUG();

	if (!_rmnet_is_physical_endpoint_associated(dev)) {
		LOGM("%s(): Called on unassociated device, skipping\n",
		     __func__);
		LOGM("%s", "Called on unassociated device, skipping");
		return;
	}

@@ -1013,20 +1008,19 @@ int rmnet_config_notify_cb(struct notifier_block *nb,
	if (!dev)
		BUG();

	LOGL("%s(..., %lu, %s)\n", __func__, event, dev->name);
	LOGL("(..., %lu, %s)", event, dev->name);

	switch (event) {
	case NETDEV_UNREGISTER_FINAL:
	case NETDEV_UNREGISTER:
		if (_rmnet_is_physical_endpoint_associated(dev)) {
			LOGH("%s(): Kernel is trying to unregister %s\n",
			     __func__, dev->name);
			LOGH("Kernel is trying to unregister %s", dev->name);
			rmnet_force_unassociate_device(dev);
		}
		break;

	default:
		LOGD("%s(): Unhandeled event\n", __func__);
		LOGD("Unhandeled event [%lu]", event);
		break;
	}

+30 −36
Original line number Diff line number Diff line
@@ -147,8 +147,8 @@ static rx_handler_result_t rmnet_bridge_handler(struct sk_buff *skb,
					struct rmnet_logical_ep_conf_s *ep)
{
	if (!ep->egress_dev) {
		LOGD("%s(): Missing egress device for packet arriving on %s",
		      __func__, skb->dev->name);
		LOGD("Missing egress device for packet arriving on %s",
		     skb->dev->name);
		kfree_skb(skb);
	} else {
		rmnet_egress_handler(skb, ep);
@@ -192,8 +192,7 @@ static rx_handler_result_t __rmnet_deliver_skb(struct sk_buff *skb,
		return RX_HANDLER_PASS;

	default:
		LOGD("%s() unkown ep mode %d", __func__,
			ep->rmnet_mode);
		LOGD("Unkown ep mode %d", ep->rmnet_mode);
		kfree_skb(skb);
		return RX_HANDLER_CONSUMED;
	}
@@ -212,16 +211,15 @@ static rx_handler_result_t __rmnet_deliver_skb(struct sk_buff *skb,
static rx_handler_result_t rmnet_ingress_deliver_packet(struct sk_buff *skb,
					    struct rmnet_phys_ep_conf_s *config)
{
	if (0 == config) {
		LOGD("%s(): NULL physical EP provided\n",
			__func__);
	if (!config) {
		LOGD("%s", "NULL physical EP provided");
		kfree_skb(skb);
		return RX_HANDLER_CONSUMED;
	}

	if (!(config->local_ep.refcount)) {
		LOGD("%s(): Packet on %s has no local endpoint configuration\n",
			__func__, skb->dev->name);
		LOGD("Packet on %s has no local endpoint configuration",
			skb->dev->name);
		kfree_skb(skb);
		return RX_HANDLER_CONSUMED;
	}
@@ -258,8 +256,8 @@ static rx_handler_result_t _rmnet_map_ingress_handler(struct sk_buff *skb,
			- config->tail_spacing;

	if (mux_id >= RMNET_DATA_MAX_LOGICAL_EP) {
		LOGD("%s(): Got packet on %s with bad mux id %d\n",
		     __func__, skb->dev->name, mux_id);
		LOGD("Got packet on %s with bad mux id %d",
			skb->dev->name, mux_id);
		kfree_skb(skb);
			return RX_HANDLER_CONSUMED;
	}
@@ -267,8 +265,8 @@ static rx_handler_result_t _rmnet_map_ingress_handler(struct sk_buff *skb,
	ep = &(config->muxed_ep[mux_id]);

	if (!ep->refcount) {
		LOGD("%s(): Packet on %s:%d; has no logical endpoint config\n",
		     __func__, skb->dev->name, mux_id);
		LOGD("Packet on %s:%d; has no logical endpoint config",
		     skb->dev->name, mux_id);

		kfree_skb(skb);
			return RX_HANDLER_CONSUMED;
@@ -307,7 +305,7 @@ static rx_handler_result_t rmnet_map_ingress_handler(struct sk_buff *skb,

	if (config->ingress_data_format & RMNET_INGRESS_FORMAT_DEAGGREGATION) {
		while ((skbn = rmnet_map_deaggregate(skb, config)) != 0) {
			LOGD("co=%d\n", co);
			LOGD("co=%d", co);
			_rmnet_map_ingress_handler(skbn, config);
			co++;
		}
@@ -346,12 +344,12 @@ static int rmnet_map_egress_handler(struct sk_buff *skb,

	required_headroom = sizeof(struct rmnet_map_header_s);

	LOGD("%s(): headroom of %d bytes\n", __func__, required_headroom);
	LOGD("headroom of %d bytes", required_headroom);

	if (skb_headroom(skb) < required_headroom) {
		if (pskb_expand_head(skb, required_headroom, 0, GFP_KERNEL)) {
			LOGD("%s(): Failed to add headroom of %d bytes\n",
			     __func__, required_headroom);
			LOGD("Failed to add headroom of %d bytes",
			     required_headroom);
			return 1;
		}
	}
@@ -359,8 +357,7 @@ static int rmnet_map_egress_handler(struct sk_buff *skb,
	map_header = rmnet_map_add_map_header(skb, additional_header_length);

	if (!map_header) {
		LOGD("%s(): Failed to add MAP header to egress packet",
		     __func__);
		LOGD("%s", "Failed to add MAP header to egress packet");
		return 1;
	}

@@ -411,8 +408,7 @@ rx_handler_result_t rmnet_ingress_handler(struct sk_buff *skb)
		rcu_dereference(skb->dev->rx_handler_data);

	if (!config) {
		LOGD("%s(): %s is not associated with rmnet_data",
		      __func__, skb->dev->name);
		LOGD("%s is not associated with rmnet_data", skb->dev->name);
		kfree_skb(skb);
		return RX_HANDLER_CONSUMED;
	}
@@ -433,8 +429,7 @@ rx_handler_result_t rmnet_ingress_handler(struct sk_buff *skb)
			    & RMNET_INGRESS_FORMAT_MAP_COMMANDS) {
				rc = rmnet_map_command(skb, config);
			} else {
				LOGM("%s(): MAP command packet on %s; %s\n",
				     __func__, dev->name,
				LOGM("MAP command packet on %s; %s", dev->name,
				     "Not configured for MAP commands");
				kfree_skb(skb);
				return RX_HANDLER_CONSUMED;
@@ -449,8 +444,8 @@ rx_handler_result_t rmnet_ingress_handler(struct sk_buff *skb)
				RMNET_EPMODE_BRIDGE) {
				rc = rmnet_ingress_deliver_packet(skb, config);
			} else {
				LOGD("%s(): MAP packet on %s; MAP not set\n",
				     __func__, dev->name);
				LOGD("MAP packet on %s; MAP not set",
					dev->name);
				kfree_skb(skb);
				rc = RX_HANDLER_CONSUMED;
			}
@@ -463,8 +458,8 @@ rx_handler_result_t rmnet_ingress_handler(struct sk_buff *skb)
			break;

		default:
			LOGD("%s(): Unknown skb->proto 0x%04X\n",
				__func__, ntohs(skb->protocol) & 0xFFFF);
			LOGD("Unknown skb->proto 0x%04X\n",
				ntohs(skb->protocol) & 0xFFFF);
			rc = RX_HANDLER_PASS;
		}
	}
@@ -509,27 +504,26 @@ void rmnet_egress_handler(struct sk_buff *skb,
		rcu_dereference(skb->dev->rx_handler_data);

	if (!config) {
		LOGD("%s(): %s is not associated with rmnet_data",
		      __func__, skb->dev->name);
		LOGD("%s is not associated with rmnet_data", skb->dev->name);
		kfree_skb(skb);
		return;
	}

	LOGD("%s(): Packet going out on %s with egress format 0x%08X\n",
	      __func__, skb->dev->name, config->egress_data_format);
	LOGD("Packet going out on %s with egress format 0x%08X",
	     skb->dev->name, config->egress_data_format);

	if (config->egress_data_format & RMNET_EGRESS_FORMAT_MAP) {
		switch (rmnet_map_egress_handler(skb, config, ep)) {
		case RMNET_MAP_CONSUMED:
			LOGD("%s(): MAP process consumed packet\n", __func__);
			LOGD("%s", "MAP process consumed packet");
			return;

		case RMNET_MAP_SUCCESS:
			break;

		default:
			LOGD("%s(): MAP egress failed on packet on %s",
			      __func__, skb->dev->name);
			LOGD("MAP egress failed on packet on %s",
			     skb->dev->name);
			kfree_skb(skb);
			return;
		}
@@ -540,7 +534,7 @@ void rmnet_egress_handler(struct sk_buff *skb,

	rmnet_print_packet(skb, skb->dev->name, 't');
	if (dev_queue_xmit(skb) != 0) {
		LOGD("%s(): Failed to queue packet for transmission on [%s]\n",
		      __func__, skb->dev->name);
		LOGD("Failed to queue packet for transmission on [%s]",
		      skb->dev->name);
	}
}
+2 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -43,7 +43,7 @@ static int __init rmnet_init(void)
	rmnet_config_init();
	rmnet_vnd_init();

	LOGL("%s", "RMNET Data driver loaded successfully\n");
	LOGL("%s", "RMNET Data driver loaded successfully");
	return 0;
}

+11 −6
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -43,20 +43,24 @@ extern unsigned int rmnet_data_log_module_mask;
#define RMNET_DATA_LOGMASK_MAPC    (1<<4)

#define LOGE(fmt, ...) do { if (rmnet_data_log_level & RMNET_LOG_LVL_ERR) \
			pr_err(fmt, ##__VA_ARGS__); \
			pr_err("[RMNET:ERR] %s(): " fmt "\n", __func__, \
				##__VA_ARGS__); \
			} while (0)

#define LOGH(fmt, ...) do { if (rmnet_data_log_level & RMNET_LOG_LVL_HI) \
			pr_err(fmt, ##__VA_ARGS__); \
			pr_err("[RMNET:HI] %s(): " fmt "\n" , __func__, \
				##__VA_ARGS__); \
			} while (0)

#define LOGM(fmt, ...) do { if (rmnet_data_log_level & RMNET_LOG_LVL_MED) \
			pr_warn(fmt, ##__VA_ARGS__); \
			pr_warn("[RMNET:MED] %s(): " fmt "\n", __func__, \
				##__VA_ARGS__); \
			} while (0)

#define LOGL(fmt, ...) do { if (unlikely \
			(rmnet_data_log_level & RMNET_LOG_LVL_LOW)) \
			pr_notice(fmt, ##__VA_ARGS__); \
			pr_notice("[RMNET:LOW] %s(): " fmt "\n", __func__, \
				##__VA_ARGS__); \
			} while (0)

/* Don't use pr_debug as it is compiled out of the kernel. We can be sure of
@@ -65,7 +69,8 @@ extern unsigned int rmnet_data_log_module_mask;
#define LOGD(fmt, ...) do { if (unlikely( \
			    (rmnet_data_log_level & RMNET_LOG_LVL_DBG) \
			    && (rmnet_data_log_module_mask & rmnet_mod_mask))) \
			pr_notice(fmt, ##__VA_ARGS__); \
			pr_notice("[RMNET:DBG] %s(): " fmt "\n", __func__, \
				  ##__VA_ARGS__); \
			} while (0)

#endif /* _RMNET_DATA_PRIVATE_H_ */
+41 −55
Original line number Diff line number Diff line
@@ -217,39 +217,32 @@ static int _rmnet_vnd_do_qos_ioctl(struct net_device *dev,
	switch (cmd) {

	case RMNET_IOCTL_SET_QOS_ENABLE:
		LOGM("%s(): RMNET_IOCTL_SET_QOS_ENABLE on %s\n",
		     __func__, dev->name);
		LOGM("RMNET_IOCTL_SET_QOS_ENABLE on %s", dev->name);
		if (!dev_conf->qos_version)
			dev_conf->qos_version = RMNET_IOCTL_QOS_MODE_6;
		break;

	case RMNET_IOCTL_SET_QOS_DISABLE:
		LOGM("%s(): RMNET_IOCTL_SET_QOS_DISABLE on %s\n",
		     __func__, dev->name);
		LOGM("RMNET_IOCTL_SET_QOS_DISABLE on %s", dev->name);
		dev_conf->qos_version = 0;
		break;

	case RMNET_IOCTL_GET_QOS:           /* Get QoS header state    */
		LOGM("%s(): RMNET_IOCTL_GET_QOS on %s\n",
		     __func__, dev->name);
		LOGM("RMNET_IOCTL_GET_QOS on %s", dev->name);
		ifr->ifr_ifru.ifru_data =
		      (void *)(dev_conf->qos_version == RMNET_IOCTL_QOS_MODE_6);
		break;

	case RMNET_IOCTL_FLOW_ENABLE:
		LOGL("%s(): RMNET_IOCTL_FLOW_ENABLE on %s\n",
		     __func__, dev->name);
		LOGL("RMNET_IOCTL_FLOW_ENABLE on %s", dev->name);
		tc_qdisc_flow_control(dev, (u32)ifr->ifr_data, 1);
		break;

	case RMNET_IOCTL_FLOW_DISABLE:
		LOGL("%s(): RMNET_IOCTL_FLOW_DISABLE on %s\n",
		     __func__, dev->name);
		LOGL("RMNET_IOCTL_FLOW_DISABLE on %s", dev->name);
		tc_qdisc_flow_control(dev, (u32)ifr->ifr_data, 0);
		break;



	default:
		rc = -EINVAL;
	}
@@ -273,8 +266,8 @@ static void _rmnet_vnd_wq_flow_control(struct work_struct *work)
	tc_qdisc_flow_control(fcwork->dev, fcwork->tc_handle, fcwork->enable);
	rtnl_unlock();

	LOGL("%s(): [%s] handle:%08X enable:%d\n",
	     __func__, fcwork->dev->name, fcwork->tc_handle, fcwork->enable);
	LOGL("[%s] handle:%08X enable:%d",
	     fcwork->dev->name, fcwork->tc_handle, fcwork->enable);

	kfree(work);
}
@@ -311,7 +304,7 @@ static inline int _rmnet_vnd_do_flow_control(struct net_device *dev,
					     uint32_t tc_handle,
					     int enable)
{
	LOGD("%s(): [%s] called with no QoS support", __func__, dev->name);
	LOGD("[%s] called with no QoS support", dev->name);
	return RMNET_VND_FC_NOT_ENABLED;
}
#endif /* CONFIG_RMNET_DATA_FC */
@@ -404,29 +397,25 @@ static int rmnet_vnd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
	switch (cmd) {

	case RMNET_IOCTL_OPEN: /* Do nothing. Support legacy behavior */
		LOGM("%s(): RMNET_IOCTL_OPEN on %s (ignored)\n",
		     __func__, dev->name);
		LOGM("RMNET_IOCTL_OPEN on %s (ignored)", dev->name);
		break;

	case RMNET_IOCTL_CLOSE: /* Do nothing. Support legacy behavior */
		LOGM("%s(): RMNET_IOCTL_CLOSE on %s (ignored)\n",
		     __func__, dev->name);
		LOGM("RMNET_IOCTL_CLOSE on %s (ignored)", dev->name);
		break;

	case RMNET_IOCTL_SET_LLP_ETHERNET:
		LOGM("%s(): RMNET_IOCTL_SET_LLP_ETHERNET on %s (no support)\n",
		     __func__, dev->name);
		LOGM("RMNET_IOCTL_SET_LLP_ETHERNET on %s (no support)",
		     dev->name);
		rc = -EINVAL;
		break;

	case RMNET_IOCTL_SET_LLP_IP: /* Do nothing. Support legacy behavior */
		LOGM("%s(): RMNET_IOCTL_SET_LLP_IP on %s  (ignored)\n",
		     __func__, dev->name);
		LOGM("RMNET_IOCTL_SET_LLP_IP on %s (ignored)", dev->name);
		break;

	case RMNET_IOCTL_GET_LLP: /* Always return IP mode */
		LOGM("%s(): RMNET_IOCTL_GET_LLP on %s\n",
		     __func__, dev->name);
		LOGM("RMNET_IOCTL_GET_LLP on %s", dev->name);
		ifr->ifr_ifru.ifru_data = (void *)(RMNET_MODE_LLP_IP);
		break;

@@ -435,7 +424,7 @@ static int rmnet_vnd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
		break;

	default:
		LOGH("%s(): Unkown IOCTL 0x%08X\n", __func__, cmd);
		LOGH("Unkown IOCTL 0x%08X", cmd);
		rc = -EINVAL;
	}

@@ -463,7 +452,7 @@ static const struct net_device_ops rmnet_data_vnd_ops = {
static void rmnet_vnd_setup(struct net_device *dev)
{
	struct rmnet_vnd_private_s *dev_conf;
	LOGM("%s(): Setting up device %s\n", __func__, dev->name);
	LOGM("Setting up device %s", dev->name);

	/* Clear out private data */
	dev_conf = (struct rmnet_vnd_private_s *) netdev_priv(dev);
@@ -555,7 +544,7 @@ int rmnet_vnd_create_dev(int id, struct net_device **new_device,
		p = scnprintf(dev_prefix, IFNAMSIZ, "%s%%d",
			  prefix);
	if (p >= (IFNAMSIZ-1)) {
		LOGE("%s(): Specified prefix longer than IFNAMSIZ", __func__);
		LOGE("Specified prefix (%d) longer than IFNAMSIZ", p);
		return -EINVAL;
	}

@@ -563,16 +552,14 @@ int rmnet_vnd_create_dev(int id, struct net_device **new_device,
			   dev_prefix,
			   rmnet_vnd_setup);
	if (!dev) {
		LOGE("%s(): Failed to to allocate netdev for id %d",
		      __func__, id);
		LOGE("Failed to to allocate netdev for id %d", id);
		*new_device = 0;
		return -EINVAL;
	}

	rc = register_netdevice(dev);
	if (rc != 0) {
		LOGE("%s(): Failed to to register netdev [%s]",
		      __func__, dev->name);
		LOGE("Failed to to register netdev [%s]", dev->name);
		free_netdev(dev);
		*new_device = 0;
	} else {
@@ -580,7 +567,7 @@ int rmnet_vnd_create_dev(int id, struct net_device **new_device,
		*new_device = dev;
	}

	LOGM("%s(): Registered device %s\n", __func__, dev->name);
	LOGM("Registered device %s", dev->name);
	return rc;
}

@@ -605,7 +592,7 @@ int rmnet_vnd_free_dev(int id)
	struct rmnet_logical_ep_conf_s *epconfig_l;

	if ((id < 0) || (id >= RMNET_DATA_MAX_VND) || !rmnet_devices[id]) {
		LOGM("%s(): Invalid id [%d]\n", __func__, id);
		LOGM("Invalid id [%d]", id);
		return RMNET_CONFIG_NO_SUCH_DEVICE;
	}

@@ -641,21 +628,21 @@ int rmnet_vnd_get_name(int id, char *name, int name_len)
	int p;

	if (!name) {
		LOGM("%s(): Bad arguments; name buffer null", __func__);
		LOGM("%s", "Bad arguments; name buffer null");
		return -EINVAL;
	}

	if ((id < 0) || (id >= RMNET_DATA_MAX_VND) || !rmnet_devices[id]) {
		LOGM("%s(): Invalid id [%d]", __func__, id);
		LOGM("Invalid id [%d]", id);
		return -EINVAL;
	}

	p = strlcpy(name, rmnet_devices[id]->name, name_len);
	if (p >= name_len) {
		LOGM("%s(): Buffer to small to fit device name", __func__);
		LOGM("Buffer to small (%d) to fit device name", name_len);
		return -EINVAL;
	}
	LOGL("%s(): Found mapping [%d]->\"%s\"", __func__, id, name);
	LOGL("Found mapping [%d]->\"%s\"", id, name);

	return 0;
}
@@ -779,8 +766,8 @@ static int _rmnet_vnd_update_flow_map(uint8_t action,
				itm->tc_flow_valid[i] = 1;
				itm->tc_flow_id[i] = tc_flow;
				rc = RMNET_VND_UPDATE_FLOW_OK;
				LOGD("%s(): {%p}->tc_flow_id[%d] = %08X\n",
				     __func__, itm, i, tc_flow);
				LOGD("{%p}->tc_flow_id[%d]=%08X",
				     itm, i, tc_flow);
				break;
			}
		}
@@ -795,8 +782,7 @@ static int _rmnet_vnd_update_flow_map(uint8_t action,
					itm->tc_flow_valid[i] = 0;
					itm->tc_flow_id[i] = 0;
					j++;
					LOGD("%s(): {%p}->tc_flow_id[%d] = 0\n",
					     __func__, itm, i);
					LOGD("{%p}->tc_flow_id[%d]=0", itm, i);
				}
			} else {
				j++;
@@ -837,7 +823,7 @@ int rmnet_vnd_add_tc_flow(uint32_t id, uint32_t map_flow, uint32_t tc_flow)
	unsigned long flags;

	if ((id < 0) || (id >= RMNET_DATA_MAX_VND) || !rmnet_devices[id]) {
		LOGM("%s(): Invalid id [%d]\n", __func__, id);
		LOGM("Invalid VND id [%d]", id);
		return RMNET_CONFIG_NO_SUCH_DEVICE;
	}

@@ -866,7 +852,7 @@ int rmnet_vnd_add_tc_flow(uint32_t id, uint32_t map_flow, uint32_t tc_flow)
		kmalloc(sizeof(struct rmnet_map_flow_mapping_s), GFP_KERNEL);

	if (!itm) {
		LOGM("%s(): failure allocating flow mapping\n", __func__);
		LOGM("%s", "Failure allocating flow mapping");
		return RMNET_CONFIG_NOMEM;
	}
	memset(itm, 0, sizeof(struct rmnet_map_flow_mapping_s));
@@ -885,7 +871,7 @@ int rmnet_vnd_add_tc_flow(uint32_t id, uint32_t map_flow, uint32_t tc_flow)
	list_add(&(itm->list), &(dev_conf->flow_head));
	write_unlock_irqrestore(&dev_conf->flow_map_lock, flags);

	LOGD("%s(): Created flow mapping [%s][0x%08X][0x%08X]@%p\n", __func__,
	LOGD("Created flow mapping [%s][0x%08X][0x%08X]@%p",
	     dev->name, itm->map_flow_id, itm->tc_flow_id[0], itm);

	return RMNET_CONFIG_OK;
@@ -916,7 +902,7 @@ int rmnet_vnd_del_tc_flow(uint32_t id, uint32_t map_flow, uint32_t tc_flow)
	int rc = RMNET_CONFIG_OK;

	if ((id < 0) || (id >= RMNET_DATA_MAX_VND) || !rmnet_devices[id]) {
		LOGM("%s(): Invalid id [%d]\n", __func__, id);
		LOGM("Invalid VND id [%d]", id);
		return RMNET_CONFIG_NO_SUCH_DEVICE;
	}

@@ -941,8 +927,8 @@ int rmnet_vnd_del_tc_flow(uint32_t id, uint32_t map_flow, uint32_t tc_flow)

	if (r ==  RMNET_VND_UPDATE_FLOW_NO_VALID_LEFT) {
		if (itm)
			LOGD("%s(): Removed flow mapping [%s][0x%08X]@%p\n",
			__func__, dev->name, itm->map_flow_id, itm);
			LOGD("Removed flow mapping [%s][0x%08X]@%p",
			     dev->name, itm->map_flow_id, itm);
		kfree(itm);
	}

@@ -990,16 +976,16 @@ int rmnet_vnd_do_flow_control(struct net_device *dev,
	itm = _rmnet_vnd_get_flow_map(dev_conf, map_flow_id);

	if (!itm) {
		LOGL("%s(): Got flow control request for unknown flow %08X\n",
		     __func__, map_flow_id);
		LOGL("Got flow control request for unknown flow %08X",
		     map_flow_id);
		goto fcdone;
	}
	if (v4_seq == 0 || v4_seq >= atomic_read(&(itm->v4_seq))) {
		atomic_set(&(itm->v4_seq), v4_seq);
		for (i = 0; i < RMNET_MAP_FLOW_NUM_TC_HANDLE; i++) {
			if (itm->tc_flow_valid[i] == 1) {
				LOGD("%s(): Found [%s][0x%08X][%d:0x%08X]\n",
				     __func__, dev->name, itm->map_flow_id, i,
				LOGD("Found [%s][0x%08X][%d:0x%08X]",
				     dev->name, itm->map_flow_id, i,
				     itm->tc_flow_id[i]);

				_rmnet_vnd_do_flow_control(dev,
@@ -1008,8 +994,8 @@ int rmnet_vnd_do_flow_control(struct net_device *dev,
			}
		}
	} else {
		LOGD("%s(): Internal seq(%hd) higher than called(%hd)\n",
		     __func__, atomic_read(&(itm->v4_seq)), v4_seq);
		LOGD("Internal seq(%hd) higher than called(%hd)",
		     atomic_read(&(itm->v4_seq)), v4_seq);
	}

fcdone:
Loading