Commit b9c701ed authored by Stefan Sørensen's avatar Stefan Sørensen Committed by David S. Miller

net: Simplify ptp class checks

Replace two switch statements enumerating all valid ptp classes with an if
statement matching for not PTP_CLASS_NONE.
Signed-off-by: default avatarStefan Sørensen <stefan.sorensen@spectralink.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 239960d6
...@@ -43,14 +43,9 @@ void skb_clone_tx_timestamp(struct sk_buff *skb) ...@@ -43,14 +43,9 @@ void skb_clone_tx_timestamp(struct sk_buff *skb)
return; return;
type = classify(skb); type = classify(skb);
if (type == PTP_CLASS_NONE)
return;
switch (type) {
case PTP_CLASS_V1_IPV4:
case PTP_CLASS_V1_IPV6:
case PTP_CLASS_V2_IPV4:
case PTP_CLASS_V2_IPV6:
case PTP_CLASS_V2_L2:
case PTP_CLASS_V2_VLAN:
phydev = skb->dev->phydev; phydev = skb->dev->phydev;
if (likely(phydev->drv->txtstamp)) { if (likely(phydev->drv->txtstamp)) {
if (!atomic_inc_not_zero(&sk->sk_refcnt)) if (!atomic_inc_not_zero(&sk->sk_refcnt))
...@@ -65,10 +60,6 @@ void skb_clone_tx_timestamp(struct sk_buff *skb) ...@@ -65,10 +60,6 @@ void skb_clone_tx_timestamp(struct sk_buff *skb)
clone->sk = sk; clone->sk = sk;
phydev->drv->txtstamp(phydev, clone, type); phydev->drv->txtstamp(phydev, clone, type);
} }
break;
default:
break;
}
} }
EXPORT_SYMBOL_GPL(skb_clone_tx_timestamp); EXPORT_SYMBOL_GPL(skb_clone_tx_timestamp);
...@@ -114,20 +105,12 @@ bool skb_defer_rx_timestamp(struct sk_buff *skb) ...@@ -114,20 +105,12 @@ bool skb_defer_rx_timestamp(struct sk_buff *skb)
__skb_pull(skb, ETH_HLEN); __skb_pull(skb, ETH_HLEN);
switch (type) { if (type == PTP_CLASS_NONE)
case PTP_CLASS_V1_IPV4: return false;
case PTP_CLASS_V1_IPV6:
case PTP_CLASS_V2_IPV4:
case PTP_CLASS_V2_IPV6:
case PTP_CLASS_V2_L2:
case PTP_CLASS_V2_VLAN:
phydev = skb->dev->phydev; phydev = skb->dev->phydev;
if (likely(phydev->drv->rxtstamp)) if (likely(phydev->drv->rxtstamp))
return phydev->drv->rxtstamp(phydev, skb, type); return phydev->drv->rxtstamp(phydev, skb, type);
break;
default:
break;
}
return false; return false;
} }
......
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