Commit 6232b073 authored by Matt Porter's avatar Matt Porter Committed by Greg Kroah-Hartman

greybus: ap: process the UniPro link up message

The link up message is the event that tells the AP what device ID
has been assigned to a particular interface on a module during
enumeration. The link up is sent *only* after the hotplug event
for a particular module has been sent to the AP.

The link up payload must carry the Module ID and Interface ID
to uniquely identify the struct gb_interface to which the
Device ID has been assigned.

After processing of the link up message, the interface's device_id
field will contain the assigned Device ID so that the AP has the
information necessary to issue network route commands.
Signed-off-by: default avatarMatt Porter <mporter@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 1a4c013a
...@@ -106,6 +106,9 @@ static void svc_handshake(struct svc_function_handshake *handshake, ...@@ -106,6 +106,9 @@ static void svc_handshake(struct svc_function_handshake *handshake,
static void svc_management(struct svc_function_unipro_management *management, static void svc_management(struct svc_function_unipro_management *management,
int payload_length, struct greybus_host_device *hd) int payload_length, struct greybus_host_device *hd)
{ {
struct gb_module *module;
struct gb_interface *interface;
if (payload_length != sizeof(struct svc_function_unipro_management)) { if (payload_length != sizeof(struct svc_function_unipro_management)) {
dev_err(hd->parent, dev_err(hd->parent,
"Illegal size of svc management message %d\n", "Illegal size of svc management message %d\n",
...@@ -114,6 +117,22 @@ static void svc_management(struct svc_function_unipro_management *management, ...@@ -114,6 +117,22 @@ static void svc_management(struct svc_function_unipro_management *management,
} }
switch (management->management_packet_type) { switch (management->management_packet_type) {
case SVC_MANAGEMENT_LINK_UP:
module = gb_module_find(hd, management->link_up.module_id);
if (!module) {
dev_err(hd->parent, "Module ID %d not found\n",
management->link_up.module_id);
return;
}
interface = gb_interface_find(module,
management->link_up.interface_id);
if (!interface) {
dev_err(hd->parent, "Interface ID %d not found\n",
management->link_up.interface_id);
return;
}
interface->device_id = management->link_up.device_id;
break;
case SVC_MANAGEMENT_AP_DEVICE_ID: case SVC_MANAGEMENT_AP_DEVICE_ID:
hd->device_id = management->ap_device_id.device_id; hd->device_id = management->ap_device_id.device_id;
break; break;
......
...@@ -55,6 +55,8 @@ struct svc_function_unipro_set_route { ...@@ -55,6 +55,8 @@ struct svc_function_unipro_set_route {
}; };
struct svc_function_unipro_link_up { struct svc_function_unipro_link_up {
__u8 module_id;
__u8 interface_id;
__u8 device_id; __u8 device_id;
}; };
......
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