Commit 1b2250a0 authored by Jose Abreu's avatar Jose Abreu Committed by David S. Miller

net: stmmac: selftests: Add tests for VLAN Perfect Filtering

Add two new tests for VLAN Perfect Filtering. While at it, increase a
little bit the tests strings lenght so that we can have more descriptive
test names.
Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c7ab0b80
......@@ -816,16 +816,13 @@ static int stmmac_test_vlan_validate(struct sk_buff *skb,
return 0;
}
static int stmmac_test_vlanfilt(struct stmmac_priv *priv)
static int __stmmac_test_vlanfilt(struct stmmac_priv *priv)
{
struct stmmac_packet_attrs attr = { };
struct stmmac_test_priv *tpriv;
struct sk_buff *skb = NULL;
int ret = 0, i;
if (!priv->dma_cap.vlhash)
return -EOPNOTSUPP;
tpriv = kzalloc(sizeof(*tpriv), GFP_KERNEL);
if (!tpriv)
return -ENOMEM;
......@@ -891,16 +888,32 @@ static int stmmac_test_vlanfilt(struct stmmac_priv *priv)
return ret;
}
static int stmmac_test_dvlanfilt(struct stmmac_priv *priv)
static int stmmac_test_vlanfilt(struct stmmac_priv *priv)
{
if (!priv->dma_cap.vlhash)
return -EOPNOTSUPP;
return __stmmac_test_vlanfilt(priv);
}
static int stmmac_test_vlanfilt_perfect(struct stmmac_priv *priv)
{
int ret, prev_cap = priv->dma_cap.vlhash;
priv->dma_cap.vlhash = 0;
ret = __stmmac_test_vlanfilt(priv);
priv->dma_cap.vlhash = prev_cap;
return ret;
}
static int __stmmac_test_dvlanfilt(struct stmmac_priv *priv)
{
struct stmmac_packet_attrs attr = { };
struct stmmac_test_priv *tpriv;
struct sk_buff *skb = NULL;
int ret = 0, i;
if (!priv->dma_cap.vlhash)
return -EOPNOTSUPP;
tpriv = kzalloc(sizeof(*tpriv), GFP_KERNEL);
if (!tpriv)
return -ENOMEM;
......@@ -967,6 +980,25 @@ static int stmmac_test_dvlanfilt(struct stmmac_priv *priv)
return ret;
}
static int stmmac_test_dvlanfilt(struct stmmac_priv *priv)
{
if (!priv->dma_cap.vlhash)
return -EOPNOTSUPP;
return __stmmac_test_dvlanfilt(priv);
}
static int stmmac_test_dvlanfilt_perfect(struct stmmac_priv *priv)
{
int ret, prev_cap = priv->dma_cap.vlhash;
priv->dma_cap.vlhash = 0;
ret = __stmmac_test_dvlanfilt(priv);
priv->dma_cap.vlhash = prev_cap;
return ret;
}
#ifdef CONFIG_NET_CLS_ACT
static int stmmac_test_rxp(struct stmmac_priv *priv)
{
......@@ -1685,9 +1717,17 @@ static const struct stmmac_test {
.lb = STMMAC_LOOPBACK_PHY,
.fn = stmmac_test_vlanfilt,
}, {
.name = "Double VLAN Filtering",
.name = "VLAN Filtering (perf) ",
.lb = STMMAC_LOOPBACK_PHY,
.fn = stmmac_test_vlanfilt_perfect,
}, {
.name = "Double VLAN Filter ",
.lb = STMMAC_LOOPBACK_PHY,
.fn = stmmac_test_dvlanfilt,
}, {
.name = "Double VLAN Filter (perf) ",
.lb = STMMAC_LOOPBACK_PHY,
.fn = stmmac_test_dvlanfilt_perfect,
}, {
.name = "Flexible RX Parser ",
.lb = STMMAC_LOOPBACK_PHY,
......@@ -1697,7 +1737,7 @@ static const struct stmmac_test {
.lb = STMMAC_LOOPBACK_PHY,
.fn = stmmac_test_desc_sai,
}, {
.name = "SA Replacement (desc)",
.name = "SA Replacement (desc) ",
.lb = STMMAC_LOOPBACK_PHY,
.fn = stmmac_test_desc_sar,
}, {
......@@ -1705,7 +1745,7 @@ static const struct stmmac_test {
.lb = STMMAC_LOOPBACK_PHY,
.fn = stmmac_test_reg_sai,
}, {
.name = "SA Replacement (reg)",
.name = "SA Replacement (reg) ",
.lb = STMMAC_LOOPBACK_PHY,
.fn = stmmac_test_reg_sar,
}, {
......
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