tile: support multiple mPIPE shims in tilegx network driver
The initial driver support was for a single mPIPE shim on the chip (as is the case for the Gx36 hardware). The Gx72 chip has two mPIPE shims, so we extend the driver to handle that case. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
6ab4ae9aad
commit
f3286a3af8
@@ -16,6 +16,24 @@
|
||||
#include "gxio/iorpc_mpipe_info.h"
|
||||
|
||||
|
||||
struct instance_aux_param {
|
||||
_gxio_mpipe_link_name_t name;
|
||||
};
|
||||
|
||||
int gxio_mpipe_info_instance_aux(gxio_mpipe_info_context_t * context,
|
||||
_gxio_mpipe_link_name_t name)
|
||||
{
|
||||
struct instance_aux_param temp;
|
||||
struct instance_aux_param *params = &temp;
|
||||
|
||||
params->name = name;
|
||||
|
||||
return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
|
||||
sizeof(*params), GXIO_MPIPE_INFO_OP_INSTANCE_AUX);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(gxio_mpipe_info_instance_aux);
|
||||
|
||||
struct enumerate_aux_param {
|
||||
_gxio_mpipe_link_name_t name;
|
||||
_gxio_mpipe_link_mac_t mac;
|
||||
|
@@ -36,8 +36,14 @@ int gxio_mpipe_init(gxio_mpipe_context_t *context, unsigned int mpipe_index)
|
||||
int fd;
|
||||
int i;
|
||||
|
||||
if (mpipe_index >= GXIO_MPIPE_INSTANCE_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
snprintf(file, sizeof(file), "mpipe/%d/iorpc", mpipe_index);
|
||||
fd = hv_dev_open((HV_VirtAddr) file, 0);
|
||||
|
||||
context->fd = fd;
|
||||
|
||||
if (fd < 0) {
|
||||
if (fd >= GXIO_ERR_MIN && fd <= GXIO_ERR_MAX)
|
||||
return fd;
|
||||
@@ -45,8 +51,6 @@ int gxio_mpipe_init(gxio_mpipe_context_t *context, unsigned int mpipe_index)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
context->fd = fd;
|
||||
|
||||
/* Map in the MMIO space. */
|
||||
context->mmio_cfg_base = (void __force *)
|
||||
iorpc_ioremap(fd, HV_MPIPE_CONFIG_MMIO_OFFSET,
|
||||
@@ -64,12 +68,15 @@ int gxio_mpipe_init(gxio_mpipe_context_t *context, unsigned int mpipe_index)
|
||||
for (i = 0; i < 8; i++)
|
||||
context->__stacks.stacks[i] = 255;
|
||||
|
||||
context->instance = mpipe_index;
|
||||
|
||||
return 0;
|
||||
|
||||
fast_failed:
|
||||
iounmap((void __force __iomem *)(context->mmio_cfg_base));
|
||||
cfg_failed:
|
||||
hv_dev_close(context->fd);
|
||||
context->fd = -1;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -496,6 +503,20 @@ static gxio_mpipe_context_t *_gxio_get_link_context(void)
|
||||
return contextp;
|
||||
}
|
||||
|
||||
int gxio_mpipe_link_instance(const char *link_name)
|
||||
{
|
||||
_gxio_mpipe_link_name_t name;
|
||||
gxio_mpipe_context_t *context = _gxio_get_link_context();
|
||||
|
||||
if (!context)
|
||||
return GXIO_ERR_NO_DEVICE;
|
||||
|
||||
strncpy(name.name, link_name, sizeof(name.name));
|
||||
name.name[GXIO_MPIPE_LINK_NAME_LEN - 1] = '\0';
|
||||
|
||||
return gxio_mpipe_info_instance_aux(context, name);
|
||||
}
|
||||
|
||||
int gxio_mpipe_link_enumerate_mac(int idx, char *link_name, uint8_t *link_mac)
|
||||
{
|
||||
int rv;
|
||||
|
Reference in New Issue
Block a user