diff options
author | Ioana Radulescu <ruxandra.radulescu@nxp.com> | 2018-03-23 08:44:09 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-03-23 16:01:56 +0100 |
commit | 311cffa5e2c86532c0e3b7ba11a860424c4647d7 (patch) | |
tree | 18fe5e1eeaa35ea2b81d6f873b91019476721982 /drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | |
parent | 2a6c7f34fd18ef535459c39676a31044dd1a9091 (diff) |
staging: fsl-dpaa2/eth: Add DPNI version check
The DPAA2 Ethernet driver assumes the DPNI objects that it
uses to build network interfaces have a minimum supported
API version, but until now it did nothing to enforce this
requirement.
Add a check at probe time to make sure the DPNI object is
compatible with the set of MC commands we intend to use
on it.
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h')
-rw-r--r-- | drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h index c4816e607ec3..5ac014f5833a 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h @@ -311,6 +311,8 @@ struct dpaa2_eth_priv { struct dpaa2_eth_channel *channel[DPAA2_ETH_MAX_DPCONS]; struct dpni_attr dpni_attrs; + u16 dpni_ver_major; + u16 dpni_ver_minor; u16 tx_data_offset; struct fsl_mc_device *dpbp_dev; @@ -354,6 +356,14 @@ struct dpaa2_eth_priv { extern const struct ethtool_ops dpaa2_ethtool_ops; extern const char dpaa2_eth_drv_version[]; +static inline int dpaa2_eth_cmp_dpni_ver(struct dpaa2_eth_priv *priv, + u16 ver_major, u16 ver_minor) +{ + if (priv->dpni_ver_major == ver_major) + return priv->dpni_ver_minor - ver_minor; + return priv->dpni_ver_major - ver_major; +} + /* Hardware only sees DPAA2_ETH_RX_BUF_SIZE, but the skb built around * the buffer also needs space for its shared info struct, and we need * to allocate enough to accommodate hardware alignment restrictions |