USB: rndis: Honor dl_max_packet_size value sent by host

This change starts using dl_max_packet_size value sent by host
as part of USB RNDIS init message communication. Using default
dl_max_packet_size value results into low throughput with more
data loss on host side as host side RNDIS can't support
de-aggregation (applicable for Linux Host RNDIS driver) or it
ignores received more data then host side RNDIS can handle. To
use fine tune dl_max_packet_size for better throughput, driver
selects minimum value between host supported dl_max_packet_size
and default size (i.e. 9216 bytes as RNDIS IN aggregation size).

Change-Id: I00c81bc905a032867c537536b01bf32584c37e63
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
This commit is contained in:
Mayank Rana 2017-09-20 13:55:11 -07:00 • committed by Jack Pham
commit 8d0058d89c
2 changed files with 14 additions and 2 deletions

View file

@ -806,8 +806,17 @@ int rndis_msg_parser(struct rndis_params *params, u8 *buf)
/* For USB: responses may take up to 10 seconds */
switch (MsgType) {
case RNDIS_MSG_INIT:
pr_debug("%s: RNDIS_MSG_INIT\n",
__func__);
pr_debug("%s: RNDIS_MSG_INIT\n", __func__);
tmp++; /* to get RequestID */
params->host_rndis_major_ver = get_unaligned_le32(tmp++);
params->host_rndis_minor_ver = get_unaligned_le32(tmp++);
params->dl_max_xfer_size = get_unaligned_le32(tmp++);
pr_debug("%s(): RNDIS Host Major:%d Minor:%d version\n",
__func__, params->host_rndis_major_ver,
params->host_rndis_minor_ver);
pr_debug("%s(): DL Max Transfer size:%x\n",
__func__, params->dl_max_xfer_size);
params->state = RNDIS_INITIALIZED;
return rndis_init_response(params, (rndis_init_msg_type *)buf);

View file

@ -171,6 +171,9 @@ typedef struct rndis_params {
u32 vendorID;
u8 max_pkt_per_xfer;
u32 host_rndis_major_ver;
u32 host_rndis_minor_ver;
u32 dl_max_xfer_size;
const char *vendorDescr;
u8 pkt_alignment_factor;
void (*resp_avail)(void *v);