aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x_main.c
diff options
context:
space:
mode:
authorVladislav Zolotarov <vladz@broadcom.com>2008-08-13 18:53:38 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-13 19:03:42 -0400
commitdf0f23439a69eb5ca30668612f1c4e20041b5341 (patch)
tree03c257eaca101c2386a3b72716b8a8bd2179b26c /drivers/net/bnx2x_main.c
parent353029896a5ed6cf42f4ce45729851b23c94d874 (diff)
bnx2x: No LRO without Rx checksum
No LRO without Rx checksum Disabling LRO when Rx checksum is disabled Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x_main.c')
-rw-r--r--drivers/net/bnx2x_main.c67
1 files changed, 39 insertions, 28 deletions
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 6fe19726ae43..d29f22763fec 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -8272,33 +8272,6 @@ static int bnx2x_set_coalesce(struct net_device *dev,
8272 return 0; 8272 return 0;
8273} 8273}
8274 8274
8275static int bnx2x_set_flags(struct net_device *dev, u32 data)
8276{
8277 struct bnx2x *bp = netdev_priv(dev);
8278 int changed = 0;
8279 int rc = 0;
8280
8281 if (data & ETH_FLAG_LRO) {
8282 if (!(dev->features & NETIF_F_LRO)) {
8283 dev->features |= NETIF_F_LRO;
8284 bp->flags |= TPA_ENABLE_FLAG;
8285 changed = 1;
8286 }
8287
8288 } else if (dev->features & NETIF_F_LRO) {
8289 dev->features &= ~NETIF_F_LRO;
8290 bp->flags &= ~TPA_ENABLE_FLAG;
8291 changed = 1;
8292 }
8293
8294 if (changed && netif_running(dev)) {
8295 bnx2x_nic_unload(bp, UNLOAD_NORMAL);
8296 rc = bnx2x_nic_load(bp, LOAD_NORMAL);
8297 }
8298
8299 return rc;
8300}
8301
8302static void bnx2x_get_ringparam(struct net_device *dev, 8275static void bnx2x_get_ringparam(struct net_device *dev,
8303 struct ethtool_ringparam *ering) 8276 struct ethtool_ringparam *ering)
8304{ 8277{
@@ -8400,6 +8373,34 @@ static int bnx2x_set_pauseparam(struct net_device *dev,
8400 return 0; 8373 return 0;
8401} 8374}
8402 8375
8376static int bnx2x_set_flags(struct net_device *dev, u32 data)
8377{
8378 struct bnx2x *bp = netdev_priv(dev);
8379 int changed = 0;
8380 int rc = 0;
8381
8382 /* TPA requires Rx CSUM offloading */
8383 if ((data & ETH_FLAG_LRO) && bp->rx_csum) {
8384 if (!(dev->features & NETIF_F_LRO)) {
8385 dev->features |= NETIF_F_LRO;
8386 bp->flags |= TPA_ENABLE_FLAG;
8387 changed = 1;
8388 }
8389
8390 } else if (dev->features & NETIF_F_LRO) {
8391 dev->features &= ~NETIF_F_LRO;
8392 bp->flags &= ~TPA_ENABLE_FLAG;
8393 changed = 1;
8394 }
8395
8396 if (changed && netif_running(dev)) {
8397 bnx2x_nic_unload(bp, UNLOAD_NORMAL);
8398 rc = bnx2x_nic_load(bp, LOAD_NORMAL);
8399 }
8400
8401 return rc;
8402}
8403
8403static u32 bnx2x_get_rx_csum(struct net_device *dev) 8404static u32 bnx2x_get_rx_csum(struct net_device *dev)
8404{ 8405{
8405 struct bnx2x *bp = netdev_priv(dev); 8406 struct bnx2x *bp = netdev_priv(dev);
@@ -8410,9 +8411,19 @@ static u32 bnx2x_get_rx_csum(struct net_device *dev)
8410static int bnx2x_set_rx_csum(struct net_device *dev, u32 data) 8411static int bnx2x_set_rx_csum(struct net_device *dev, u32 data)
8411{ 8412{
8412 struct bnx2x *bp = netdev_priv(dev); 8413 struct bnx2x *bp = netdev_priv(dev);
8414 int rc = 0;
8413 8415
8414 bp->rx_csum = data; 8416 bp->rx_csum = data;
8415 return 0; 8417
8418 /* Disable TPA, when Rx CSUM is disabled. Otherwise all
8419 TPA'ed packets will be discarded due to wrong TCP CSUM */
8420 if (!data) {
8421 u32 flags = ethtool_op_get_flags(dev);
8422
8423 rc = bnx2x_set_flags(dev, (flags & ~ETH_FLAG_LRO));
8424 }
8425
8426 return rc;
8416} 8427}
8417 8428
8418static int bnx2x_set_tso(struct net_device *dev, u32 data) 8429static int bnx2x_set_tso(struct net_device *dev, u32 data)