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

Commit 76127b14 authored by Nadine Toledano's avatar Nadine Toledano Committed by Gerrit - the friendly Code Review server
Browse files

msm: ipa: add exception handler to teth_bridge



For RmNet and MBIM tethering there are some corner cases where USB
starts sending packets to IPA before modem setup the data call.
These packets arrive to AP as exception packets, and needs to be dropped.
This change adds exception packet handler to teth_bridge to drop these
packets and free the corresponding skb.

Change-Id: I388647aa83d40717b72a9854f465fde445f349f0
Acked-by: default avatarAdy Abraham <adya@qti.qualcomm.com>
Signed-off-by: default avatarNadine Toledano <nadinet@codeaurora.org>
parent fb120d64
Loading
Loading
Loading
Loading
+31 −2
Original line number Diff line number Diff line
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2015, 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
@@ -23,6 +23,7 @@
#include <linux/skbuff.h>
#include <linux/types.h>
#include <linux/ipa.h>
#include <linux/netdevice.h>
#include "ipa_i.h"

#define TETH_BRIDGE_DRV_NAME "ipa_tethering_bridge"
@@ -52,6 +53,34 @@ struct teth_bridge_ctx {
};
static struct teth_bridge_ctx *teth_ctx;

/**
* teth_bridge_ipa_cb() - Callback to handle IPA data path events
* @priv - private data
* @evt - event type
* @data - event specific data (usually skb)
*
* This callback is called by IPA driver for exception packets from USB.
* All exception packets are handled by Q6 and should not reach this function.
* Packets will arrive to AP exception pipe only in case where packets are
* sent from USB before Q6 has setup the call.
*/
static void teth_bridge_ipa_cb(void *priv, enum ipa_dp_evt_type evt,
	unsigned long data)
{
	struct sk_buff *skb = (struct sk_buff *)data;

	TETH_DBG_FUNC_ENTRY();
	if (evt != IPA_RECEIVE) {
		TETH_ERR("unexpected event %d\n", evt);
		WARN_ON(1);
		return;
	}

	TETH_ERR("Unexpected exception packet from USB, dropping packet\n");
	dev_kfree_skb_any(skb);
	TETH_DBG_FUNC_EXIT();
}

/**
* teth_bridge_init() - Initialize the Tethering bridge driver
* @params - in/out params for USB initialization API (please look at struct
@@ -79,7 +108,7 @@ int teth_bridge_init(struct teth_bridge_init_params *params)
		return -EINVAL;
	}

	params->usb_notify_cb = NULL;
	params->usb_notify_cb = teth_bridge_ipa_cb;
	params->private_data = NULL;
	params->skip_ep_cfg = true;