The object factoring is a mess here. You have too many allocations
and indirections. My expectation would be:

1. One PCI device maps to one board and that is the adapter structure
   allocated with kzalloc.  (You are doing this right)

2. An adapter can have up to four ports. Each of these should be a
   netdevice and any port specific memory should be part of netdev_priv().

3. Have an array of pointers in the adapter structure for the maximum
   possible value, if the board has less the memory waste for three
   extra pointers is less than cost of dynamically sized array.

Something like

pci_prvdata -> adapter --> dev[0] -> netdevice { private data }
                       --> dev[1] ...
or
pci_privdata -> adapter -> port[0] -> private data
                        -> port[1]

In the later case, you need to have port->netdev pointer back to the
start of the net_device data structure.

If you do it this way, you won't need:

> +     adapter->port = kcalloc(adapter->ahw.max_ports,
> +                             sizeof(struct netxen_adapter), GFP_KERNEL);

and

> +             netlist = kzalloc(sizeof(struct netdev_list), GFP_KERNEL);
> +             if (netlist == NULL)
> +                     goto err_out_free_dev;

Also, do you really need to have such a big TX ring that it requires
a vmalloc?
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to