aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/cxgb3')
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c69
-rw-r--r--drivers/net/cxgb3/sge.c1
2 files changed, 57 insertions, 13 deletions
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 2c341f83d327..b6b2a46b7d0e 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -494,6 +494,36 @@ static void enable_all_napi(struct adapter *adap)
494} 494}
495 495
496/** 496/**
497 * set_qset_lro - Turn a queue set's LRO capability on and off
498 * @dev: the device the qset is attached to
499 * @qset_idx: the queue set index
500 * @val: the LRO switch
501 *
502 * Sets LRO on or off for a particular queue set.
503 * the device's features flag is updated to reflect the LRO
504 * capability when all queues belonging to the device are
505 * in the same state.
506 */
507static void set_qset_lro(struct net_device *dev, int qset_idx, int val)
508{
509 struct port_info *pi = netdev_priv(dev);
510 struct adapter *adapter = pi->adapter;
511 int i, lro_on = 1;
512
513 adapter->params.sge.qset[qset_idx].lro = !!val;
514 adapter->sge.qs[qset_idx].lro_enabled = !!val;
515
516 /* let ethtool report LRO on only if all queues are LRO enabled */
517 for (i = pi->first_qset; i < pi->first_qset + pi->nqsets; ++i)
518 lro_on &= adapter->params.sge.qset[i].lro;
519
520 if (lro_on)
521 dev->features |= NETIF_F_LRO;
522 else
523 dev->features &= ~NETIF_F_LRO;
524}
525
526/**
497 * setup_sge_qsets - configure SGE Tx/Rx/response queues 527 * setup_sge_qsets - configure SGE Tx/Rx/response queues
498 * @adap: the adapter 528 * @adap: the adapter
499 * 529 *
@@ -516,8 +546,7 @@ static int setup_sge_qsets(struct adapter *adap)
516 pi->qs = &adap->sge.qs[pi->first_qset]; 546 pi->qs = &adap->sge.qs[pi->first_qset];
517 for (j = pi->first_qset; j < pi->first_qset + pi->nqsets; 547 for (j = pi->first_qset; j < pi->first_qset + pi->nqsets;
518 ++j, ++qset_idx) { 548 ++j, ++qset_idx) {
519 if (!pi->rx_csum_offload) 549 set_qset_lro(dev, qset_idx, pi->rx_csum_offload);
520 adap->params.sge.qset[qset_idx].lro = 0;
521 err = t3_sge_alloc_qset(adap, qset_idx, 1, 550 err = t3_sge_alloc_qset(adap, qset_idx, 1,
522 (adap->flags & USING_MSIX) ? qset_idx + 1 : 551 (adap->flags & USING_MSIX) ? qset_idx + 1 :
523 irq_idx, 552 irq_idx,
@@ -1634,13 +1663,10 @@ static int set_rx_csum(struct net_device *dev, u32 data)
1634 1663
1635 p->rx_csum_offload = data; 1664 p->rx_csum_offload = data;
1636 if (!data) { 1665 if (!data) {
1637 struct adapter *adap = p->adapter;
1638 int i; 1666 int i;
1639 1667
1640 for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) { 1668 for (i = p->first_qset; i < p->first_qset + p->nqsets; i++)
1641 adap->params.sge.qset[i].lro = 0; 1669 set_qset_lro(dev, i, 0);
1642 adap->sge.qs[i].lro_enabled = 0;
1643 }
1644 } 1670 }
1645 return 0; 1671 return 0;
1646} 1672}
@@ -1795,6 +1821,25 @@ static void get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
1795 memset(&wol->sopass, 0, sizeof(wol->sopass)); 1821 memset(&wol->sopass, 0, sizeof(wol->sopass));
1796} 1822}
1797 1823
1824static int cxgb3_set_flags(struct net_device *dev, u32 data)
1825{
1826 struct port_info *pi = netdev_priv(dev);
1827 int i;
1828
1829 if (data & ETH_FLAG_LRO) {
1830 if (!pi->rx_csum_offload)
1831 return -EINVAL;
1832
1833 for (i = pi->first_qset; i < pi->first_qset + pi->nqsets; i++)
1834 set_qset_lro(dev, i, 1);
1835
1836 } else
1837 for (i = pi->first_qset; i < pi->first_qset + pi->nqsets; i++)
1838 set_qset_lro(dev, i, 0);
1839
1840 return 0;
1841}
1842
1798static const struct ethtool_ops cxgb_ethtool_ops = { 1843static const struct ethtool_ops cxgb_ethtool_ops = {
1799 .get_settings = get_settings, 1844 .get_settings = get_settings,
1800 .set_settings = set_settings, 1845 .set_settings = set_settings,
@@ -1824,6 +1869,8 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
1824 .get_regs = get_regs, 1869 .get_regs = get_regs,
1825 .get_wol = get_wol, 1870 .get_wol = get_wol,
1826 .set_tso = ethtool_op_set_tso, 1871 .set_tso = ethtool_op_set_tso,
1872 .get_flags = ethtool_op_get_flags,
1873 .set_flags = cxgb3_set_flags,
1827}; 1874};
1828 1875
1829static int in_range(int val, int lo, int hi) 1876static int in_range(int val, int lo, int hi)
@@ -1940,11 +1987,9 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
1940 } 1987 }
1941 } 1988 }
1942 } 1989 }
1943 if (t.lro >= 0) { 1990 if (t.lro >= 0)
1944 struct sge_qset *qs = &adapter->sge.qs[t.qset_idx]; 1991 set_qset_lro(dev, t.qset_idx, t.lro);
1945 q->lro = t.lro; 1992
1946 qs->lro_enabled = t.lro;
1947 }
1948 break; 1993 break;
1949 } 1994 }
1950 case CHELSIO_GET_QSET_PARAMS:{ 1995 case CHELSIO_GET_QSET_PARAMS:{
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index c6480be0bc1f..268f15801ec6 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1876,7 +1876,6 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
1876 1876
1877 skb_pull(skb, sizeof(*p) + pad); 1877 skb_pull(skb, sizeof(*p) + pad);
1878 skb->protocol = eth_type_trans(skb, adap->port[p->iff]); 1878 skb->protocol = eth_type_trans(skb, adap->port[p->iff]);
1879 skb->dev->last_rx = jiffies;
1880 pi = netdev_priv(skb->dev); 1879 pi = netdev_priv(skb->dev);
1881 if (pi->rx_csum_offload && p->csum_valid && p->csum == htons(0xffff) && 1880 if (pi->rx_csum_offload && p->csum_valid && p->csum == htons(0xffff) &&
1882 !p->fragment) { 1881 !p->fragment) {