- Integrate 1.133 vendor driver changes

- update some copyrights
- add improved support for delayed ack
- fix issue with fec
This commit is contained in:
kmacy 2008-03-18 03:55:12 +00:00
parent 9dbfb036ab
commit 8070f0fd71
9 changed files with 110 additions and 56 deletions

View File

@ -1,6 +1,6 @@
/**************************************************************************
Copyright (c) 2007, Chelsio Inc.
Copyright (c) 2007-2008, Chelsio Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -148,7 +148,7 @@ int t3_ael1002_phy_prep(struct cphy *phy, adapter_t *adapter, int phy_addr,
{
cphy_init(phy, adapter, phy_addr, &ael1002_ops, mdio_ops,
SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_FIBRE,
"10GBASE-XR");
"10GBASE-R");
ael100x_txon(phy);
return 0;
}

View File

@ -1,6 +1,6 @@
/**************************************************************************
Copyright (c) 2007, Chelsio Inc.
Copyright (c) 2007-2008, Chelsio Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -684,6 +684,7 @@ int t3_prep_adapter(adapter_t *adapter, const struct adapter_info *ai, int reset
void t3_led_ready(adapter_t *adapter);
void t3_fatal_err(adapter_t *adapter);
void t3_set_vlan_accel(adapter_t *adapter, unsigned int ports, int on);
void t3_tp_set_offload_mode(adapter_t *adap, int enable);
void t3_enable_filters(adapter_t *adap);
void t3_config_rss(adapter_t *adapter, unsigned int rss_config, const u8 *cpus,
const u16 *rspq);
@ -718,10 +719,9 @@ void t3_mc5_intr_handler(struct mc5 *mc5);
int t3_read_mc5_range(const struct mc5 *mc5, unsigned int start, unsigned int n,
u32 *buf);
#ifdef CONFIG_CHELSIO_T3_CORE
#if defined(CONFIG_CHELSIO_T3_CORE)
int t3_tp_set_coalescing_size(adapter_t *adap, unsigned int size, int psh);
void t3_tp_set_max_rxsize(adapter_t *adap, unsigned int size);
void t3_tp_set_offload_mode(adapter_t *adap, int enable);
void t3_tp_get_mib_stats(adapter_t *adap, struct tp_mib_stats *tps);
void t3_load_mtus(adapter_t *adap, unsigned short mtus[NMTUS],
unsigned short alpha[NCCTRL_WIN],

View File

@ -1,6 +1,6 @@
/**************************************************************************
Copyright (c) 2007, Chelsio Inc.
Copyright (c) 2007-2008, Chelsio Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -37,5 +37,5 @@ POSSIBILITY OF SUCH DAMAGE.
#define __CHELSIO_VERSION_H
#define DRV_DESC "Chelsio T3 Network Driver"
#define DRV_NAME "cxgb"
#define DRV_VERSION "1.0.129a"
#define DRV_VERSION "1.0.133"
#endif

View File

@ -1,6 +1,6 @@
/**************************************************************************
Copyright (c) 2007, Chelsio Inc.
Copyright (c) 2007-2008, Chelsio Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -990,7 +990,7 @@ cxgb_port_attach(device_t dev)
media_flags = IFM_ETHER | IFM_10G_CX4 | IFM_FDX;
} else if (!strcmp(p->phy.desc, "10GBASE-SR")) {
media_flags = IFM_ETHER | IFM_10G_SR | IFM_FDX;
} else if (!strcmp(p->phy.desc, "10GBASE-XR")) {
} else if (!strcmp(p->phy.desc, "10GBASE-R")) {
media_flags = IFM_ETHER | IFM_10G_LR | IFM_FDX;
} else if (!strcmp(p->phy.desc, "10/100/1000BASE-T")) {
ifmedia_add(&p->media, IFM_ETHER | IFM_10_T, 0, NULL);
@ -1025,7 +1025,9 @@ cxgb_port_attach(device_t dev)
/* Create a port for handling TX without starvation */
p->tq = taskqueue_create_fast(p->taskqbuf, M_NOWAIT,
taskqueue_thread_enqueue, &p->tq);
#endif
#endif
/* Get the latest mac address, User can use a LAA */
bcopy(IF_LLADDR(p->ifp), p->hw_addr, ETHER_ADDR_LEN);
t3_sge_init_port(p);
cxgb_link_start(p);
t3_link_changed(sc, p->port_id);
@ -1155,7 +1157,7 @@ t3_os_pci_restore_state(struct adapter *sc)
* t3_os_link_changed - handle link status changes
* @adapter: the adapter associated with the link change
* @port_id: the port index whose limk status has changed
* @link_stat: the new status of the link
* @link_status: the new status of the link
* @speed: the new speed setting
* @duplex: the new duplex setting
* @fc: the new flow-control setting
@ -1172,12 +1174,19 @@ t3_os_link_changed(adapter_t *adapter, int port_id, int link_status, int speed,
struct cmac *mac = &adapter->port[port_id].mac;
if (link_status) {
t3_mac_enable(mac, MAC_DIRECTION_RX);
DELAY(10);
t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX);
/* Clear errors created by MAC enable */
t3_set_reg_field(adapter,
A_XGM_STAT_CTRL + pi->mac.offset,
F_CLRSTATS, 1);
if_link_state_change(pi->ifp, LINK_STATE_UP);
} else {
pi->phy.ops->power_down(&pi->phy, 1);
t3_mac_disable(mac, MAC_DIRECTION_RX);
t3_link_start(&pi->phy, mac, &pi->link_config);
t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX);
if_link_state_change(pi->ifp, LINK_STATE_DOWN);
}
}
@ -1832,26 +1841,46 @@ cxgb_set_rxmode(struct port_info *p)
}
static void
cxgb_stop_locked(struct port_info *p)
cxgb_stop_locked(struct port_info *pi)
{
struct ifnet *ifp;
PORT_LOCK_ASSERT_OWNED(p);
ADAPTER_LOCK_ASSERT_NOTOWNED(p->adapter);
PORT_LOCK_ASSERT_OWNED(pi);
ADAPTER_LOCK_ASSERT_NOTOWNED(pi->adapter);
ifp = p->ifp;
t3_port_intr_disable(p->adapter, p->port_id);
ifp = pi->ifp;
t3_port_intr_disable(pi->adapter, pi->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_id);
/* disable pause frames */
t3_set_reg_field(pi->adapter, A_XGM_TX_CFG + pi->mac.offset,
F_TXPAUSEEN, 0);
if (p->adapter->open_device_map == 0) {
cxgb_down_locked(p->adapter);
/* Reset RX FIFO HWM */
t3_set_reg_field(pi->adapter, A_XGM_RXFIFO_CFG + pi->mac.offset,
V_RXFIFOPAUSEHWM(M_RXFIFOPAUSEHWM), 0);
ADAPTER_LOCK(pi->adapter);
clrbit(&pi->adapter->open_device_map, pi->port_id);
if (pi->adapter->open_device_map == 0) {
cxgb_down_locked(pi->adapter);
} else
ADAPTER_UNLOCK(p->adapter);
ADAPTER_UNLOCK(pi->adapter);
DELAY(100);
/* Wait for TXFIFO empty */
t3_wait_op_done(pi->adapter, A_XGM_TXFIFO_CFG + pi->mac.offset,
F_TXFIFO_EMPTY, 1, 20, 5);
DELAY(100);
t3_mac_disable(&pi->mac, MAC_DIRECTION_TX | MAC_DIRECTION_RX);
pi->phy.ops->power_down(&pi->phy, 1);
}

View File

@ -638,6 +638,14 @@ do_rx_urg_notify(struct t3cdev *cdev, struct mbuf *m, void *ctx)
return (0);
}
static __inline int
is_delack_mode_valid(struct toedev *dev, struct toepcb *toep)
{
return (toep->tp_ulp_mode ||
(toep->tp_ulp_mode == ULP_MODE_TCPDDP &&
dev->tod_ttid >= TOE_ID_CHELSIO_T3));
}
/*
* Set of states for which we should return RX credits.
*/
@ -702,9 +710,7 @@ t3_cleanup_rbuf(struct tcpcb *tp, int copied)
if (__predict_false(thres == 0))
return;
if (toep->tp_ulp_mode)
dack = F_RX_DACK_CHANGE | V_RX_DACK_MODE(1);
else {
if (is_delack_mode_valid(dev, toep)) {
dack_mode = TOM_TUNABLE(dev, delack);
if (__predict_false(dack_mode != toep->tp_delack_mode)) {
u32 r = tp->rcv_nxt - toep->tp_delack_seq;
@ -713,8 +719,9 @@ t3_cleanup_rbuf(struct tcpcb *tp, int copied)
dack = F_RX_DACK_CHANGE |
V_RX_DACK_MODE(dack_mode);
}
}
} else
dack = F_RX_DACK_CHANGE | V_RX_DACK_MODE(1);
/*
* For coalescing to work effectively ensure the receive window has
* at least 16KB left.
@ -887,6 +894,12 @@ t3_set_rcv_coalesce_enable(struct socket *so, int on_off)
set_tcb_tflag(so, S_TF_RCV_COALESCE_ENABLE, on_off);
}
void
t3_set_dack_mss(struct socket *so, int on_off)
{
set_tcb_tflag(so, S_TF_DACK_MSS, on_off);
}
/*
* Send a SET_TCB_FIELD CPL message to change a connection's TOS setting.
*/
@ -2052,6 +2065,7 @@ new_rx_data_ddp(struct toepcb *toep, struct mbuf *m)
unsigned int ddp_len, rcv_nxt, ddp_report, end_offset, buf_idx;
struct socket *so = toeptoso(toep);
int nomoredata = 0;
unsigned int delack_mode;
tp = sototcpcb(so);
@ -2091,6 +2105,12 @@ new_rx_data_ddp(struct toepcb *toep, struct mbuf *m)
ddp_len = ntohs(hdr->len);
rcv_nxt = ntohl(hdr->seq) + ddp_len;
delack_mode = G_DDP_DACK_MODE(ddp_report);
if (__predict_false(G_DDP_DACK_MODE(ddp_report) != toep->tp_delack_mode)) {
toep->tp_delack_mode = delack_mode;
toep->tp_delack_seq = tp->rcv_nxt;
}
m->m_seq = tp->rcv_nxt;
tp->rcv_nxt = rcv_nxt;
@ -2153,11 +2173,10 @@ new_rx_data_ddp(struct toepcb *toep, struct mbuf *m)
if (nomoredata)
m->m_ddp_flags |= DDP_BF_NODATA;
if (__predict_false(G_DDP_DACK_MODE(ddp_report) != toep->tp_delack_mode)) {
toep->tp_delack_mode = G_DDP_DACK_MODE(ddp_report);
toep->tp_delack_seq = tp->rcv_nxt;
}
#ifdef notyet
skb_reset_transport_header(skb);
tcp_hdr(skb)->fin = 0; /* changes original hdr->ddp_report */
#endif
SBAPPEND(&so->so_rcv, m);
if ((so->so_state & SS_NOFDREF) == 0)
@ -2202,7 +2221,7 @@ process_ddp_complete(struct toepcb *toep, struct mbuf *m)
struct ddp_state *q;
struct ddp_buf_state *bsp;
struct cpl_rx_ddp_complete *hdr;
unsigned int ddp_report, buf_idx, when;
unsigned int ddp_report, buf_idx, when, delack_mode;
int nomoredata = 0;
INP_LOCK(tp->t_inpcb);
@ -2226,16 +2245,19 @@ process_ddp_complete(struct toepcb *toep, struct mbuf *m)
m->m_len = m->m_pkthdr.len = G_DDP_OFFSET(ddp_report) - when;
tp->rcv_nxt += m->m_len;
tp->t_rcvtime = ticks;
delack_mode = G_DDP_DACK_MODE(ddp_report);
if (__predict_false(G_DDP_DACK_MODE(ddp_report) != toep->tp_delack_mode)) {
toep->tp_delack_mode = delack_mode;
toep->tp_delack_seq = tp->rcv_nxt;
}
#ifdef notyet
skb_reset_transport_header(skb);
tcp_hdr(skb)->fin = 0; /* changes valid memory past CPL */
#endif
INP_UNLOCK(tp->t_inpcb);
KASSERT(m->m_len > 0, ("%s m_len=%d", __FUNCTION__, m->m_len));
#ifdef T3_TRACE
T3_TRACE5(TIDTB(sk),
"process_ddp_complete: tp->rcv_nxt 0x%x cur_offset %u "
"ddp_report 0x%x offset %u, len %u",
tp->rcv_nxt, bsp->cur_offset, ddp_report,
G_DDP_OFFSET(ddp_report), skb->len);
#endif
CTR5(KTR_TOM,
"process_ddp_complete: tp->rcv_nxt 0x%x cur_offset %u "
"ddp_report 0x%x offset %u, len %u",
@ -2250,13 +2272,6 @@ process_ddp_complete(struct toepcb *toep, struct mbuf *m)
nomoredata=1;
}
#ifdef T3_TRACE
T3_TRACE4(TIDTB(sk),
"process_ddp_complete: tp->rcv_nxt 0x%x cur_offset %u "
"ddp_report %u offset %u",
tp->rcv_nxt, bsp->cur_offset, ddp_report,
G_DDP_OFFSET(ddp_report));
#endif
CTR4(KTR_TOM,
"process_ddp_complete: tp->rcv_nxt 0x%x cur_offset %u "
"ddp_report %u offset %u",
@ -2271,6 +2286,7 @@ process_ddp_complete(struct toepcb *toep, struct mbuf *m)
if (nomoredata)
m->m_ddp_flags |= DDP_BF_NODATA;
SBAPPEND(&so->so_rcv, m);
if ((so->so_state & SS_NOFDREF) == 0)
@ -2369,6 +2385,10 @@ handle_peer_close_data(struct socket *so, struct mbuf *m)
bsp->cur_offset += m->m_pkthdr.len;
if (!(bsp->flags & DDP_BF_NOFLIP))
q->cur_buf ^= 1;
#ifdef notyet
skb_reset_transport_header(skb);
tcp_hdr(skb)->fin = 0; /* changes valid memory past CPL */
#endif
tp->t_rcvtime = ticks;
SBAPPEND(&so->so_rcv, m);
if (__predict_true((so->so_state & SS_NOFDREF) == 0))
@ -4006,7 +4026,8 @@ mk_set_tcb_field_ulp(struct cpl_set_tcb_field *req, unsigned int tid,
* Build a CPL_RX_DATA_ACK message as payload of a ULP_TX_PKT command.
*/
static void
mk_rx_data_ack_ulp(struct cpl_rx_data_ack *ack, unsigned int tid, unsigned int credits)
mk_rx_data_ack_ulp(struct socket *so,struct cpl_rx_data_ack *ack,
unsigned int tid, unsigned int credits)
{
struct ulp_txpkt *txpkt = (struct ulp_txpkt *)ack;
@ -4014,7 +4035,8 @@ mk_rx_data_ack_ulp(struct cpl_rx_data_ack *ack, unsigned int tid, unsigned int c
txpkt->len = htonl(V_ULPTX_NFLITS(sizeof(*ack) / 8));
OPCODE_TID(ack) = htonl(MK_OPCODE_TID(CPL_RX_DATA_ACK, tid));
ack->credit_dack = htonl(F_RX_MODULATE | F_RX_DACK_CHANGE |
V_RX_DACK_MODE(1) | V_RX_CREDITS(credits));
V_RX_DACK_MODE(TOM_TUNABLE(TOE_DEV(so), delack)) |
V_RX_CREDITS(credits));
}
void
@ -4216,8 +4238,9 @@ t3_setup_ddpbufs(struct toepcb *toep, unsigned int len0, unsigned int offset0,
ddp_flags);
if (modulate) {
mk_rx_data_ack_ulp((struct cpl_rx_data_ack *)(req + 1), toep->tp_tid,
toep->tp_copied_seq - toep->tp_rcv_wup);
mk_rx_data_ack_ulp(toeptoso(toep),
(struct cpl_rx_data_ack *)(req + 1), toep->tp_tid,
toep->tp_copied_seq - toep->tp_rcv_wup);
toep->tp_rcv_wup = toep->tp_copied_seq;
}

View File

@ -825,7 +825,7 @@ t3_soreceive(struct socket *so, int *flagsp, struct uio *uio)
sbdrop_locked(&so->so_rcv, m->m_pkthdr.len);
#endif
exitnow = got_psh || nomoredata;
if ((so->so_rcv.sb_mb == NULL) && exitnow)
if (copied >= target && (so->so_rcv.sb_mb == NULL) && exitnow)
goto done;
if (copied_unacked > (so->so_rcv.sb_hiwat >> 2)) {
SOCKBUF_UNLOCK(&so->so_rcv);
@ -917,7 +917,7 @@ cxgb_soreceive(struct socket *so, struct sockaddr **psa, struct uio *uio,
*
*/
if ((tp->t_flags & TF_TOE) && uio && ((flags & (MSG_WAITALL|MSG_OOB|MSG_PEEK|MSG_DONTWAIT)) == 0)
if ((tp->t_flags & TF_TOE) && uio && ((flags & (MSG_OOB|MSG_PEEK|MSG_DONTWAIT)) == 0)
&& (uio->uio_iovcnt == 1) && (mp0 == NULL)) {
tdev = TOE_DEV(so);
zcopy_thres = TOM_TUNABLE(tdev, ddp_thres);

View File

@ -654,7 +654,8 @@ t3_enter_ddp(struct socket *so, unsigned int kbuf_size, unsigned int waitall, in
t3_set_rcv_coalesce_enable(so,
TOM_TUNABLE(TOE_DEV(so), ddp_rcvcoalesce));
t3_set_dack_mss(so, TOM_TUNABLE(TOE_DEV(so), delack)>>1);
#ifdef T3_TRACE
T3_TRACE4(TIDTB(so),
"t3_enter_ddp: kbuf_size %u waitall %u tag0 %d tag1 %d",

View File

@ -78,6 +78,7 @@ void toepcb_release(struct toepcb *);
void toepcb_init(struct toepcb *);
void t3_set_rcv_coalesce_enable(struct socket *so, int on_off);
void t3_set_dack_mss(struct socket *so, int on);
void t3_set_keepalive(struct socket *so, int on_off);
void t3_set_ddp_tag(struct socket *so, int buf_idx, unsigned int tag);
void t3_set_ddp_buf(struct socket *so, int buf_idx, unsigned int offset,