1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-12 09:58:36 +00:00

- In all structures other than port info port is a pointer to a port info,

make the code less confusing by renaming the port number to port_id

Approved by: re (blanket)
This commit is contained in:
Kip Macy 2007-08-10 23:33:34 +00:00
parent ad3638ee08
commit 6b68e276ce
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=171803
4 changed files with 14 additions and 15 deletions

View File

@ -117,7 +117,7 @@ struct port_info {
#else
struct mtx lock;
#endif
int port;
int port_id;
uint8_t hw_addr[ETHER_ADDR_LEN];
uint8_t nqsets;
uint8_t first_qset;

View File

@ -557,7 +557,7 @@ cxgb_controller_attach(device_t dev)
sc->port[i].adapter = sc;
sc->port[i].nqsets = port_qsets;
sc->port[i].first_qset = i*port_qsets;
sc->port[i].port = i;
sc->port[i].port_id = i;
sc->portdev[i] = child;
device_set_softc(child, &sc->port[i]);
}
@ -905,7 +905,7 @@ cxgb_port_probe(device_t dev)
p = device_get_softc(dev);
snprintf(buf, sizeof(buf), "Port %d %s", p->port, p->port_type->desc);
snprintf(buf, sizeof(buf), "Port %d %s", p->port_id, p->port_type->desc);
device_set_desc_copy(dev, buf);
return (0);
}
@ -950,7 +950,7 @@ cxgb_port_attach(device_t dev)
p = device_get_softc(dev);
snprintf(p->lockbuf, PORT_NAME_LEN, "cxgb port lock %d:%d",
device_get_unit(device_get_parent(dev)), p->port);
device_get_unit(device_get_parent(dev)), p->port_id);
PORT_LOCK_INIT(p, p->lockbuf);
/* Allocate an ifnet object and set it up */
@ -1032,7 +1032,7 @@ cxgb_port_attach(device_t dev)
}
snprintf(p->taskqbuf, TASKQ_NAME_LEN, "cxgb_port_taskq%d", p->port);
snprintf(p->taskqbuf, TASKQ_NAME_LEN, "cxgb_port_taskq%d", p->port_id);
#ifdef TASKQUEUE_CURRENT
/* Create a port for handling TX without starvation */
p->tq = taskqueue_create(p->taskqbuf, M_NOWAIT,
@ -1195,7 +1195,6 @@ t3_os_link_changed(adapter_t *adapter, int port_id, int link_status, int speed,
}
}
/*
* Interrupt-context handler for external (PHY) interrupts.
*/
@ -1704,7 +1703,7 @@ cxgb_init_locked(struct port_info *p)
t3_intr_clear(sc);
t3_sge_init_adapter(sc);
}
setbit(&p->adapter->open_device_map, p->port);
setbit(&p->adapter->open_device_map, p->port_id);
ADAPTER_UNLOCK(p->adapter);
if (is_offload(sc) && !ofld_disable) {
@ -1714,10 +1713,10 @@ cxgb_init_locked(struct port_info *p)
"Could not initialize offload capabilities\n");
}
cxgb_link_start(p);
t3_link_changed(sc, p->port);
t3_link_changed(sc, p->port_id);
ifp->if_baudrate = p->link_config.speed * 1000000;
t3_port_intr_enable(sc, p->port);
t3_port_intr_enable(sc, p->port_id);
callout_reset(&sc->cxgb_tick_ch, sc->params.stats_update_period * hz,
cxgb_tick, sc);
@ -1748,13 +1747,13 @@ cxgb_stop_locked(struct port_info *p)
ifp = p->ifp;
t3_port_intr_disable(p->adapter, p->port);
t3_port_intr_disable(p->adapter, p->port_id);
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
p->phy.ops->power_down(&p->phy, 1);
t3_mac_disable(&p->mac, MAC_DIRECTION_TX | MAC_DIRECTION_RX);
ADAPTER_LOCK(p->adapter);
clrbit(&p->adapter->open_device_map, p->port);
clrbit(&p->adapter->open_device_map, p->port_id);
if (p->adapter->open_device_map == 0) {
@ -2119,7 +2118,7 @@ check_t3b2_mac(struct adapter *adapter)
cxgb_set_rxmode(p);
t3_link_start(&p->phy, mac, &p->link_config);
t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX);
t3_port_intr_enable(adapter, p->port);
t3_port_intr_enable(adapter, p->port_id);
p->mac.stats.num_resets++;
}
PORT_UNLOCK(p);
@ -2527,7 +2526,7 @@ cxgb_extension_ioctl(struct cdev *dev, unsigned long cmd, caddr_t data,
}
case CHELSIO_SET_QSET_NUM: {
struct ch_reg *edata = (struct ch_reg *)data;
unsigned int port_idx = pi->port;
unsigned int port_idx = pi->port_id;
if (sc->flags & FULL_INIT_DONE)
return (EBUSY);

View File

@ -1250,7 +1250,7 @@ cxgb_redirect(struct rtentry *old, struct rtentry *new)
}
/* Add new L2T entry */
e = t3_l2t_get(tdev, new, ((struct port_info *)new->rt_ifp->if_softc)->port);
e = t3_l2t_get(tdev, new, ((struct port_info *)new->rt_ifp->if_softc)->port_id);
if (!e) {
log(LOG_ERR, "%s: couldn't allocate new l2t entry!\n",
__FUNCTION__);

View File

@ -1196,7 +1196,7 @@ t3_encap(struct port_info *p, struct mbuf **m)
* XXX handle checksum, TSO, and VLAN here
*
*/
cntrl = V_TXPKT_INTF(p->port);
cntrl = V_TXPKT_INTF(p->port_id);
/*
* XXX need to add VLAN support for 6.x