Commit f3dc1586 authored by Sebastian Pöhn's avatar Sebastian Pöhn Committed by David S. Miller

gianfar: rx parser

Only let the rx parser be enabled if it is necessary (if VLAN extraction,
IP or TCP checksumming or the rx queue filer are enabled). Otherwise
disable it.

The new routine gfar_check_rx_parser_mode should be run after every
change on this features and will enable/disable the parser as necessary.
Signed-off-by: default avatarJiri Pirko <jpirko@redhat.com>
Signed-off-by: default avatarSebastian Poehn <sebastian.poehn@belden.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0d9b6e73
...@@ -2289,6 +2289,23 @@ static int gfar_set_mac_address(struct net_device *dev) ...@@ -2289,6 +2289,23 @@ static int gfar_set_mac_address(struct net_device *dev)
return 0; return 0;
} }
/* Check if rx parser should be activated */
void gfar_check_rx_parser_mode(struct gfar_private *priv)
{
struct gfar __iomem *regs;
u32 tempval;
regs = priv->gfargrp[0].regs;
tempval = gfar_read(&regs->rctrl);
/* If parse is no longer required, then disable parser */
if (tempval & RCTRL_REQ_PARSER)
tempval |= RCTRL_PRSDEP_INIT;
else
tempval &= ~RCTRL_PRSDEP_INIT;
gfar_write(&regs->rctrl, tempval);
}
/* Enables and disables VLAN insertion/extraction */ /* Enables and disables VLAN insertion/extraction */
static void gfar_vlan_rx_register(struct net_device *dev, static void gfar_vlan_rx_register(struct net_device *dev,
...@@ -2325,12 +2342,9 @@ static void gfar_vlan_rx_register(struct net_device *dev, ...@@ -2325,12 +2342,9 @@ static void gfar_vlan_rx_register(struct net_device *dev,
/* Disable VLAN tag extraction */ /* Disable VLAN tag extraction */
tempval = gfar_read(&regs->rctrl); tempval = gfar_read(&regs->rctrl);
tempval &= ~RCTRL_VLEX; tempval &= ~RCTRL_VLEX;
/* If parse is no longer required, then disable parser */
if (tempval & RCTRL_REQ_PARSER)
tempval |= RCTRL_PRSDEP_INIT;
else
tempval &= ~RCTRL_PRSDEP_INIT;
gfar_write(&regs->rctrl, tempval); gfar_write(&regs->rctrl, tempval);
gfar_check_rx_parser_mode(priv);
} }
gfar_change_mtu(dev, dev->mtu); gfar_change_mtu(dev, dev->mtu);
......
...@@ -274,7 +274,7 @@ extern const char gfar_driver_version[]; ...@@ -274,7 +274,7 @@ extern const char gfar_driver_version[];
#define RCTRL_PROM 0x00000008 #define RCTRL_PROM 0x00000008
#define RCTRL_EMEN 0x00000002 #define RCTRL_EMEN 0x00000002
#define RCTRL_REQ_PARSER (RCTRL_VLEX | RCTRL_IPCSEN | \ #define RCTRL_REQ_PARSER (RCTRL_VLEX | RCTRL_IPCSEN | \
RCTRL_TUCSEN) RCTRL_TUCSEN | RCTRL_FILREN)
#define RCTRL_CHECKSUMMING (RCTRL_IPCSEN | RCTRL_TUCSEN | \ #define RCTRL_CHECKSUMMING (RCTRL_IPCSEN | RCTRL_TUCSEN | \
RCTRL_PRSDEP_INIT) RCTRL_PRSDEP_INIT)
#define RCTRL_EXTHASH (RCTRL_GHTX) #define RCTRL_EXTHASH (RCTRL_GHTX)
...@@ -1156,6 +1156,7 @@ extern void gfar_configure_coalescing(struct gfar_private *priv, ...@@ -1156,6 +1156,7 @@ extern void gfar_configure_coalescing(struct gfar_private *priv,
unsigned long tx_mask, unsigned long rx_mask); unsigned long tx_mask, unsigned long rx_mask);
void gfar_init_sysfs(struct net_device *dev); void gfar_init_sysfs(struct net_device *dev);
int gfar_set_features(struct net_device *dev, u32 features); int gfar_set_features(struct net_device *dev, u32 features);
extern void gfar_check_rx_parser_mode(struct gfar_private *priv);
extern const struct ethtool_ops gfar_ethtool_ops; extern const struct ethtool_ops gfar_ethtool_ops;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment