Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 291413
b: refs/heads/master
c: 3f658cd
h: refs/heads/master
i:
  291411: 626b918
v: v3
  • Loading branch information
Alexey Orishko authored and David S. Miller committed Mar 16, 2012
1 parent 6f00448 commit a380969
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c84ff1d6dff38058a5bd20cb633d13a0f685788a
refs/heads/master: 3f658cde9401bd45429ee720cf2c69f0bc5547b9
34 changes: 16 additions & 18 deletions trunk/drivers/net/usb/cdc_ncm.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,22 @@
#define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10

/* Maximum NTB length */
#define CDC_NCM_NTB_MAX_SIZE_TX 16384 /* bytes */
#define CDC_NCM_NTB_MAX_SIZE_RX 16384 /* bytes */
#define CDC_NCM_NTB_MAX_SIZE_TX 32768 /* bytes */
#define CDC_NCM_NTB_MAX_SIZE_RX 32768 /* bytes */

/* Minimum value for MaxDatagramSize, ch. 6.2.9 */
#define CDC_NCM_MIN_DATAGRAM_SIZE 1514 /* bytes */

#define CDC_NCM_MIN_TX_PKT 512 /* bytes */

/* Default value for MaxDatagramSize */
#define CDC_NCM_MAX_DATAGRAM_SIZE 2048 /* bytes */
#define CDC_NCM_MAX_DATAGRAM_SIZE 8192 /* bytes */

/*
* Maximum amount of datagrams in NCM Datagram Pointer Table, not counting
* the last NULL entry. Any additional datagrams in NTB would be discarded.
*/
#define CDC_NCM_DPT_DATAGRAMS_MAX 32
#define CDC_NCM_DPT_DATAGRAMS_MAX 40

/* Maximum amount of IN datagrams in NTB */
#define CDC_NCM_DPT_DATAGRAMS_IN_MAX 0 /* unlimited */
Expand Down Expand Up @@ -366,42 +366,40 @@ static u8 cdc_ncm_setup(struct cdc_ncm_ctx *ctx)
if (err < 0) {
pr_debug("GET_MAX_DATAGRAM_SIZE failed, use size=%u\n",
CDC_NCM_MIN_DATAGRAM_SIZE);
kfree(max_datagram_size);
} else {
ctx->max_datagram_size =
le16_to_cpu(*max_datagram_size);
/* Check Eth descriptor value */
if (eth_max_sz < CDC_NCM_MAX_DATAGRAM_SIZE) {
if (ctx->max_datagram_size > eth_max_sz)
if (ctx->max_datagram_size > eth_max_sz)
ctx->max_datagram_size = eth_max_sz;
} else {
if (ctx->max_datagram_size >
CDC_NCM_MAX_DATAGRAM_SIZE)
ctx->max_datagram_size =

if (ctx->max_datagram_size > CDC_NCM_MAX_DATAGRAM_SIZE)
ctx->max_datagram_size =
CDC_NCM_MAX_DATAGRAM_SIZE;
}

if (ctx->max_datagram_size < CDC_NCM_MIN_DATAGRAM_SIZE)
ctx->max_datagram_size =
CDC_NCM_MIN_DATAGRAM_SIZE;

/* if value changed, update device */
err = usb_control_msg(ctx->udev,
if (ctx->max_datagram_size !=
le16_to_cpu(*max_datagram_size)) {
err = usb_control_msg(ctx->udev,
usb_sndctrlpipe(ctx->udev, 0),
USB_CDC_SET_MAX_DATAGRAM_SIZE,
USB_TYPE_CLASS | USB_DIR_OUT
| USB_RECIP_INTERFACE,
0,
iface_no, max_datagram_size,
2, 1000);
kfree(max_datagram_size);
max_dgram_err:
if (err < 0)
pr_debug("SET_MAX_DATAGRAM_SIZE failed\n");
if (err < 0)
pr_debug("SET_MAX_DGRAM_SIZE failed\n");
}
}

kfree(max_datagram_size);
}

max_dgram_err:
if (ctx->netdev->mtu != (ctx->max_datagram_size - ETH_HLEN))
ctx->netdev->mtu = ctx->max_datagram_size - ETH_HLEN;

Expand Down

0 comments on commit a380969

Please sign in to comment.