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

Commit 7bfb11b7 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa: Add new IOCTL to enable coalescing"

parents 56882962 91eed801
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -72,6 +72,8 @@ const char *ipa3_event_name[] = {
	__stringify(WLAN_FWR_SSR_BEFORE_SHUTDOWN),
	__stringify(IPA_GSB_CONNECT),
	__stringify(IPA_GSB_DISCONNECT),
	__stringify(IPA_COALESCE_ENABLE),
	__stringify(IPA_COALESCE_DISABLE),
};

const char *ipa3_hdr_l2_type_name[] = {
+67 −0
Original line number Diff line number Diff line
@@ -80,6 +80,9 @@ static void tethering_stats_poll_queue(struct work_struct *work);
static DECLARE_DELAYED_WORK(ipa_tether_stats_poll_wakequeue_work,
			    tethering_stats_poll_queue);

static int rmnet_ipa_send_coalesce_notification(uint8_t qmap_id, bool enable,
					bool tcp, bool udp);

enum ipa3_wwan_device_status {
	WWAN_DEVICE_INACTIVE = 0,
	WWAN_DEVICE_ACTIVE   = 1
@@ -1362,6 +1365,11 @@ static int handle3_ingress_format(struct net_device *dev,
	ipa_wan_ep_cfg->ipa_ep_cfg.metadata_mask.metadata_mask = 0xFF000000;

	ipa_wan_ep_cfg->client = IPA_CLIENT_APPS_WAN_CONS;

	if (dev->features & NETIF_F_GRO_HW)
	 /* Setup coalescing pipes */
		ipa_wan_ep_cfg->client = IPA_CLIENT_APPS_WAN_COAL_CONS;

	ipa_wan_ep_cfg->notify = apps_ipa_packet_receive_notify;
	ipa_wan_ep_cfg->priv = dev;

@@ -1527,6 +1535,7 @@ static int ipa3_wwan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
	int8_t *v_name;
	struct mutex *mux_mutex_ptr;
	int wan_ep;
	bool tcp_en = false, udp_en = false;

	IPAWANDBG("rmnet_ipa got ioctl number 0x%08x", cmd);
	switch (cmd) {
@@ -1818,6 +1827,18 @@ static int ipa3_wwan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
		/*  Set RX Headroom  */
		case RMNET_IOCTL_SET_RX_HEADROOM:
			break;
		/*  Set RSC/RSB  */
		case RMNET_IOCTL_SET_OFFLOAD:
			if (ext_ioctl_data.u.offload_params.flags
				& RMNET_IOCTL_COALESCING_FORMAT_TCP)
				tcp_en = true;
			if (ext_ioctl_data.u.offload_params.flags
				& RMNET_IOCTL_COALESCING_FORMAT_UDP)
				udp_en = true;
			rc = rmnet_ipa_send_coalesce_notification(
				ext_ioctl_data.u.offload_params.mux_id,
				tcp_en || udp_en, tcp_en, udp_en);
			break;
		default:
			IPAWANERR("[%s] unsupported extended cmd[%d]",
				dev->name,
@@ -1931,6 +1952,48 @@ static void ipa3_q6_rm_notify_cb(void *user_data,
	}
}

/**
 * rmnet_ipa_send_coalesce_notification
 * (uint8_t qmap_id, bool enable, bool tcp, bool udp)
 * send RSC notification
 *
 * This function sends the rsc enable/disable notification
 * fot tcp, udp to user-space module
 */
static int rmnet_ipa_send_coalesce_notification(uint8_t qmap_id,
		bool enable,
		bool tcp,
		bool udp)
{
	struct ipa_msg_meta msg_meta;
	struct ipa_coalesce_info *coalesce_info;
	int rc;

	memset(&msg_meta, 0, sizeof(struct ipa_msg_meta));
	coalesce_info = kzalloc(sizeof(*coalesce_info), GFP_KERNEL);
	if (!coalesce_info)
		return -ENOMEM;

	if (enable) {
		coalesce_info->qmap_id = qmap_id;
		coalesce_info->tcp_enable = tcp;
		coalesce_info->udp_enable = udp;
		msg_meta.msg_type = IPA_COALESCE_ENABLE;
		msg_meta.msg_len = sizeof(struct ipa_coalesce_info);
	} else {
		msg_meta.msg_type = IPA_COALESCE_DISABLE;
		msg_meta.msg_len = sizeof(struct ipa_coalesce_info);
	}
	rc = ipa_send_msg(&msg_meta, coalesce_info, ipa3_wwan_msg_free_cb);
	if (rc) {
		IPAWANERR("ipa_send_msg failed: %d\n", rc);
		return -EFAULT;
	}
	IPAWANDBG("qmap-id(%d),enable(%d),tcp(%d),udp(%d)\n",
		qmap_id, enable, tcp, udp);
	return 0;
}

int ipa3_wwan_set_modem_state(struct wan_ioctl_notify_wan_state *state)
{
	if (!state)
@@ -2498,6 +2561,10 @@ static int ipa3_wwan_probe(struct platform_device *pdev)
		goto config_err;
	}

	/* for > IPA 4.5, we set the colaescing feature flag on */
	if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5)
		dev->hw_features |= NETIF_F_GRO_HW | NETIF_F_RXCSUM;

	/*
	 * for IPA 4.0 offline charge is not needed and we need to prevent
	 * power collapse until IPA uC is loaded.
+18 −7
Original line number Diff line number Diff line
@@ -570,7 +570,7 @@ enum ipa_quota_event {
enum ipa_ssr_event {
	IPA_SSR_BEFORE_SHUTDOWN = IPA_QUOTA_EVENT_MAX,
	IPA_SSR_AFTER_POWERUP,
	IPA_SSR_EVENT_MAX
	IPA_SSR_EVENT_MAX,
};

enum ipa_vlan_l2tp_event {
@@ -584,29 +584,34 @@ enum ipa_vlan_l2tp_event {
enum ipa_per_client_stats_event {
	IPA_PER_CLIENT_STATS_CONNECT_EVENT = IPA_VLAN_L2TP_EVENT_MAX,
	IPA_PER_CLIENT_STATS_DISCONNECT_EVENT,
	IPA_PER_CLIENT_STATS_EVENT_MAX
	IPA_PER_CLIENT_STATS_EVENT_MAX,
};

enum ipa_vlan_bridge_event {
	ADD_BRIDGE_VLAN_MAPPING = IPA_PER_CLIENT_STATS_EVENT_MAX,
	DEL_BRIDGE_VLAN_MAPPING,
	BRIDGE_VLAN_MAPPING_MAX
	BRIDGE_VLAN_MAPPING_MAX,
};

enum ipa_wlan_fw_ssr_event {
	WLAN_FWR_SSR_BEFORE_SHUTDOWN = BRIDGE_VLAN_MAPPING_MAX,
	IPA_WLAN_FW_SSR_EVENT_MAX
#define IPA_WLAN_FW_SSR_EVENT_MAX IPA_WLAN_FW_SSR_EVENT_MAX
	IPA_WLAN_FW_SSR_EVENT_MAX,
};

enum ipa_gsb_event {
	IPA_GSB_CONNECT = IPA_WLAN_FW_SSR_EVENT_MAX,
	IPA_GSB_DISCONNECT,
	IPA_GSB_EVENT_MAX,
#define IPA_GSB_EVENT_MAX IPA_GSB_EVENT_MAX
};

#define IPA_EVENT_MAX_NUM (IPA_GSB_EVENT_MAX)
enum ipa_coalesce_event {
	IPA_COALESCE_ENABLE = IPA_GSB_EVENT_MAX,
	IPA_COALESCE_DISABLE,
	IPA_COALESCE_EVENT_MAX
#define IPA_COALESCE_EVENT_MAX IPA_COALESCE_EVENT_MAX
};

#define IPA_EVENT_MAX_NUM (IPA_COALESCE_EVENT_MAX)
#define IPA_EVENT_MAX ((int)IPA_EVENT_MAX_NUM)

/**
@@ -2011,6 +2016,12 @@ struct ipa_ioc_bridge_vlan_mapping_info {
	uint32_t subnet_mask;
};

struct ipa_coalesce_info {
	uint8_t qmap_id;
	uint8_t tcp_enable;
	uint8_t udp_enable;
};

struct ipa_odl_ep_info {
	__u32 cons_pipe_num;
	__u32 prod_pipe_num;