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

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

Merge "mhi: mhi_rmnet: pass maximum payload size to mhi during registration"

parents e55457dc 9b73bf5d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -120,6 +120,13 @@ Main node properties:
  Value type: <u32>
  Definition: Segment size in bytes for each segment in bytes.

- qcom,mhi-bb-required
  Usage: optional
  Value type: bool
  Definition: Determine whether MHI device require bounce buffer
	during active transfer.  If true, during channel open host
	will pre-allocate transfer buffers.

========
Example:
========
+49 −21
Original line number Diff line number Diff line
MSM MHI RMNET interface device

MHI RMNET provides a network interface over PCIe
to transfer IP packets between modem and apps.

Required properties:
- compatible : "qcom,mhi-rmnet"
- At least one of MHI channel
  - qcom,mhi-rx-channel : MHI channel number for incoming data
  - qcom,mhi-tx-channel : MHI channel number for outgoing data
- Default MRU for interface
MHI RMNET provides a network interface over PCIe to transfer IP packets
between modem and apps.

==============
Node Structure
==============

Main node properties:

- compatible
  Usage: required
  Value type: <string>
  Definition: "qcom,mhi-rmnet"

- qcom,mhi-rx-channel
  Usage: optional if mhi-tx-channel is defined.
  Value type: <u32>
  Definition: MHI channel number for incoming data

- qcom,mhi-tx-channel
  Usage: optional if mhi-rx-channel is defined.
  Value type: <u32>
  Definition: MHI channel number for outgoing data

- qcom,mhi-mru
- Alias id to identify interface instance
  Usage: required
  Value type: <u32>
  Definition: Default payload size for receive path.

- qcom,mhi-max-mru
  Usage: optional
  Value type: <u32>
  Definition: Maximum payload interface support on receive path.  If
	not defined MHI_MAX_MRU is used.

- qcom,mhi-max-mtu
  Usage: optional
  Value type: <u32>
  Definition: Maximum payload interface support on transmit path.  If
	not defined MHI_MAX_MTU is used.

========
Example:
	aliases {
		mhi_rmnet0 = &mhi_rmnet_0;
	};
