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

Commit 5992516c authored by Jack Pham's avatar Jack Pham
Browse files

Revert "usb: gadget: rndis: Add new rndis parameters"



This reverts commit f645ecc0.

Instead, when gsi_setup() is returning the response payload for
RNDIS_MSG_INIT_C, override the MaxPacketsPerTransfer,
MaxTransferSize and PacketAlignmentFactor fields with the
packet aggregation size that GSI supports for uplink.

Change-Id: I0ee1b16571ede0e2a9312a52eb7e2b67b1a67677
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent d96a0b49
Loading
Loading
Loading
Loading
+28 −16
Original line number Original line Diff line number Diff line
@@ -2186,13 +2186,37 @@ gsi_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
			goto invalid;
			goto invalid;


		if (gsi->prot_id == IPA_USB_RNDIS) {
		if (gsi->prot_id == IPA_USB_RNDIS) {
			rndis_init_cmplt_type *res;

			/* return the result */
			/* return the result */
			buf = rndis_get_next_response(gsi->params, &n);
			buf = rndis_get_next_response(gsi->params, &n);
			if (buf) {
			if (!buf)
				break;

			res = (rndis_init_cmplt_type *)buf;
			if (le32_to_cpu(res->MessageType) == RNDIS_MSG_INIT_C) {
				log_event_dbg("%s: max_pkt_per_xfer : %d",
					__func__, DEFAULT_MAX_PKT_PER_XFER);
				res->MaxPacketsPerTransfer =
					cpu_to_le32(DEFAULT_MAX_PKT_PER_XFER);

				res->MaxTransferSize = cpu_to_le32(
					le32_to_cpu(res->MaxTransferSize)
					* DEFAULT_MAX_PKT_PER_XFER);

				/* In case of aggregated packets QC device
				 * will request aliment to 4 (2^2).
				 */
				log_event_dbg("%s: pkt_alignment_factor : %d",
					__func__, DEFAULT_PKT_ALIGNMENT_FACTOR);
				res->PacketAlignmentFactor =
					cpu_to_le32(
						DEFAULT_PKT_ALIGNMENT_FACTOR);
			}

			memcpy(req->buf, buf, n);
			memcpy(req->buf, buf, n);
			rndis_free_response(gsi->params, buf);
			rndis_free_response(gsi->params, buf);
			value = n;
			value = n;
			}
			break;
			break;
		}
		}


@@ -2859,18 +2883,6 @@ static int gsi_bind(struct usb_configuration *c, struct usb_function *f)
				gsi->manufacturer))
				gsi->manufacturer))
			goto dereg_rndis;
			goto dereg_rndis;


		log_event_dbg("%s: max_pkt_per_xfer : %d", __func__,
					DEFAULT_MAX_PKT_PER_XFER);
		rndis_set_max_pkt_xfer(gsi->params, DEFAULT_MAX_PKT_PER_XFER);

		/* In case of aggregated packets QC device will request
		 * aliment to 4 (2^2).
		 */
		log_event_dbg("%s: pkt_alignment_factor : %d", __func__,
					DEFAULT_PKT_ALIGNMENT_FACTOR);
		rndis_set_pkt_alignment_factor(gsi->params,
					DEFAULT_PKT_ALIGNMENT_FACTOR);

		/* Windows7/Windows10 automatically loads RNDIS drivers for
		/* Windows7/Windows10 automatically loads RNDIS drivers for
		 * class drivers which represents MISC_ACTIVE_SYNC,
		 * class drivers which represents MISC_ACTIVE_SYNC,
		 * MISC_RNDIS_OVER_ETHERNET & WIRELESS_CONTROLLER_REMOTE_NDIS.
		 * MISC_RNDIS_OVER_ETHERNET & WIRELESS_CONTROLLER_REMOTE_NDIS.
+1 −14
Original line number Original line Diff line number Diff line
@@ -576,7 +576,7 @@ static int rndis_init_response(struct rndis_params *params,
		+ sizeof(struct ethhdr)
		+ sizeof(struct ethhdr)
		+ sizeof(struct rndis_packet_msg_type)
		+ sizeof(struct rndis_packet_msg_type)
		+ 22));
		+ 22));
	resp->PacketAlignmentFactor = cpu_to_le32(params->pkt_alignment_factor);
	resp->PacketAlignmentFactor = cpu_to_le32(0);
	resp->AFListOffset = cpu_to_le32(0);
	resp->AFListOffset = cpu_to_le32(0);
	resp->AFListSize = cpu_to_le32(0);
	resp->AFListSize = cpu_to_le32(0);


@@ -1176,19 +1176,6 @@ int rndis_rm_hdr(struct gether *port,
}
}
EXPORT_SYMBOL_GPL(rndis_rm_hdr);
EXPORT_SYMBOL_GPL(rndis_rm_hdr);


void rndis_set_pkt_alignment_factor(struct rndis_params *params,
		u8 pkt_alignment_factor)
{
	pr_debug("%s:\n", __func__);

	if (!params) {
		pr_err("%s: failed, params NULL\n", __func__);
		return;
	}

	params->pkt_alignment_factor = pkt_alignment_factor;
}

#ifdef CONFIG_USB_GADGET_DEBUG_FILES
#ifdef CONFIG_USB_GADGET_DEBUG_FILES


static int rndis_proc_show(struct seq_file *m, void *v)
static int rndis_proc_show(struct seq_file *m, void *v)
+0 −3
Original line number Original line Diff line number Diff line
@@ -172,7 +172,6 @@ typedef struct rndis_params {
	u32			vendorID;
	u32			vendorID;
	u8			max_pkt_per_xfer;
	u8			max_pkt_per_xfer;
	const char		*vendorDescr;
	const char		*vendorDescr;
	u8			pkt_alignment_factor;
	void			(*resp_avail)(void *v);
	void			(*resp_avail)(void *v);
	void			(*flow_ctrl_enable)(bool enable,
	void			(*flow_ctrl_enable)(bool enable,
			struct rndis_params *params);
			struct rndis_params *params);
@@ -205,7 +204,5 @@ int rndis_signal_disconnect(struct rndis_params *params);
int  rndis_state(struct rndis_params *params);
int  rndis_state(struct rndis_params *params);
extern void rndis_set_host_mac(struct rndis_params *params, const u8 *addr);
extern void rndis_set_host_mac(struct rndis_params *params, const u8 *addr);
void rndis_flow_control(struct rndis_params *params, bool enable_flow_control);
void rndis_flow_control(struct rndis_params *params, bool enable_flow_control);
void rndis_set_pkt_alignment_factor(struct rndis_params *params,
		u8 pkt_alignment_factor);


#endif  /* _LINUX_RNDIS_H */
#endif  /* _LINUX_RNDIS_H */