aboutsummaryrefslogtreecommitdiffstats
path: root/lib/librte_eal/linuxapp/kni
diff options
context:
space:
mode:
Diffstat (limited to 'lib/librte_eal/linuxapp/kni')
-rw-r--r--lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c8
-rw-r--r--lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h2
-rw-r--r--lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c8
-rw-r--r--lib/librte_eal/linuxapp/kni/kni_ethtool.c10
-rw-r--r--lib/librte_eal/linuxapp/kni/kni_fifo.h24
5 files changed, 46 insertions, 6 deletions
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c
index aed14bcc..7a520ece 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c
@@ -150,6 +150,7 @@ static const char igb_gstrings_test[][ETH_GSTRING_LEN] = {
#define IGB_TEST_LEN (sizeof(igb_gstrings_test) / ETH_GSTRING_LEN)
#endif /* ETHTOOL_TEST */
+#ifndef ETHTOOL_GLINKSETTINGS
static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
{
struct igb_adapter *adapter = netdev_priv(netdev);
@@ -274,7 +275,9 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
#endif /* ETH_TP_MDI_X */
return 0;
}
+#endif
+#ifndef ETHTOOL_SLINKSETTINGS
static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
{
struct igb_adapter *adapter = netdev_priv(netdev);
@@ -379,6 +382,7 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
clear_bit(__IGB_RESETTING, &adapter->state);
return 0;
}
+#endif
static u32 igb_get_link(struct net_device *netdev)
{
@@ -2752,8 +2756,12 @@ static int igb_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
#endif /* ETHTOOL_GRXRINGS */
static const struct ethtool_ops igb_ethtool_ops = {
+#ifndef ETHTOOL_GLINKSETTINGS
.get_settings = igb_get_settings,
+#endif
+#ifndef ETHTOOL_SLINKSETTINGS
.set_settings = igb_set_settings,
+#endif
.get_drvinfo = igb_get_drvinfo,
.get_regs_len = igb_get_regs_len,
.get_regs = igb_get_regs,
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h
index 59415469..cc3f8ea4 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h
@@ -905,8 +905,10 @@ s32 ixgbe_dcb_hw_ets(struct ixgbe_hw *hw, struct ieee_ets *ets, int max_frame);
#endif /* CONFIG_DCB */
extern void ixgbe_clean_rx_ring(struct ixgbe_ring *rx_ring);
+#ifndef ETHTOOL_GLINKSETTINGS
extern int ixgbe_get_settings(struct net_device *netdev,
struct ethtool_cmd *ecmd);
+#endif
extern int ixgbe_write_uc_addr_list(struct ixgbe_adapter *adapter,
struct net_device *netdev, unsigned int vfn);
extern void ixgbe_full_sync_mac_table(struct ixgbe_adapter *adapter);
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c
index cdfcb959..1296829b 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c
@@ -173,6 +173,7 @@ static const char ixgbe_gstrings_test[][ETH_GSTRING_LEN] = {
#define IXGBE_TEST_LEN (sizeof(ixgbe_gstrings_test) / ETH_GSTRING_LEN)
#endif /* ETHTOOL_TEST */
+#ifndef ETHTOOL_GLINKSETTINGS
int ixgbe_get_settings(struct net_device *netdev,
struct ethtool_cmd *ecmd)
{
@@ -362,7 +363,9 @@ int ixgbe_get_settings(struct net_device *netdev,
return 0;
}
+#endif
+#ifndef ETHTOOL_SLINKSETTINGS
static int ixgbe_set_settings(struct net_device *netdev,
struct ethtool_cmd *ecmd)
{
@@ -406,6 +409,7 @@ static int ixgbe_set_settings(struct net_device *netdev,
}
return err;
}
+#endif
static void ixgbe_get_pauseparam(struct net_device *netdev,
struct ethtool_pauseparam *pause)
@@ -2830,8 +2834,12 @@ static int ixgbe_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
#endif /* ETHTOOL_GRXRINGS */
//static
struct ethtool_ops ixgbe_ethtool_ops = {
+#ifndef ETHTOOL_GLINKSETTINGS
.get_settings = ixgbe_get_settings,
+#endif
+#ifndef ETHTOOL_SLINKSETTINGS
.set_settings = ixgbe_set_settings,
+#endif
.get_drvinfo = ixgbe_get_drvinfo,
.get_regs_len = ixgbe_get_regs_len,
.get_regs = ixgbe_get_regs,
diff --git a/lib/librte_eal/linuxapp/kni/kni_ethtool.c b/lib/librte_eal/linuxapp/kni/kni_ethtool.c
index 0c88589c..8174e98d 100644
--- a/lib/librte_eal/linuxapp/kni/kni_ethtool.c
+++ b/lib/librte_eal/linuxapp/kni/kni_ethtool.c
@@ -46,6 +46,8 @@ kni_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
priv->lad_dev->ethtool_ops->get_drvinfo(priv->lad_dev, info);
}
+/* ETHTOOL_GLINKSETTINGS replaces ETHTOOL_GSET */
+#ifndef ETHTOOL_GLINKSETTINGS
static int
kni_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{
@@ -53,7 +55,10 @@ kni_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
return priv->lad_dev->ethtool_ops->get_settings(priv->lad_dev, ecmd);
}
+#endif
+/* ETHTOOL_SLINKSETTINGS replaces ETHTOOL_SSET */
+#ifndef ETHTOOL_SLINKSETTINGS
static int
kni_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{
@@ -61,6 +66,7 @@ kni_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
return priv->lad_dev->ethtool_ops->set_settings(priv->lad_dev, ecmd);
}
+#endif
static void
kni_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
@@ -209,8 +215,12 @@ kni_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats,
struct ethtool_ops kni_ethtool_ops = {
.begin = kni_check_if_running,
.get_drvinfo = kni_get_drvinfo,
+#ifndef ETHTOOL_GLINKSETTINGS
.get_settings = kni_get_settings,
+#endif
+#ifndef ETHTOOL_SLINKSETTINGS
.set_settings = kni_set_settings,
+#endif
.get_regs_len = kni_get_regs_len,
.get_regs = kni_get_regs,
.get_wol = kni_get_wol,
diff --git a/lib/librte_eal/linuxapp/kni/kni_fifo.h b/lib/librte_eal/linuxapp/kni/kni_fifo.h
index 14f4141f..26208ae4 100644
--- a/lib/librte_eal/linuxapp/kni/kni_fifo.h
+++ b/lib/librte_eal/linuxapp/kni/kni_fifo.h
@@ -27,6 +27,14 @@
#include <exec-env/rte_kni_common.h>
+/* Skip some memory barriers on Linux < 3.14 */
+#ifndef smp_load_acquire
+#define smp_load_acquire(a) (*(a))
+#endif
+#ifndef smp_store_release
+#define smp_store_release(a, b) *(a) = (b)
+#endif
+
/**
* Adds num elements into the fifo. Return the number actually written
*/
@@ -35,7 +43,7 @@ kni_fifo_put(struct rte_kni_fifo *fifo, void **data, uint32_t num)
{
uint32_t i = 0;
uint32_t fifo_write = fifo->write;
- uint32_t fifo_read = fifo->read;
+ uint32_t fifo_read = smp_load_acquire(&fifo->read);
uint32_t new_write = fifo_write;
for (i = 0; i < num; i++) {
@@ -46,7 +54,7 @@ kni_fifo_put(struct rte_kni_fifo *fifo, void **data, uint32_t num)
fifo->buffer[fifo_write] = data[i];
fifo_write = new_write;
}
- fifo->write = fifo_write;
+ smp_store_release(&fifo->write, fifo_write);
return i;
}
@@ -59,7 +67,7 @@ kni_fifo_get(struct rte_kni_fifo *fifo, void **data, uint32_t num)
{
uint32_t i = 0;
uint32_t new_read = fifo->read;
- uint32_t fifo_write = fifo->write;
+ uint32_t fifo_write = smp_load_acquire(&fifo->write);
for (i = 0; i < num; i++) {
if (new_read == fifo_write)
@@ -68,7 +76,7 @@ kni_fifo_get(struct rte_kni_fifo *fifo, void **data, uint32_t num)
data[i] = fifo->buffer[new_read];
new_read = (new_read + 1) & (fifo->len - 1);
}
- fifo->read = new_read;
+ smp_store_release(&fifo->read, new_read);
return i;
}
@@ -79,7 +87,9 @@ kni_fifo_get(struct rte_kni_fifo *fifo, void **data, uint32_t num)
static inline uint32_t
kni_fifo_count(struct rte_kni_fifo *fifo)
{
- return (fifo->len + fifo->write - fifo->read) & (fifo->len - 1);
+ uint32_t fifo_write = smp_load_acquire(&fifo->write);
+ uint32_t fifo_read = smp_load_acquire(&fifo->read);
+ return (fifo->len + fifo_write - fifo_read) & (fifo->len - 1);
}
/**
@@ -88,7 +98,9 @@ kni_fifo_count(struct rte_kni_fifo *fifo)
static inline uint32_t
kni_fifo_free_count(struct rte_kni_fifo *fifo)
{
- return (fifo->read - fifo->write - 1) & (fifo->len - 1);
+ uint32_t fifo_write = smp_load_acquire(&fifo->write);
+ uint32_t fifo_read = smp_load_acquire(&fifo->read);
+ return (fifo_read - fifo_write - 1) & (fifo->len - 1);
}
#endif /* _KNI_FIFO_H_ */