========
mhi_rmnet_0: qcom,mhi-rmnet@0 {
	compatible = "qcom,mhi-rmnet";
	qcom,mhi-rx-channel = <101>;
+33 −5
Original line number Diff line number Diff line
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2017, 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
@@ -88,6 +88,8 @@ struct rmnet_mhi_private {
	struct sk_buff_head           rx_buffers;
	atomic_t		      rx_pool_len;
	u32			      mru;
	u32			      max_mru;
	u32			      max_mtu;
	struct napi_struct            napi;
	gfp_t                         allocation_flags;
	uint32_t                      tx_buffers_max;
@@ -583,7 +585,10 @@ static int rmnet_mhi_stop(struct net_device *dev)

static int rmnet_mhi_change_mtu(struct net_device *dev, int new_mtu)
{
	if (0 > new_mtu || MHI_MAX_MTU < new_mtu)
	struct rmnet_mhi_private *rmnet_mhi_ptr =
			*(struct rmnet_mhi_private **)netdev_priv(dev);

	if (0 > new_mtu || rmnet_mhi_ptr->max_mtu < new_mtu)
		return -EINVAL;

	dev->mtu = new_mtu;
@@ -666,11 +671,12 @@ static int rmnet_mhi_ioctl_extended(struct net_device *dev, struct ifreq *ifr)

	switch (ext_cmd.extended_ioctl) {
	case RMNET_IOCTL_SET_MRU:
		if ((0 == ext_cmd.u.data) || (ext_cmd.u.data > MHI_MAX_MRU)) {
		if ((0 == ext_cmd.u.data) ||
		    (ext_cmd.u.data > rmnet_mhi_ptr->max_mru)) {
			rmnet_log(rmnet_mhi_ptr,
				  MSG_CRITICAL,
				  "Can't set MRU, value %u is invalid\n",
				  ext_cmd.u.data);
				  "Can't set MRU, value:%u is invalid max:%u\n",
				  ext_cmd.u.data, rmnet_mhi_ptr->max_mru);
			return -EINVAL;
		}
		rmnet_log(rmnet_mhi_ptr,
@@ -1183,6 +1189,26 @@ static int rmnet_mhi_probe(struct platform_device *pdev)
		goto probe_fail;
	}

	rc = of_property_read_u32(pdev->dev.of_node,
				  "qcom,mhi-max-mru",
				  &rmnet_mhi_ptr->max_mru);
	if (likely(rc)) {
		rmnet_log(rmnet_mhi_ptr, MSG_INFO,
			  "max-mru not defined, setting to max %d\n",
			  MHI_MAX_MRU);
		rmnet_mhi_ptr->max_mru = MHI_MAX_MRU;
	}

	rc = of_property_read_u32(pdev->dev.of_node,
				  "qcom,mhi-max-mtu",
				  &rmnet_mhi_ptr->max_mtu);
	if (likely(rc)) {
		rmnet_log(rmnet_mhi_ptr, MSG_INFO,
			  "max-mtu not defined, setting to max %d\n",
			  MHI_MAX_MTU);
		rmnet_mhi_ptr->max_mtu = MHI_MAX_MTU;
	}

	client_info.dev = &pdev->dev;
	client_info.node_name = "qcom,mhi";
	client_info.mhi_client_cb = rmnet_mhi_cb;
@@ -1194,6 +1220,7 @@ static int rmnet_mhi_probe(struct platform_device *pdev)
	if (rc == 0) {
		rmnet_mhi_ptr->tx_channel = channel;
		client_info.chan = channel;
		client_info.max_payload = rmnet_mhi_ptr->max_mtu;

		rc = mhi_register_channel(&rmnet_mhi_ptr->tx_client_handle,
					  &client_info);
@@ -1213,6 +1240,7 @@ static int rmnet_mhi_probe(struct platform_device *pdev)
				  &channel);
	if (rc == 0) {
		rmnet_mhi_ptr->rx_channel = channel;
		client_info.max_payload = rmnet_mhi_ptr->max_mru;
		client_info.chan = channel;
		rc = mhi_register_channel(&rmnet_mhi_ptr->rx_client_handle,
					  &client_info);
+6 −1
Original line number Diff line number Diff line
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2017, 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
@@ -348,6 +348,7 @@ struct mhi_ring {
	u32 msi_disable_cntr;
	u32 msi_enable_cntr;
	spinlock_t ring_lock;
	struct dma_pool *dma_pool;
};

enum MHI_CMD_STATUS {
@@ -446,9 +447,12 @@ struct mhi_state_work_queue {

struct mhi_buf_info {
	dma_addr_t bb_p_addr;
	dma_addr_t pre_alloc_p_addr;
	void *bb_v_addr;
	void *pre_alloc_v_addr;
	void *client_buf;
	size_t buf_len;
	size_t pre_alloc_len;
	size_t filled_size;
	enum dma_data_direction dir;
	int bb_active;
@@ -479,6 +483,7 @@ struct mhi_flags {
	u32 kill_threads;
	u32 ev_thread_stopped;
	u32 st_thread_stopped;
	bool bb_required;
};

struct mhi_wait_queues {
+5 −1
Original line number Diff line number Diff line
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2017, 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
@@ -456,6 +456,10 @@ static int mhi_plat_probe(struct platform_device *pdev)
		INIT_WORK(&bhi_ctxt->fw_load_work, bhi_firmware_download);
	}

	mhi_dev_ctxt->flags.bb_required =
		of_property_read_bool(pdev->dev.of_node,
				      "qcom,mhi-bb-required");

	mhi_dev_ctxt->plat_dev = pdev;
	platform_set_drvdata(pdev, mhi_dev_ctxt);

Loading