diff options
Diffstat (limited to 'sys/dev/cxgb/cxgb_main.c')
-rw-r--r-- | sys/dev/cxgb/cxgb_main.c | 62 |
1 files changed, 46 insertions, 16 deletions
diff --git a/sys/dev/cxgb/cxgb_main.c b/sys/dev/cxgb/cxgb_main.c index d77996a..ac25e2e 100644 --- a/sys/dev/cxgb/cxgb_main.c +++ b/sys/dev/cxgb/cxgb_main.c @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include <net/if_dl.h> #include <net/if_media.h> #include <net/if_types.h> +#include <net/if_vlan_var.h> #include <netinet/in_systm.h> #include <netinet/in.h> @@ -978,7 +979,7 @@ cxgb_port_attach(device_t dev) * Only default to jumbo frames on 10GigE */ if (p->adapter->params.nports <= 2) - ifp->if_mtu = 9000; + ifp->if_mtu = ETHERMTU_JUMBO; if ((err = cxgb_makedev(p)) != 0) { printf("makedev failed %d\n", err); return (err); @@ -1242,13 +1243,23 @@ cxgb_link_start(struct port_info *p) struct ifnet *ifp; struct t3_rx_mode rm; struct cmac *mac = &p->mac; + int mtu, hwtagging; ifp = p->ifp; + bcopy(IF_LLADDR(ifp), p->hw_addr, ETHER_ADDR_LEN); + + mtu = ifp->if_mtu; + if (ifp->if_capenable & IFCAP_VLAN_MTU) + mtu += ETHER_VLAN_ENCAP_LEN; + + hwtagging = (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0; + t3_init_rx_mode(&rm, p); if (!mac->multiport) t3_mac_reset(mac); - t3_mac_set_mtu(mac, ifp->if_mtu + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); + t3_mac_set_mtu(mac, mtu); + t3_set_vlan_accel(p->adapter, 1 << p->tx_chan, hwtagging); t3_mac_set_address(mac, 0, p->hw_addr); t3_mac_set_rx_mode(mac, &rm); t3_link_start(&p->phy, mac, &p->link_config); @@ -1894,7 +1905,7 @@ cxgb_set_mtu(struct port_info *p, int mtu) struct ifnet *ifp = p->ifp; int error = 0; - if ((mtu < ETHERMIN) || (mtu > ETHER_MAX_LEN_JUMBO)) + if ((mtu < ETHERMIN) || (mtu > ETHERMTU_JUMBO)) error = EINVAL; else if (ifp->if_mtu != mtu) { PORT_LOCK(p); @@ -1914,7 +1925,7 @@ cxgb_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data) struct port_info *p = ifp->if_softc; struct ifaddr *ifa = (struct ifaddr *)data; struct ifreq *ifr = (struct ifreq *)data; - int flags, error = 0; + int flags, error = 0, reinit = 0; uint32_t mask; /* @@ -1969,18 +1980,16 @@ cxgb_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data) if (IFCAP_TXCSUM & ifp->if_capenable) { ifp->if_capenable &= ~(IFCAP_TXCSUM|IFCAP_TSO4); ifp->if_hwassist &= ~(CSUM_TCP | CSUM_UDP - | CSUM_TSO); + | CSUM_IP | CSUM_TSO); } else { ifp->if_capenable |= IFCAP_TXCSUM; - ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP); - } - } else if (mask & IFCAP_RXCSUM) { - if (IFCAP_RXCSUM & ifp->if_capenable) { - ifp->if_capenable &= ~IFCAP_RXCSUM; - } else { - ifp->if_capenable |= IFCAP_RXCSUM; + ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP + | CSUM_IP); } } + if (mask & IFCAP_RXCSUM) { + ifp->if_capenable ^= IFCAP_RXCSUM; + } if (mask & IFCAP_TSO4) { if (IFCAP_TSO4 & ifp->if_capenable) { ifp->if_capenable &= ~IFCAP_TSO4; @@ -1995,7 +2004,26 @@ cxgb_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data) error = EINVAL; } } + if (mask & IFCAP_VLAN_HWTAGGING) { + ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; + reinit = ifp->if_drv_flags & IFF_DRV_RUNNING; + } + if (mask & IFCAP_VLAN_MTU) { + ifp->if_capenable ^= IFCAP_VLAN_MTU; + reinit = ifp->if_drv_flags & IFF_DRV_RUNNING; + } + if (mask & IFCAP_VLAN_HWCSUM) { + ifp->if_capenable ^= IFCAP_VLAN_HWCSUM; + } + if (reinit) { + cxgb_stop_locked(p); + cxgb_init_locked(p); + } PORT_UNLOCK(p); + +#ifdef VLAN_CAPABILITIES + VLAN_CAPABILITIES(ifp); +#endif break; default: error = ether_ioctl(ifp, command, data); @@ -2116,9 +2144,11 @@ check_t3b2_mac(struct adapter *adapter) p->mac.stats.num_toggled++; else if (status == 2) { struct cmac *mac = &p->mac; + int mtu = ifp->if_mtu; - t3_mac_set_mtu(mac, ifp->if_mtu + ETHER_HDR_LEN - + ETHER_VLAN_ENCAP_LEN); + if (ifp->if_capenable & IFCAP_VLAN_MTU) + mtu += ETHER_VLAN_ENCAP_LEN; + t3_mac_set_mtu(mac, mtu); t3_mac_set_address(mac, 0, p->hw_addr); cxgb_set_rxmode(p); t3_link_start(&p->phy, mac, &p->link_config); @@ -2424,7 +2454,7 @@ cxgb_extension_ioctl(struct cdev *dev, unsigned long cmd, caddr_t data, if (t->intr_lat >= 0) { struct sge_qset *qs = &sc->sge.qs[t->qset_idx]; - q->coalesce_nsecs = t->intr_lat*1000; + q->coalesce_usecs = t->intr_lat; t3_update_qset_coalesce(qs, q); } break; @@ -2444,7 +2474,7 @@ cxgb_extension_ioctl(struct cdev *dev, unsigned long cmd, caddr_t data, t->fl_size[0] = q->fl_size; t->fl_size[1] = q->jumbo_size; t->polling = q->polling; - t->intr_lat = q->coalesce_nsecs / 1000; + t->intr_lat = q->coalesce_usecs; t->cong_thres = q->cong_thres; break; } |