Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3276fbad authored by Dhananjay Phadke's avatar Dhananjay Phadke Committed by Jeff Garzik
Browse files

netxen: remove global physical_port array



Store physical port number in netxen_adapter structure.

Signed-off-by: default avatarDhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent dc515f2e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -863,6 +863,7 @@ struct netxen_adapter {
	unsigned char mac_addr[ETH_ALEN];
	int mtu;
	int portnum;
	u8 physical_port;

	struct work_struct watchdog_task;
	struct timer_list watchdog_timer;
@@ -1169,5 +1170,4 @@ extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr,

extern struct ethtool_ops netxen_nic_ethtool_ops;

extern int physical_port[];	/* physical port # from virtual port.*/
#endif				/* __NETXEN_NIC_H_ */
+3 −3
Original line number Diff line number Diff line
@@ -369,7 +369,7 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
		for (i = 3; niu_registers[mode].reg[i - 3] != -1; i++) {
			/* GB: port specific registers */
			if (mode == 0 && i >= 19)
				window = physical_port[adapter->portnum] *
				window = adapter->physical_port *
					NETXEN_NIC_PORT_WINDOW;

			NETXEN_NIC_LOCKED_READ_REG(niu_registers[mode].
@@ -527,7 +527,7 @@ netxen_nic_get_pauseparam(struct net_device *dev,
{
	struct netxen_adapter *adapter = netdev_priv(dev);
	__u32 val;
	int port = physical_port[adapter->portnum];
	int port = adapter->physical_port;

	if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
		if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
@@ -573,7 +573,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
{
	struct netxen_adapter *adapter = netdev_priv(dev);
	__u32 val;
	int port = physical_port[adapter->portnum];
	int port = adapter->physical_port;
	/* read mode */
	if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
		if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
+4 −4
Original line number Diff line number Diff line
@@ -1032,15 +1032,15 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu)
{
	netxen_nic_write_w0(adapter,
			NETXEN_NIU_GB_MAX_FRAME_SIZE(
				physical_port[adapter->portnum]), new_mtu);
		NETXEN_NIU_GB_MAX_FRAME_SIZE(adapter->physical_port),
		new_mtu);
	return 0;
}

int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu)
{
	new_mtu += NETXEN_NIU_HDRSIZE + NETXEN_NIU_TLRSIZE;
	if (physical_port[adapter->portnum] == 0)
	if (adapter->physical_port == 0)
		netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE,
				new_mtu);
	else
@@ -1051,7 +1051,7 @@ int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu)

void netxen_nic_init_niu_gb(struct netxen_adapter *adapter)
{
	netxen_niu_gbe_init_port(adapter, physical_port[adapter->portnum]);
	netxen_niu_gbe_init_port(adapter, adapter->physical_port);
}

void
+2 −2
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ static void netxen_nic_isr_other(struct netxen_adapter *adapter)

	/* verify the offset */
	val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE));
	val = val >> physical_port[adapter->portnum];
	val = val >> adapter->physical_port;
	if (val == adapter->ahw.qg_linksup)
		return;

@@ -199,7 +199,7 @@ void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter)

	/* WINDOW = 1 */
	val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE));
	val >>= (physical_port[adapter->portnum] * 8);
	val >>= (adapter->physical_port * 8);
	val &= 0xff;

	if (adapter->ahw.xg_linkup == 1 && val != XG_LINK_UP) {
+1 −3
Original line number Diff line number Diff line
@@ -70,8 +70,6 @@ static void netxen_nic_poll_controller(struct net_device *netdev);
static irqreturn_t netxen_intr(int irq, void *data);
static irqreturn_t netxen_msi_intr(int irq, void *data);

int physical_port[] = {0, 1, 2, 3};

/*  PCI Device ID Table  */
static struct pci_device_id netxen_pci_tbl[] __devinitdata = {
	{PCI_DEVICE(0x4040, 0x0001)},
@@ -647,7 +645,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
	 */
	i = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_V2P(adapter->portnum)));
	if (i != 0x55555555)
		physical_port[adapter->portnum] = i;
		adapter->physical_port = i;

	netif_carrier_off(netdev);
	netif_stop_queue(netdev);
Loading