Commit 29f000f4 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

greybus: es1: set buffer sizes for messages based on email discussions

The gbuf sizes are 4k (i.e. PAGE_SIZE) and svc interrupt urb is 2k
parent 52adb563
...@@ -13,6 +13,11 @@ ...@@ -13,6 +13,11 @@
#include "greybus.h" #include "greybus.h"
#include "svc_msg.h" #include "svc_msg.h"
/* Memory sizes for the buffers sent to/from the ES1 controller */
#define ES1_SVC_MSG_SIZE 2048
#define ES1_GBUF_MSG_SIZE PAGE_SIZE
static const struct usb_device_id id_table[] = { static const struct usb_device_id id_table[] = {
/* Made up numbers for the SVC USB Bridge in ES1 */ /* Made up numbers for the SVC USB Bridge in ES1 */
{ USB_DEVICE(0xffff, 0x0001) }, { USB_DEVICE(0xffff, 0x0001) },
...@@ -90,6 +95,11 @@ static int alloc_gbuf(struct gbuf *gbuf, unsigned int size, gfp_t gfp_mask) ...@@ -90,6 +95,11 @@ static int alloc_gbuf(struct gbuf *gbuf, unsigned int size, gfp_t gfp_mask)
struct es1_ap_dev *es1 = hd_to_es1(gbuf->gdev->hd); struct es1_ap_dev *es1 = hd_to_es1(gbuf->gdev->hd);
u8 *buffer; u8 *buffer;
if (size > ES1_GBUF_MSG_SIZE) {
pr_err("guf was asked to be bigger than %d!\n",
ES1_GBUF_MSG_SIZE);
}
/* For ES2 we need to figure out what cport is going to what endpoint, /* For ES2 we need to figure out what cport is going to what endpoint,
* but for ES1, it's so dirt simple, we don't have a choice... * but for ES1, it's so dirt simple, we don't have a choice...
* *
...@@ -371,7 +381,6 @@ static int ap_probe(struct usb_interface *interface, ...@@ -371,7 +381,6 @@ static int ap_probe(struct usb_interface *interface,
bool bulk_out_found = false; bool bulk_out_found = false;
int retval = -ENOMEM; int retval = -ENOMEM;
int i; int i;
int buffer_size = 0;
u8 svc_interval = 0; u8 svc_interval = 0;
udev = usb_get_dev(interface_to_usbdev(interface)); udev = usb_get_dev(interface_to_usbdev(interface));
...@@ -398,7 +407,6 @@ static int ap_probe(struct usb_interface *interface, ...@@ -398,7 +407,6 @@ static int ap_probe(struct usb_interface *interface,
if (usb_endpoint_is_int_in(endpoint)) { if (usb_endpoint_is_int_in(endpoint)) {
es1->svc_endpoint = endpoint->bEndpointAddress; es1->svc_endpoint = endpoint->bEndpointAddress;
buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
svc_interval = endpoint->bInterval; svc_interval = endpoint->bInterval;
int_in_found = true; int_in_found = true;
} else if (usb_endpoint_is_bulk_in(endpoint)) { } else if (usb_endpoint_is_bulk_in(endpoint)) {
...@@ -421,7 +429,7 @@ static int ap_probe(struct usb_interface *interface, ...@@ -421,7 +429,7 @@ static int ap_probe(struct usb_interface *interface,
} }
/* Create our buffer and URB to get SVC messages, and start it up */ /* Create our buffer and URB to get SVC messages, and start it up */
es1->svc_buffer = kmalloc(buffer_size, GFP_KERNEL); es1->svc_buffer = kmalloc(ES1_SVC_MSG_SIZE, GFP_KERNEL);
if (!es1->svc_buffer) if (!es1->svc_buffer)
goto error; goto error;
...@@ -431,7 +439,7 @@ static int ap_probe(struct usb_interface *interface, ...@@ -431,7 +439,7 @@ static int ap_probe(struct usb_interface *interface,
usb_fill_int_urb(es1->svc_urb, udev, usb_fill_int_urb(es1->svc_urb, udev,
usb_rcvintpipe(udev, es1->svc_endpoint), usb_rcvintpipe(udev, es1->svc_endpoint),
es1->svc_buffer, buffer_size, svc_callback, es1->svc_buffer, ES1_SVC_MSG_SIZE, svc_callback,
es1, svc_interval); es1, svc_interval);
retval = usb_submit_urb(es1->svc_urb, GFP_KERNEL); retval = usb_submit_urb(es1->svc_urb, GFP_KERNEL);
if (retval) if (retval)
...@@ -445,7 +453,7 @@ static int ap_probe(struct usb_interface *interface, ...@@ -445,7 +453,7 @@ static int ap_probe(struct usb_interface *interface,
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb) if (!urb)
goto error_bulk_in_urb; goto error_bulk_in_urb;
buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); buffer = kmalloc(ES1_GBUF_MSG_SIZE, GFP_KERNEL);
if (!buffer) if (!buffer)
goto error_bulk_in_urb; goto error_bulk_in_urb;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment