diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2017-10-21 00:39:43 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-23 05:06:47 +0300 |
commit | 39cdd34989cf9fb62935041727bf885136f720a4 (patch) | |
tree | b51de3fa2ce9be8d2b66f8186301599e9a5034a5 /drivers/net/dsa/bcm_sf2_cfp.c | |
parent | 33ad61d0f799656e8987e9c80e6e15151bb857f3 (diff) | |
download | linux-39cdd34989cf9fb62935041727bf885136f720a4.tar.xz |
net: dsa: bcm_sf2: Use existing shift/masks
Instead of open coding the shift for the IP protocol, IP fragment bit
etc. define and/or use existing constants to that end.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/bcm_sf2_cfp.c')
-rw-r--r-- | drivers/net/dsa/bcm_sf2_cfp.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c index 94649e1481ec..cef4b3d4df36 100644 --- a/drivers/net/dsa/bcm_sf2_cfp.c +++ b/drivers/net/dsa/bcm_sf2_cfp.c @@ -189,7 +189,8 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port, * Reserved [1] * UDF_Valid[8] [0] */ - core_writel(priv, v4_spec->tos << 16 | ip_proto << 8 | ip_frag << 7, + core_writel(priv, v4_spec->tos << IPTOS_SHIFT | + ip_proto << IPPROTO_SHIFT | ip_frag << IP_FRAG_SHIFT, CORE_CFP_DATA_PORT(6)); /* UDF_Valid[7:0] [31:24] @@ -425,8 +426,8 @@ static int bcm_sf2_cfp_rule_get(struct bcm_sf2_priv *priv, int port, return -EINVAL; } - v4_spec->tos = (reg >> 16) & IPPROTO_MASK; - nfc->fs.m_ext.data[0] = cpu_to_be32((reg >> 7) & 1); + v4_spec->tos = (reg >> IPTOS_SHIFT) & IPTOS_MASK; + nfc->fs.m_ext.data[0] = cpu_to_be32((reg >> IP_FRAG_SHIFT) & 1); reg = core_readl(priv, CORE_CFP_DATA_PORT(3)); /* src port [15:8] */ |