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

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

Merge "msm: ipa: rndis: ecm: Add ipc support and outstanding_pkts counter fix"

parents 6616ea71 9f0bd977
Loading
Loading
Loading
Loading
+49 −8
Original line number Diff line number Diff line
@@ -32,17 +32,49 @@
#define DEBUGFS_TEMP_BUF_SIZE 4
#define TX_TIMEOUT (5 * HZ)

#define IPA_ECM_IPC_LOG_PAGES 50

#define IPA_ECM_IPC_LOGGING(buf, fmt, args...) \
	do { \
		if (buf) \
			ipc_log_string((buf), fmt, __func__, __LINE__, \
				## args); \
	} while (0)

static void *ipa_ecm_logbuf;

#define ECM_IPA_DEBUG(fmt, args...) \
	pr_debug("ctx:%s: "\
			fmt, current->comm, ## args)
	do { \
		pr_debug(DRIVER_NAME " %s:%d "\
			fmt, __func__, __LINE__, ## args);\
		if (ipa_ecm_logbuf) { \
			IPA_ECM_IPC_LOGGING(ipa_ecm_logbuf, \
				DRIVER_NAME " %s:%d " fmt, ## args); \
		} \
	} while (0)

#define ECM_IPA_DEBUG_XMIT(fmt, args...) \
	pr_debug(DRIVER_NAME " %s:%d " fmt, __func__, __LINE__, ## args)

#define ECM_IPA_INFO(fmt, args...) \
	pr_err(DRIVER_NAME "@%s@%d@ctx:%s: "\
			fmt, __func__, __LINE__, current->comm, ## args)
	do { \
		pr_info(DRIVER_NAME "@%s@%d@ctx:%s: "\
			fmt, __func__, __LINE__, current->comm, ## args);\
		if (ipa_ecm_logbuf) { \
			IPA_ECM_IPC_LOGGING(ipa_ecm_logbuf, \
				DRIVER_NAME " %s:%d " fmt, ## args); \
		} \
	} while (0)

#define ECM_IPA_ERROR(fmt, args...) \
	do { \
		pr_err(DRIVER_NAME "@%s@%d@ctx:%s: "\
			fmt, __func__, __LINE__, current->comm, ## args)
			fmt, __func__, __LINE__, current->comm, ## args);\
		if (ipa_ecm_logbuf) { \
			IPA_ECM_IPC_LOGGING(ipa_ecm_logbuf, \
				DRIVER_NAME " %s:%d " fmt, ## args); \
		} \
	} while (0)

#define NULL_CHECK(ptr) \
	do { \
@@ -586,7 +618,7 @@ static netdev_tx_t ecm_ipa_start_xmit

	netif_trans_update(net);

	ECM_IPA_DEBUG
	ECM_IPA_DEBUG_XMIT
		("Tx, len=%d, skb->protocol=%d, outstanding=%d\n",
		skb->len, skb->protocol,
		atomic_read(&ecm_ipa_ctx->outstanding_pkts));
@@ -1289,7 +1321,9 @@ static void ecm_ipa_tx_complete_notify
	ecm_ipa_ctx->net->stats.tx_packets++;
	ecm_ipa_ctx->net->stats.tx_bytes += skb->len;

	if (atomic_read(&ecm_ipa_ctx->outstanding_pkts) > 0)
		atomic_dec(&ecm_ipa_ctx->outstanding_pkts);

	if
		(netif_queue_stopped(ecm_ipa_ctx->net) &&
		netif_carrier_ok(ecm_ipa_ctx->net) &&
@@ -1577,6 +1611,10 @@ static const char *ecm_ipa_state_string(enum ecm_ipa_state state)
static int ecm_ipa_init_module(void)
{
	ECM_IPA_LOG_ENTRY();
	ipa_ecm_logbuf = ipc_log_context_create(IPA_ECM_IPC_LOG_PAGES,
			"ipa_ecm", 0);
	if (ipa_ecm_logbuf == NULL)
		ECM_IPA_DEBUG("failed to create IPC log, continue...\n");
	ECM_IPA_LOG_EXIT();
	return 0;
}
@@ -1588,6 +1626,9 @@ static int ecm_ipa_init_module(void)
static void ecm_ipa_cleanup_module(void)
{
	ECM_IPA_LOG_ENTRY();
	if (ipa_ecm_logbuf)
		ipc_log_context_destroy(ipa_ecm_logbuf);
	ipa_ecm_logbuf = NULL;
	ECM_IPA_LOG_EXIT();
}

+43 −5
Original line number Diff line number Diff line
@@ -62,11 +62,38 @@
#define DEFAULT_AGGR_TIME_LIMIT 1
#define DEFAULT_AGGR_PKT_LIMIT 0

#define IPA_RNDIS_IPC_LOG_PAGES 50

#define IPA_RNDIS_IPC_LOGGING(buf, fmt, args...) \
	do { \
		if (buf) \
			ipc_log_string((buf), fmt, __func__, __LINE__, \
				## args); \
	} while (0)

static void *ipa_rndis_logbuf;

#define RNDIS_IPA_DEBUG(fmt, args...) \
	do { \
		pr_debug(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\
		if (ipa_rndis_logbuf) { \
			IPA_RNDIS_IPC_LOGGING(ipa_rndis_logbuf, \
				DRV_NAME " %s:%d " fmt, ## args); \
		} \
	} while (0)

#define RNDIS_IPA_DEBUG_XMIT(fmt, args...) \
	pr_debug(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args)

#define RNDIS_IPA_ERROR(fmt, args...) \
	do { \
		pr_err(DRV_NAME "@%s@%d@ctx:%s: "\
				fmt, __func__, __LINE__, current->comm, ## args)
#define RNDIS_IPA_DEBUG(fmt, args...) \
			pr_debug("ctx: %s, "fmt, current->comm, ## args)
			fmt, __func__, __LINE__, current->comm, ## args);\
		if (ipa_rndis_logbuf) { \
			IPA_RNDIS_IPC_LOGGING(ipa_rndis_logbuf, \
				DRV_NAME " %s:%d " fmt, ## args); \
		} \
	} while (0)

#define NULL_CHECK_RETVAL(ptr) \
		do { \
@@ -892,7 +919,7 @@ static netdev_tx_t rndis_ipa_start_xmit(struct sk_buff *skb,

	netif_trans_update(net);

	RNDIS_IPA_DEBUG
	RNDIS_IPA_DEBUG_XMIT
		("Tx, len=%d, skb->protocol=%d, outstanding=%d\n",
		skb->len, skb->protocol,
		atomic_read(&rndis_ipa_ctx->outstanding_pkts));
@@ -1010,7 +1037,9 @@ static void rndis_ipa_tx_complete_notify(
	rndis_ipa_ctx->net->stats.tx_packets++;
	rndis_ipa_ctx->net->stats.tx_bytes += skb->len;

	if (atomic_read(&rndis_ipa_ctx->outstanding_pkts) > 0)
		atomic_dec(&rndis_ipa_ctx->outstanding_pkts);

	if
		(netif_queue_stopped(rndis_ipa_ctx->net) &&
		netif_carrier_ok(rndis_ipa_ctx->net) &&
@@ -2630,12 +2659,21 @@ static ssize_t rndis_ipa_debugfs_atomic_read

static int rndis_ipa_init_module(void)
{
	ipa_rndis_logbuf = ipc_log_context_create(IPA_RNDIS_IPC_LOG_PAGES,
		"ipa_rndis", 0);
	if (ipa_rndis_logbuf == NULL)
		RNDIS_IPA_DEBUG("failed to create IPC log, continue...\n");

	pr_info("RNDIS_IPA module is loaded.");
	return 0;
}

static void rndis_ipa_cleanup_module(void)
{
	if (ipa_rndis_logbuf)
		ipc_log_context_destroy(ipa_rndis_logbuf);
	ipa_rndis_logbuf = NULL;

	pr_info("RNDIS_IPA module is unloaded.");
}