* [dpdk-dev] [PATCH 1/4] kni: fix build with kernel 3.8
2013-07-29 12:44 [dpdk-dev] [PATCH 0/4] build fixes for recent distros Thomas Monjalon
@ 2013-07-29 12:44 ` Thomas Monjalon
2013-09-12 15:30 ` Nicolas Dichtel
2013-07-29 12:44 ` [dpdk-dev] [PATCH 2/4] kni: fix build with kernel 3.9 Thomas Monjalon
` (3 subsequent siblings)
4 siblings, 1 reply; 19+ messages in thread
From: Thomas Monjalon @ 2013-07-29 12:44 UTC (permalink / raw)
To: dev
- timecompare has been removed.
(see Linux commit 65f8f9a1c1db831e5159e3e3e50912d1f214cd0c)
- annotations __devinit and __devexit have been removed.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h | 17 -
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 460 --------------------
lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 20 +
3 files changed, 20 insertions(+), 477 deletions(-)
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h
index 3cebff5..ea120af 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h
@@ -44,12 +44,6 @@
#include <linux/ethtool.h>
#endif
-#ifdef HAVE_HW_TIME_STAMP
-#include <linux/clocksource.h>
-#include <linux/timecompare.h>
-#include <linux/net_tstamp.h>
-
-#endif
struct igb_adapter;
#if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE)
@@ -59,11 +53,6 @@ struct igb_adapter;
#include <linux/dca.h>
#endif
-#ifndef HAVE_HW_TIME_STAMP
-#undef IGB_PER_PKT_TIMESTAMP
-#endif
-
-
#include "kcompat.h"
#ifdef HAVE_SCTP
@@ -505,12 +494,6 @@ struct igb_adapter {
#ifndef IGB_NO_LRO
struct igb_lro_stats lro_stats;
#endif
-#ifdef HAVE_HW_TIME_STAMP
- struct cyclecounter cycles;
- struct timecounter clock;
- struct timecompare compare;
- struct hwtstamp_config hwtstamp_config;
-#endif
/* structs defined in e1000_hw.h */
struct e1000_hw hw;
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
index 9d772fa..4462464 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
@@ -111,9 +111,6 @@ static void igb_setup_mrqc(struct igb_adapter *);
void igb_update_stats(struct igb_adapter *);
static int igb_probe(struct pci_dev *, const struct pci_device_id *);
static void __devexit igb_remove(struct pci_dev *pdev);
-#ifdef HAVE_HW_TIME_STAMP
-static void igb_init_hw_timer(struct igb_adapter *adapter);
-#endif
static int igb_sw_init(struct igb_adapter *);
static int igb_open(struct net_device *);
static int igb_close(struct net_device *);
@@ -301,34 +298,6 @@ static void igb_vfta_set(struct igb_adapter *adapter, u32 vid, bool add)
adapter->shadow_vfta[index] = vfta;
}
-#ifdef HAVE_HW_TIME_STAMP
-/**
- * igb_read_clock - read raw cycle counter (to be used by time counter)
- */
-static cycle_t igb_read_clock(const struct cyclecounter *tc)
-{
- struct igb_adapter *adapter =
- container_of(tc, struct igb_adapter, cycles);
- struct e1000_hw *hw = &adapter->hw;
- u64 stamp = 0;
- int shift = 0;
-
- /*
- * The timestamp latches on lowest register read. For the 82580
- * the lowest register is SYSTIMR instead of SYSTIML. However we never
- * adjusted TIMINCA so SYSTIMR will just read as all 0s so ignore it.
- */
- if (hw->mac.type >= e1000_82580) {
- stamp = E1000_READ_REG(hw, E1000_SYSTIMR) >> 8;
- shift = IGB_82580_TSYNC_SHIFT;
- }
-
- stamp |= (u64)E1000_READ_REG(hw, E1000_SYSTIML) << shift;
- stamp |= (u64)E1000_READ_REG(hw, E1000_SYSTIMH) << (shift + 32);
- return stamp;
-}
-
-#endif /* SIOCSHWTSTAMP */
static int debug = NETIF_MSG_DRV | NETIF_MSG_PROBE;
//module_param(debug, int, 0);
//MODULE_PARM_DESC(debug, "Debug level (0=none, ..., 16=all)");
@@ -2341,11 +2310,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
}
#endif
-#ifdef HAVE_HW_TIME_STAMP
- /* do hw tstamp init after resetting */
- igb_init_hw_timer(adapter);
-#endif
dev_info(pci_dev_to_dev(pdev), "Intel(R) Gigabit Ethernet Network Connection\n");
/* print bus type/speed/width info */
dev_info(pci_dev_to_dev(pdev), "%s: (PCIe:%s:%s) ",
@@ -2515,113 +2480,6 @@ static void __devexit igb_remove(struct pci_dev *pdev)
#endif /* IGB_SYSFS */
}
-#ifdef HAVE_HW_TIME_STAMP
-/**
- * igb_init_hw_timer - Initialize hardware timer used with IEEE 1588 timestamp
- * @adapter: board private structure to initialize
- *
- * igb_init_hw_timer initializes the function pointer and values for the hw
- * timer found in hardware.
- **/
-static void igb_init_hw_timer(struct igb_adapter *adapter)
-{
- struct e1000_hw *hw = &adapter->hw;
-
- switch (hw->mac.type) {
- case e1000_i350:
- case e1000_82580:
- memset(&adapter->cycles, 0, sizeof(adapter->cycles));
- adapter->cycles.read = igb_read_clock;
- adapter->cycles.mask = CLOCKSOURCE_MASK(64);
- adapter->cycles.mult = 1;
- /*
- * The 82580 timesync updates the system timer every 8ns by 8ns
- * and the value cannot be shifted. Instead we need to shift
- * the registers to generate a 64bit timer value. As a result
- * SYSTIMR/L/H, TXSTMPL/H, RXSTMPL/H all have to be shifted by
- * 24 in order to generate a larger value for synchronization.
- */
- adapter->cycles.shift = IGB_82580_TSYNC_SHIFT;
- /* disable system timer temporarily by setting bit 31 */
- E1000_WRITE_REG(hw, E1000_TSAUXC, 0x80000000);
- E1000_WRITE_FLUSH(hw);
-
- /* Set registers so that rollover occurs soon to test this. */
- E1000_WRITE_REG(hw, E1000_SYSTIMR, 0x00000000);
- E1000_WRITE_REG(hw, E1000_SYSTIML, 0x80000000);
- E1000_WRITE_REG(hw, E1000_SYSTIMH, 0x000000FF);
- E1000_WRITE_FLUSH(hw);
-
- /* enable system timer by clearing bit 31 */
- E1000_WRITE_REG(hw, E1000_TSAUXC, 0x0);
- E1000_WRITE_FLUSH(hw);
-
- timecounter_init(&adapter->clock,
- &adapter->cycles,
- ktime_to_ns(ktime_get_real()));
- /*
- * Synchronize our NIC clock against system wall clock. NIC
- * time stamp reading requires ~3us per sample, each sample
- * was pretty stable even under load => only require 10
- * samples for each offset comparison.
- */
- memset(&adapter->compare, 0, sizeof(adapter->compare));
- adapter->compare.source = &adapter->clock;
- adapter->compare.target = ktime_get_real;
- adapter->compare.num_samples = 10;
- timecompare_update(&adapter->compare, 0);
- break;
- case e1000_82576:
- /*
- * Initialize hardware timer: we keep it running just in case
- * that some program needs it later on.
- */
- memset(&adapter->cycles, 0, sizeof(adapter->cycles));
- adapter->cycles.read = igb_read_clock;
- adapter->cycles.mask = CLOCKSOURCE_MASK(64);
- adapter->cycles.mult = 1;
- /**
- * Scale the NIC clock cycle by a large factor so that
- * relatively small clock corrections can be added or
- * subtracted at each clock tick. The drawbacks of a large
- * factor are a) that the clock register overflows more quickly
- * (not such a big deal) and b) that the increment per tick has
- * to fit into 24 bits. As a result we need to use a shift of
- * 19 so we can fit a value of 16 into the TIMINCA register.
- */
- adapter->cycles.shift = IGB_82576_TSYNC_SHIFT;
- E1000_WRITE_REG(hw, E1000_TIMINCA,
- (1 << E1000_TIMINCA_16NS_SHIFT) |
- (16 << IGB_82576_TSYNC_SHIFT));
-
- /* Set registers so that rollover occurs soon to test this. */
- E1000_WRITE_REG(hw, E1000_SYSTIML, 0x00000000);
- E1000_WRITE_REG(hw, E1000_SYSTIMH, 0xFF800000);
- E1000_WRITE_FLUSH(hw);
-
- timecounter_init(&adapter->clock,
- &adapter->cycles,
- ktime_to_ns(ktime_get_real()));
- /*
- * Synchronize our NIC clock against system wall clock. NIC
- * time stamp reading requires ~3us per sample, each sample
- * was pretty stable even under load => only require 10
- * samples for each offset comparison.
- */
- memset(&adapter->compare, 0, sizeof(adapter->compare));
- adapter->compare.source = &adapter->clock;
- adapter->compare.target = ktime_get_real;
- adapter->compare.num_samples = 10;
- timecompare_update(&adapter->compare, 0);
- break;
- case e1000_82575:
- /* 82575 does not support timesync */
- default:
- break;
- }
-}
-
-#endif /* HAVE_HW_TIME_STAMP */
/**
* igb_sw_init - Initialize general software structures (struct igb_adapter)
* @adapter: board private structure to initialize
@@ -4860,20 +4718,6 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
first->bytecount = skb->len;
first->gso_segs = 1;
-#ifdef HAVE_HW_TIME_STAMP
-#ifdef SKB_SHARED_TX_IS_UNION
- if (unlikely(skb_shinfo(skb)->tx_flags.flags & SKBTX_HW_TSTAMP)) {
- skb_shinfo(skb)->tx_flags.flags |= SKBTX_IN_PROGRESS;
- tx_flags |= IGB_TX_FLAGS_TSTAMP;
- }
-#else
- if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
- skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
- tx_flags |= IGB_TX_FLAGS_TSTAMP;
- }
-#endif
-
-#endif
if (vlan_tx_tag_present(skb)) {
tx_flags |= IGB_TX_FLAGS_VLAN;
tx_flags |= (vlan_tx_tag_get(skb) << IGB_TX_FLAGS_VLAN_SHIFT);
@@ -6301,74 +6145,6 @@ static int igb_poll(struct napi_struct *napi, int budget)
return 0;
}
-#ifdef HAVE_HW_TIME_STAMP
-/**
- * igb_systim_to_hwtstamp - convert system time value to hw timestamp
- * @adapter: board private structure
- * @shhwtstamps: timestamp structure to update
- * @regval: unsigned 64bit system time value.
- *
- * We need to convert the system time value stored in the RX/TXSTMP registers
- * into a hwtstamp which can be used by the upper level timestamping functions
- */
-static void igb_systim_to_hwtstamp(struct igb_adapter *adapter,
- struct skb_shared_hwtstamps *shhwtstamps,
- u64 regval)
-{
- u64 ns;
-
- /*
- * The 82580 starts with 1ns at bit 0 in RX/TXSTMPL, shift this up to
- * 24 to match clock shift we setup earlier.
- */
- if (adapter->hw.mac.type >= e1000_82580)
- regval <<= IGB_82580_TSYNC_SHIFT;
-
- ns = timecounter_cyc2time(&adapter->clock, regval);
-
- /*
- * force a timecompare_update here (even if less than a second
- * has passed) in order to prevent the case when ptpd or other
- * software jumps the clock offset. othwerise there is a small
- * window when the timestamp would be based on previous skew
- * and invalid results would be pushed to the network stack.
- */
- timecompare_update(&adapter->compare, 0);
- memset(shhwtstamps, 0, sizeof(struct skb_shared_hwtstamps));
- shhwtstamps->hwtstamp = ns_to_ktime(ns);
- shhwtstamps->syststamp = timecompare_transform(&adapter->compare, ns);
-}
-
-/**
- * igb_tx_hwtstamp - utility function which checks for TX time stamp
- * @q_vector: pointer to q_vector containing needed info
- * @buffer: pointer to igb_tx_buffer structure
- *
- * If we were asked to do hardware stamping and such a time stamp is
- * available, then it must have been for this skb here because we only
- * allow only one such packet into the queue.
- */
-static void igb_tx_hwtstamp(struct igb_q_vector *q_vector,
- struct igb_tx_buffer *buffer_info)
-{
- struct igb_adapter *adapter = q_vector->adapter;
- struct e1000_hw *hw = &adapter->hw;
- struct skb_shared_hwtstamps shhwtstamps;
- u64 regval;
-
- /* if skb does not support hw timestamp or TX stamp not valid exit */
- if (likely(!(buffer_info->tx_flags & IGB_TX_FLAGS_TSTAMP)) ||
- !(E1000_READ_REG(hw, E1000_TSYNCTXCTL) & E1000_TSYNCTXCTL_VALID))
- return;
-
- regval = E1000_READ_REG(hw, E1000_TXSTMPL);
- regval |= (u64)E1000_READ_REG(hw, E1000_TXSTMPH) << 32;
-
- igb_systim_to_hwtstamp(adapter, &shhwtstamps, regval);
- skb_tstamp_tx(buffer_info->skb, &shhwtstamps);
-}
-
-#endif
/**
* igb_clean_tx_irq - Reclaim resources after transmit completes
* @q_vector: pointer to q_vector containing needed info
@@ -6412,11 +6188,6 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector)
total_bytes += tx_buffer->bytecount;
total_packets += tx_buffer->gso_segs;
-#ifdef HAVE_HW_TIME_STAMP
- /* retrieve hardware timestamp */
- igb_tx_hwtstamp(q_vector, tx_buffer);
-
-#endif
/* free the skb */
dev_kfree_skb_any(tx_buffer->skb);
@@ -6620,48 +6391,8 @@ static inline void igb_rx_hash(struct igb_ring *ring,
if (netdev_ring(ring)->features & NETIF_F_RXHASH)
skb->rxhash = le32_to_cpu(rx_desc->wb.lower.hi_dword.rss);
}
-
#endif
-#ifdef HAVE_HW_TIME_STAMP
-static void igb_rx_hwtstamp(struct igb_q_vector *q_vector,
- union e1000_adv_rx_desc *rx_desc,
- struct sk_buff *skb)
-{
- struct igb_adapter *adapter = q_vector->adapter;
- struct e1000_hw *hw = &adapter->hw;
- u64 regval;
-
- if (!igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP |
- E1000_RXDADV_STAT_TS))
- return;
-
- /*
- * If this bit is set, then the RX registers contain the time stamp. No
- * other packet will be time stamped until we read these registers, so
- * read the registers to make them available again. Because only one
- * packet can be time stamped at a time, we know that the register
- * values must belong to this one here and therefore we don't need to
- * compare any of the additional attributes stored for it.
- *
- * If nothing went wrong, then it should have a skb_shared_tx that we
- * can turn into a skb_shared_hwtstamps.
- */
- if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
- u32 *stamp = (u32 *)skb->data;
- regval = le32_to_cpu(*(stamp + 2));
- regval |= (u64)le32_to_cpu(*(stamp + 3)) << 32;
- skb_pull(skb, IGB_TS_HDR_LEN);
- } else {
- if(!(E1000_READ_REG(hw, E1000_TSYNCRXCTL) & E1000_TSYNCRXCTL_VALID))
- return;
-
- regval = E1000_READ_REG(hw, E1000_RXSTMPL);
- regval |= (u64)E1000_READ_REG(hw, E1000_RXSTMPH) << 32;
- }
- igb_systim_to_hwtstamp(adapter, skb_hwtstamps(skb), regval);
-}
-#endif
static void igb_rx_vlan(struct igb_ring *ring,
union e1000_adv_rx_desc *rx_desc,
struct sk_buff *skb)
@@ -7237,9 +6968,6 @@ static bool igb_clean_rx_irq(struct igb_q_vector *q_vector, int budget)
goto next_desc;
}
-#ifdef HAVE_HW_TIME_STAMP
- igb_rx_hwtstamp(q_vector, rx_desc, skb);
-#endif
#ifdef NETIF_F_RXHASH
igb_rx_hash(rx_ring, rx_desc, skb);
#endif
@@ -7469,187 +7197,8 @@ static int igb_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
}
return E1000_SUCCESS;
}
-
#endif
-#ifdef HAVE_HW_TIME_STAMP
-/**
- * igb_hwtstamp_ioctl - control hardware time stamping
- * @netdev:
- * @ifreq:
- * @cmd:
- *
- * Outgoing time stamping can be enabled and disabled. Play nice and
- * disable it when requested, although it shouldn't case any overhead
- * when no packet needs it. At most one packet in the queue may be
- * marked for time stamping, otherwise it would be impossible to tell
- * for sure to which packet the hardware time stamp belongs.
- *
- * Incoming time stamping has to be configured via the hardware
- * filters. Not all combinations are supported, in particular event
- * type has to be specified. Matching the kind of event packet is
- * not supported, with the exception of "all V2 events regardless of
- * level 2 or 4".
- *
- **/
-static int igb_hwtstamp_ioctl(struct net_device *netdev,
- struct ifreq *ifr, int cmd)
-{
- struct igb_adapter *adapter = netdev_priv(netdev);
- struct e1000_hw *hw = &adapter->hw;
- struct hwtstamp_config config;
- u32 tsync_tx_ctl = E1000_TSYNCTXCTL_ENABLED;
- u32 tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED;
- u32 tsync_rx_cfg = 0;
- bool is_l4 = false;
- bool is_l2 = false;
- u32 regval;
-
- if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
- return -EFAULT;
-
- /* reserved for future extensions */
- if (config.flags)
- return -EINVAL;
- switch (config.tx_type) {
- case HWTSTAMP_TX_OFF:
- tsync_tx_ctl = 0;
- case HWTSTAMP_TX_ON:
- break;
- default:
- return -ERANGE;
- }
-
- switch (config.rx_filter) {
- case HWTSTAMP_FILTER_NONE:
- tsync_rx_ctl = 0;
- break;
- case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
- case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
- case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
- case HWTSTAMP_FILTER_ALL:
- /*
- * register TSYNCRXCFG must be set, therefore it is not
- * possible to time stamp both Sync and Delay_Req messages
- * => fall back to time stamping all packets
- */
- tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL;
- config.rx_filter = HWTSTAMP_FILTER_ALL;
- break;
- case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
- tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_L4_V1;
- tsync_rx_cfg = E1000_TSYNCRXCFG_PTP_V1_SYNC_MESSAGE;
- is_l4 = true;
- break;
- case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
- tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_L4_V1;
- tsync_rx_cfg = E1000_TSYNCRXCFG_PTP_V1_DELAY_REQ_MESSAGE;
- is_l4 = true;
- break;
- case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
- case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
- tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_L2_L4_V2;
- tsync_rx_cfg = E1000_TSYNCRXCFG_PTP_V2_SYNC_MESSAGE;
- is_l2 = true;
- is_l4 = true;
- config.rx_filter = HWTSTAMP_FILTER_SOME;
- break;
- case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
- case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
- tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_L2_L4_V2;
- tsync_rx_cfg = E1000_TSYNCRXCFG_PTP_V2_DELAY_REQ_MESSAGE;
- is_l2 = true;
- is_l4 = true;
- config.rx_filter = HWTSTAMP_FILTER_SOME;
- break;
- case HWTSTAMP_FILTER_PTP_V2_EVENT:
- case HWTSTAMP_FILTER_PTP_V2_SYNC:
- case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
- tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_EVENT_V2;
- config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
- is_l2 = true;
- is_l4 = true;
- break;
- default:
- return -ERANGE;
- }
-
- if (hw->mac.type == e1000_82575) {
- if (tsync_rx_ctl | tsync_tx_ctl)
- return -EINVAL;
- return 0;
- }
-
-#ifdef IGB_PER_PKT_TIMESTAMP
- /*
- * Per-packet timestamping only works if all packets are
- * timestamped, so enable timestamping in all packets as
- * long as one rx filter was configured.
- */
- if ((hw->mac.type >= e1000_82580) && tsync_rx_ctl) {
- tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED;
- tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL;
- }
-#endif
-
- /* enable/disable TX */
- regval = E1000_READ_REG(hw, E1000_TSYNCTXCTL);
- regval &= ~E1000_TSYNCTXCTL_ENABLED;
- regval |= tsync_tx_ctl;
- E1000_WRITE_REG(hw, E1000_TSYNCTXCTL, regval);
-
- /* enable/disable RX */
- regval = E1000_READ_REG(hw, E1000_TSYNCRXCTL);
- regval &= ~(E1000_TSYNCRXCTL_ENABLED | E1000_TSYNCRXCTL_TYPE_MASK);
- regval |= tsync_rx_ctl;
- E1000_WRITE_REG(hw, E1000_TSYNCRXCTL, regval);
-
- /* define which PTP packets are time stamped */
- E1000_WRITE_REG(hw, E1000_TSYNCRXCFG, tsync_rx_cfg);
-
- /* define ethertype filter for timestamped packets */
- if (is_l2)
- E1000_WRITE_REG(hw, E1000_ETQF(3),
- (E1000_ETQF_FILTER_ENABLE | /* enable filter */
- E1000_ETQF_1588 | /* enable timestamping */
- ETH_P_1588)); /* 1588 eth protocol type */
- else
- E1000_WRITE_REG(hw, E1000_ETQF(3), 0);
-
-#define PTP_PORT 319
- /* L4 Queue Filter[3]: filter by destination port and protocol */
- if (is_l4) {
- u32 ftqf = (IPPROTO_UDP /* UDP */
- | E1000_FTQF_VF_BP /* VF not compared */
- | E1000_FTQF_1588_TIME_STAMP /* Enable Timestamping */
- | E1000_FTQF_MASK); /* mask all inputs */
- ftqf &= ~E1000_FTQF_MASK_PROTO_BP; /* enable protocol check */
-
- E1000_WRITE_REG(hw, E1000_IMIR(3), htons(PTP_PORT));
- E1000_WRITE_REG(hw, E1000_IMIREXT(3),
- (E1000_IMIREXT_SIZE_BP | E1000_IMIREXT_CTRL_BP));
- if (hw->mac.type == e1000_82576) {
- /* enable source port check */
- E1000_WRITE_REG(hw, E1000_SPQF(3), htons(PTP_PORT));
- ftqf &= ~E1000_FTQF_MASK_SOURCE_PORT_BP;
- }
- E1000_WRITE_REG(hw, E1000_FTQF(3), ftqf);
- } else {
- E1000_WRITE_REG(hw, E1000_FTQF(3), E1000_FTQF_MASK);
- }
- E1000_WRITE_FLUSH(hw);
-
- adapter->hwtstamp_config = config;
-
- /* clear TX/RX time stamp registers, just to be sure */
- regval = E1000_READ_REG(hw, E1000_TXSTMPH);
- regval = E1000_READ_REG(hw, E1000_RXSTMPH);
-
- return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
- -EFAULT : 0;
-}
-
-#endif
/**
* igb_ioctl -
* @netdev:
@@ -7665,10 +7214,6 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
case SIOCSMIIREG:
return igb_mii_ioctl(netdev, ifr, cmd);
#endif
-#ifdef HAVE_HW_TIME_STAMP
- case SIOCSHWTSTAMP:
- return igb_hwtstamp_ioctl(netdev, ifr, cmd);
-#endif
#ifdef ETHTOOL_OPS_COMPAT
case SIOCETHTOOL:
return ethtool_ioctl(ifr);
@@ -9036,11 +8581,6 @@ int igb_kni_probe(struct pci_dev *pdev,
}
#endif
-#ifdef HAVE_HW_TIME_STAMP
- /* do hw tstamp init after resetting */
- igb_init_hw_timer(adapter);
-
-#endif
#endif /* NO_KNI */
dev_info(pci_dev_to_dev(pdev), "Intel(R) Gigabit Ethernet Network Connection\n");
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
index a2aa361..8af7e22 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
@@ -3040,4 +3040,24 @@ typedef netdev_features_t kni_netdev_features_t;
#else
#define HAVE_FDB_OPS
#endif /* < 3.5.0 */
+
+/*****************************************************************************/
+/* 3.8 */
+
+#ifndef __devinit
+#define __devinit
+#endif
+
+#ifndef __devinitdata
+#define __devinitdata
+#endif
+
+#ifndef __devexit
+#define __devexit
+#endif
+
+#ifndef __devexit_p
+#define __devexit_p
+#endif
+
#endif /* _KCOMPAT_H_ */
--
1.7.10.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* [dpdk-dev] [PATCH 2/4] kni: fix build with kernel 3.9
2013-07-29 12:44 [dpdk-dev] [PATCH 0/4] build fixes for recent distros Thomas Monjalon
2013-07-29 12:44 ` [dpdk-dev] [PATCH 1/4] kni: fix build with kernel 3.8 Thomas Monjalon
@ 2013-07-29 12:44 ` Thomas Monjalon
2013-09-12 15:34 ` Nicolas Dichtel
2013-07-29 12:44 ` [dpdk-dev] [PATCH 3/4] kni: fix build with kernel 3.10 Thomas Monjalon
` (2 subsequent siblings)
4 siblings, 1 reply; 19+ messages in thread
From: Thomas Monjalon @ 2013-07-29 12:44 UTC (permalink / raw)
To: dev
hlist API has changes.
See Linux commit b67bfe0d42cac56c512dd5da4b1b347a23f4b70a.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
.../linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c | 12 +++---
.../linuxapp/kni/ethtool/ixgbe/kcompat.h | 39 +++++++++++++-------
2 files changed, 32 insertions(+), 19 deletions(-)
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 11472bd..fcff294 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c
@@ -2294,13 +2294,13 @@ static int ixgbe_get_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
union ixgbe_atr_input *mask = &adapter->fdir_mask;
struct ethtool_rx_flow_spec *fsp =
(struct ethtool_rx_flow_spec *)&cmd->fs;
- struct hlist_node *node, *node2;
+ struct hlist_node *node;
struct ixgbe_fdir_filter *rule = NULL;
/* report total rule count */
cmd->data = (1024 << adapter->fdir_pballoc) - 2;
- hlist_for_each_entry_safe(rule, node, node2,
+ hlist_for_each_entry_safe(rule, node,
&adapter->fdir_filter_list, fdir_node) {
if (fsp->location <= rule->sw_idx)
break;
@@ -2361,14 +2361,14 @@ static int ixgbe_get_ethtool_fdir_all(struct ixgbe_adapter *adapter,
struct ethtool_rxnfc *cmd,
u32 *rule_locs)
{
- struct hlist_node *node, *node2;
+ struct hlist_node *node;
struct ixgbe_fdir_filter *rule;
int cnt = 0;
/* report total rule count */
cmd->data = (1024 << adapter->fdir_pballoc) - 2;
- hlist_for_each_entry_safe(rule, node, node2,
+ hlist_for_each_entry_safe(rule, node,
&adapter->fdir_filter_list, fdir_node) {
if (cnt == cmd->rule_cnt)
return -EMSGSIZE;
@@ -2464,14 +2464,14 @@ static int ixgbe_update_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
u16 sw_idx)
{
struct ixgbe_hw *hw = &adapter->hw;
- struct hlist_node *node, *node2, *parent;
+ struct hlist_node *node, *parent;
struct ixgbe_fdir_filter *rule;
int err = -EINVAL;
parent = NULL;
rule = NULL;
- hlist_for_each_entry_safe(rule, node, node2,
+ hlist_for_each_entry_safe(rule, node,
&adapter->fdir_filter_list, fdir_node) {
/* hash found, or no matching entry */
if (rule->sw_idx >= sw_idx)
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
index 6ac890a..925beeb 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
@@ -1213,19 +1213,6 @@ static inline void INIT_HLIST_NODE(struct hlist_node *h)
h->next = NULL;
h->pprev = NULL;
}
-#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
-
-#define hlist_for_each_entry(tpos, pos, head, member) \
- for (pos = (head)->first; \
- pos && ({ prefetch(pos->next); 1;}) && \
- ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
- pos = pos->next)
-
-#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \
- for (pos = (head)->first; \
- pos && ({ n = pos->next; 1; }) && \
- ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
- pos = n)
#ifndef might_sleep
#define might_sleep()
@@ -3106,4 +3093,30 @@ typedef netdev_features_t kni_netdev_features_t;
#else
#define HAVE_FDB_OPS
#endif /* < 3.5.0 */
+
+/*****************************************************************************/
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) )
+
+#undef hlist_entry
+#define hlist_entry(ptr, type, member) \
+ container_of(ptr,type,member)
+
+#undef hlist_entry_safe
+#define hlist_entry_safe(ptr, type, member) \
+ (ptr) ? hlist_entry(ptr, type, member) : NULL
+
+#undef hlist_for_each_entry
+#define hlist_for_each_entry(pos, head, member) \
+ for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member); \
+ pos; \
+ pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
+
+#undef hlist_for_each_entry_safe
+#define hlist_for_each_entry_safe(pos, n, head, member) \
+ for (pos = hlist_entry_safe((head)->first, typeof(*pos), member); \
+ pos && ({ n = pos->member.next; 1; }); \
+ pos = hlist_entry_safe(n, typeof(*pos), member))
+
+#endif /* < 3.9.0 */
+
#endif /* _KCOMPAT_H_ */
--
1.7.10.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* [dpdk-dev] [PATCH 3/4] kni: fix build with kernel 3.10
2013-07-29 12:44 [dpdk-dev] [PATCH 0/4] build fixes for recent distros Thomas Monjalon
2013-07-29 12:44 ` [dpdk-dev] [PATCH 1/4] kni: fix build with kernel 3.8 Thomas Monjalon
2013-07-29 12:44 ` [dpdk-dev] [PATCH 2/4] kni: fix build with kernel 3.9 Thomas Monjalon
@ 2013-07-29 12:44 ` Thomas Monjalon
2013-09-12 16:09 ` Nicolas Dichtel
2013-07-29 12:44 ` [dpdk-dev] [PATCH 4/4] app: fix build with gcc 4.8 Thomas Monjalon
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 0/4] build fixes for recent distros Thomas Monjalon
4 siblings, 1 reply; 19+ messages in thread
From: Thomas Monjalon @ 2013-07-29 12:44 UTC (permalink / raw)
To: dev
- The flags NETIF_F_HW_VLAN_* have been renamed to NETIF_F_HW_VLAN_CTAG_*.
See Linux commit f646968f8f7c624587de729115d802372b9063dd.
- The VLAN protocol must be specified.
See Linux commits 86a9bad3ab6b6f858fd4443b48738cabbb6d094c
and 80d5c3689b886308247da295a228a54df49a44f6.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 47 +++++++++++++-------
lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 26 ++++++++++-
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h | 6 +--
.../linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c | 2 +-
.../linuxapp/kni/ethtool/ixgbe/ixgbe_main.c | 16 +++----
.../linuxapp/kni/ethtool/ixgbe/kcompat.h | 12 ++++-
6 files changed, 79 insertions(+), 30 deletions(-)
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
index 4462464..d687412 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
@@ -148,7 +148,10 @@ static void igb_reset_task(struct work_struct *);
#ifdef HAVE_VLAN_RX_REGISTER
static void igb_vlan_mode(struct net_device *, struct vlan_group *);
#endif
-#ifdef HAVE_INT_NDO_VLAN_RX_ADD_VID
+#ifdef HAVE_VLAN_PROTO
+static int igb_vlan_rx_add_vid(struct net_device *, __be16, u16);
+static int igb_vlan_rx_kill_vid(struct net_device *, __be16, u16);
+#elif defined HAVE_INT_NDO_VLAN_RX_ADD_VID
static int igb_vlan_rx_add_vid(struct net_device *, u16);
static int igb_vlan_rx_kill_vid(struct net_device *, u16);
#else
@@ -1807,8 +1810,8 @@ static kni_netdev_features_t igb_fix_features(struct net_device *netdev,
* Since there is no support for separate tx vlan accel
* enabled make sure tx flag is cleared if rx is.
*/
- if (!(features & NETIF_F_HW_VLAN_RX))
- features &= ~NETIF_F_HW_VLAN_TX;
+ if (!(features & NETIF_F_HW_VLAN_CTAG_RX))
+ features &= ~NETIF_F_HW_VLAN_CTAG_TX;
/* If Rx checksum is disabled, then LRO should also be disabled */
if (!(features & NETIF_F_RXCSUM))
@@ -1822,7 +1825,7 @@ static int igb_set_features(struct net_device *netdev,
{
u32 changed = netdev->features ^ features;
- if (changed & NETIF_F_HW_VLAN_RX)
+ if (changed & NETIF_F_HW_VLAN_CTAG_RX)
igb_vlan_mode(netdev, features);
return 0;
@@ -1898,7 +1901,7 @@ void igb_assign_vmdq_netdev_ops(struct net_device *vnetdev)
#ifdef HAVE_TX_TIMEOUT
dev->tx_timeout = &igb_vmdq_tx_timeout;
#endif
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
dev->vlan_rx_register = &igb_vmdq_vlan_rx_register;
dev->vlan_rx_add_vid = &igb_vmdq_vlan_rx_add_vid;
dev->vlan_rx_kill_vid = &igb_vmdq_vlan_rx_kill_vid;
@@ -2138,8 +2141,8 @@ static int __devinit igb_probe(struct pci_dev *pdev,
#ifdef HAVE_NDO_SET_FEATURES
NETIF_F_RXCSUM |
#endif
- NETIF_F_HW_VLAN_RX |
- NETIF_F_HW_VLAN_TX;
+ NETIF_F_HW_VLAN_CTAG_RX |
+ NETIF_F_HW_VLAN_CTAG_TX;
#ifdef HAVE_NDO_SET_FEATURES
/* copy netdev features into list of user selectable features */
@@ -2158,7 +2161,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
#endif
/* set this bit last since it cannot be part of hw_features */
- netdev->features |= NETIF_F_HW_VLAN_FILTER;
+ netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
#ifdef HAVE_NETDEV_VLAN_FEATURES
netdev->vlan_features |= NETIF_F_TSO |
@@ -6409,7 +6412,7 @@ static void igb_rx_vlan(struct igb_ring *ring,
} else {
IGB_CB(skb)->vid = 0;
#else
- __vlan_hwaccel_put_tag(skb, vid);
+ __kc__vlan_hwaccel_put_tag(skb, vid);
#endif
}
}
@@ -7271,7 +7274,7 @@ void igb_vlan_mode(struct net_device *netdev, u32 features)
if (!test_bit(__IGB_DOWN, &adapter->state))
igb_irq_enable(adapter);
#else
- bool enable = !!(features & NETIF_F_HW_VLAN_RX);
+ bool enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX);
#endif
if (enable) {
@@ -7311,7 +7314,7 @@ void igb_vlan_mode(struct net_device *netdev, u32 features)
#else
struct net_device *vnetdev;
vnetdev = adapter->vmdq_netdev[i-1];
- enable = !!(vnetdev->features & NETIF_F_HW_VLAN_RX);
+ enable = !!(vnetdev->features & NETIF_F_HW_VLAN_CTAG_RX);
#endif
igb_set_vf_vlan_strip(adapter,
adapter->vfs_allocated_count + i,
@@ -7322,7 +7325,9 @@ void igb_vlan_mode(struct net_device *netdev, u32 features)
igb_rlpml_set(adapter);
}
-#ifdef HAVE_INT_NDO_VLAN_RX_ADD_VID
+#ifdef HAVE_VLAN_PROTO
+static int igb_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
+#elif defined HAVE_INT_NDO_VLAN_RX_ADD_VID
static int igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
#else
static void igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
@@ -7361,7 +7366,9 @@ static void igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
#endif
}
-#ifdef HAVE_INT_NDO_VLAN_RX_ADD_VID
+#ifdef HAVE_VLAN_PROTO
+static int igb_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid)
+#elif defined HAVE_INT_NDO_VLAN_RX_ADD_VID
static int igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
#else
static void igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
@@ -7405,7 +7412,11 @@ static void igb_restore_vlan(struct igb_adapter *adapter)
for (vid = 0; vid < VLAN_N_VID; vid++) {
if (!vlan_group_get_device(adapter->vlgrp, vid))
continue;
+#ifdef HAVE_VLAN_PROTO
+ igb_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
+#else
igb_vlan_rx_add_vid(adapter->netdev, vid);
+#endif
}
}
#else
@@ -7414,8 +7425,12 @@ static void igb_restore_vlan(struct igb_adapter *adapter)
igb_vlan_mode(adapter->netdev, adapter->netdev->features);
for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
+#ifdef HAVE_VLAN_PROTO
+ igb_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
+#else
igb_vlan_rx_add_vid(adapter->netdev, vid);
#endif
+#endif
}
int igb_set_spd_dplx(struct igb_adapter *adapter, u16 spddplx)
@@ -8404,8 +8419,8 @@ int igb_kni_probe(struct pci_dev *pdev,
#ifdef HAVE_NDO_SET_FEATURES
NETIF_F_RXCSUM |
#endif
- NETIF_F_HW_VLAN_RX |
- NETIF_F_HW_VLAN_TX;
+ NETIF_F_HW_VLAN_CTAG_RX |
+ NETIF_F_HW_VLAN_CTAG_TX;
#ifdef HAVE_NDO_SET_FEATURES
/* copy netdev features into list of user selectable features */
@@ -8424,7 +8439,7 @@ int igb_kni_probe(struct pci_dev *pdev,
#endif
/* set this bit last since it cannot be part of hw_features */
- netdev->features |= NETIF_F_HW_VLAN_FILTER;
+ netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
#ifdef HAVE_NETDEV_VLAN_FEATURES
netdev->vlan_features |= NETIF_F_TSO |
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
index 8af7e22..5b33e90 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
@@ -287,7 +287,17 @@ struct msix_entry {
#define IS_ALIGNED(x,a) (((x) % ((typeof(x))(a))) == 0)
#endif
-#ifndef NETIF_F_HW_VLAN_TX
+#if !defined NETIF_F_HW_VLAN_CTAG_TX && defined NETIF_F_HW_VLAN_TX
+#define NETIF_F_HW_VLAN_CTAG_TX NETIF_F_HW_VLAN_TX
+#endif
+#if !defined NETIF_F_HW_VLAN_CTAG_RX && defined NETIF_F_HW_VLAN_RX
+#define NETIF_F_HW_VLAN_CTAG_RX NETIF_F_HW_VLAN_RX
+#endif
+#if !defined NETIF_F_HW_VLAN_CTAG_FILTER && defined NETIF_F_HW_VLAN_FILTER
+#define NETIF_F_HW_VLAN_CTAG_FILTER NETIF_F_HW_VLAN_FILTER
+#endif
+
+#ifndef NETIF_F_HW_VLAN_CTAG_TX
struct _kc_vlan_ethhdr {
unsigned char h_dest[ETH_ALEN];
unsigned char h_source[ETH_ALEN];
@@ -3060,4 +3070,18 @@ typedef netdev_features_t kni_netdev_features_t;
#define __devexit_p
#endif
+/*****************************************************************************/
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) )
+
+#define __kc__vlan_hwaccel_put_tag(skb, vlan_tci) \
+ __vlan_hwaccel_put_tag(skb, vlan_tci)
+
+#else
+
+#define HAVE_VLAN_PROTO
+#define __kc__vlan_hwaccel_put_tag(skb, vlan_tci) \
+ __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci)
+
+#endif /* < 3.10.0 */
+
#endif /* _KCOMPAT_H_ */
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h
index 222c2c7..eb15858 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h
@@ -42,7 +42,7 @@
#ifdef SIOCETHTOOL
#include <linux/ethtool.h>
#endif
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
#include <linux/if_vlan.h>
#endif
#if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE)
@@ -549,13 +549,13 @@ struct ixgbe_therm_proc_data {
/* board specific private data structure */
struct ixgbe_adapter {
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
#ifdef HAVE_VLAN_RX_REGISTER
struct vlan_group *vlgrp; /* must be first, see ixgbe_receive_skb */
#else
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
#endif
-#endif /* NETIF_F_HW_VLAN_TX */
+#endif /* NETIF_F_HW_VLAN_CTAG_TX */
/* OS defined structs */
struct net_device *netdev;
struct pci_dev *pdev;
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 fcff294..4bda1fb 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c
@@ -2162,7 +2162,7 @@ static int ixgbe_set_tso(struct net_device *netdev, u32 data)
#endif
} else {
#ifndef HAVE_NETDEV_VLAN_FEATURES
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
struct ixgbe_adapter *adapter = netdev_priv(netdev);
/* disable TSO on all VLANs if they're present */
if (adapter->vlgrp) {
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
index 947be44..1f7c9f2 100755
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
@@ -331,7 +331,7 @@ void ixgbe_vlan_mode(struct net_device *netdev, u32 features)
#ifdef HAVE_VLAN_RX_REGISTER
enable = (grp || (adapter->flags & IXGBE_FLAG_DCB_ENABLED));
#else
- enable = !!(features & NETIF_F_HW_VLAN_RX);
+ enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX);
#endif
if (enable)
/* enable VLAN tag insert/strip */
@@ -629,7 +629,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
vmolr |= IXGBE_VMOLR_ROMPE;
}
}
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
/* enable hardware vlan filtering */
vlnctrl |= IXGBE_VLNCTRL_VFE;
#endif
@@ -812,7 +812,7 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter)
ixgbe_configure_dcb(adapter);
ixgbe_set_rx_mode(adapter->netdev);
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
ixgbe_restore_vlan(adapter);
#endif
@@ -2514,9 +2514,9 @@ int ixgbe_kni_probe(struct pci_dev *pdev,
netdev->features |= NETIF_F_IPV6_CSUM;
#endif
-#ifdef NETIF_F_HW_VLAN_TX
- netdev->features |= NETIF_F_HW_VLAN_TX |
- NETIF_F_HW_VLAN_RX;
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
+ netdev->features |= NETIF_F_HW_VLAN_CTAG_TX |
+ NETIF_F_HW_VLAN_CTAG_RX;
#endif
#ifdef NETIF_F_TSO
netdev->features |= NETIF_F_TSO;
@@ -2548,9 +2548,9 @@ int ixgbe_kni_probe(struct pci_dev *pdev,
#endif /* NETIF_F_GRO */
#endif
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
/* set this bit last since it cannot be part of hw_features */
- netdev->features |= NETIF_F_HW_VLAN_FILTER;
+ netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
#endif
switch (adapter->hw.mac.type) {
case ixgbe_mac_82599EB:
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
index 925beeb..740579e 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
@@ -304,7 +304,17 @@ struct msix_entry {
#define IS_ALIGNED(x,a) (((x) % ((typeof(x))(a))) == 0)
#endif
-#ifndef NETIF_F_HW_VLAN_TX
+#if !defined NETIF_F_HW_VLAN_CTAG_TX && defined NETIF_F_HW_VLAN_TX
+#define NETIF_F_HW_VLAN_CTAG_TX NETIF_F_HW_VLAN_TX
+#endif
+#if !defined NETIF_F_HW_VLAN_CTAG_RX && defined NETIF_F_HW_VLAN_RX
+#define NETIF_F_HW_VLAN_CTAG_RX NETIF_F_HW_VLAN_RX
+#endif
+#if !defined NETIF_F_HW_VLAN_CTAG_FILTER && defined NETIF_F_HW_VLAN_FILTER
+#define NETIF_F_HW_VLAN_CTAG_FILTER NETIF_F_HW_VLAN_FILTER
+#endif
+
+#ifndef NETIF_F_HW_VLAN_CTAG_TX
struct _kc_vlan_ethhdr {
unsigned char h_dest[ETH_ALEN];
unsigned char h_source[ETH_ALEN];
--
1.7.10.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH 3/4] kni: fix build with kernel 3.10
2013-07-29 12:44 ` [dpdk-dev] [PATCH 3/4] kni: fix build with kernel 3.10 Thomas Monjalon
@ 2013-09-12 16:09 ` Nicolas Dichtel
2013-09-16 13:09 ` Thomas Monjalon
0 siblings, 1 reply; 19+ messages in thread
From: Nicolas Dichtel @ 2013-09-12 16:09 UTC (permalink / raw)
To: dev
Le 29/07/2013 14:44, Thomas Monjalon a écrit :
> - The flags NETIF_F_HW_VLAN_* have been renamed to NETIF_F_HW_VLAN_CTAG_*.
> See Linux commit f646968f8f7c624587de729115d802372b9063dd.
>
> - The VLAN protocol must be specified.
> See Linux commits 86a9bad3ab6b6f858fd4443b48738cabbb6d094c
> and 80d5c3689b886308247da295a228a54df49a44f6.
>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH 3/4] kni: fix build with kernel 3.10
2013-09-12 16:09 ` Nicolas Dichtel
@ 2013-09-16 13:09 ` Thomas Monjalon
0 siblings, 0 replies; 19+ messages in thread
From: Thomas Monjalon @ 2013-09-16 13:09 UTC (permalink / raw)
To: nicolas.dichtel; +Cc: dev
12/09/2013 18:09, Nicolas Dichtel :
> Le 29/07/2013 14:44, Thomas Monjalon a écrit :
> > - The flags NETIF_F_HW_VLAN_* have been renamed to
> > NETIF_F_HW_VLAN_CTAG_*. See Linux commit
> > f646968f8f7c624587de729115d802372b9063dd.
> >
> > - The VLAN protocol must be specified.
> > See Linux commits 86a9bad3ab6b6f858fd4443b48738cabbb6d094c
> > and 80d5c3689b886308247da295a228a54df49a44f6.
> >
> > Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
>
> Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
pushed
--
Thomas
^ permalink raw reply [flat|nested] 19+ messages in thread
* [dpdk-dev] [PATCH 4/4] app: fix build with gcc 4.8
2013-07-29 12:44 [dpdk-dev] [PATCH 0/4] build fixes for recent distros Thomas Monjalon
` (2 preceding siblings ...)
2013-07-29 12:44 ` [dpdk-dev] [PATCH 3/4] kni: fix build with kernel 3.10 Thomas Monjalon
@ 2013-07-29 12:44 ` Thomas Monjalon
2013-09-12 15:59 ` Nicolas Dichtel
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 0/4] build fixes for recent distros Thomas Monjalon
4 siblings, 1 reply; 19+ messages in thread
From: Thomas Monjalon @ 2013-07-29 12:44 UTC (permalink / raw)
To: dev
GCC 4.8 was producing this error:
argument to ‘sizeof’ in ‘strncmp’ call is the same expression as the
second source; did you mean to provide an explicit length?
[-Werror=sizeof-pointer-memaccess]
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
app/test/test_cmdline_string.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/test/test_cmdline_string.c b/app/test/test_cmdline_string.c
index 7b358cf..84a82ce 100644
--- a/app/test/test_cmdline_string.c
+++ b/app/test/test_cmdline_string.c
@@ -383,7 +383,7 @@ test_parse_string_valid(void)
return -1;
}
if (strncmp(buf, string_elt_strs[i].result,
- sizeof(string_elt_strs[i].result)) != 0) {
+ sizeof(buf)) != 0) {
printf("Error: result mismatch!\n");
return -1;
}
--
1.7.10.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH 4/4] app: fix build with gcc 4.8
2013-07-29 12:44 ` [dpdk-dev] [PATCH 4/4] app: fix build with gcc 4.8 Thomas Monjalon
@ 2013-09-12 15:59 ` Nicolas Dichtel
0 siblings, 0 replies; 19+ messages in thread
From: Nicolas Dichtel @ 2013-09-12 15:59 UTC (permalink / raw)
To: dev
Le 29/07/2013 14:44, Thomas Monjalon a écrit :
> GCC 4.8 was producing this error:
> argument to ‘sizeof’ in ‘strncmp’ call is the same expression as the
> second source; did you mean to provide an explicit length?
> [-Werror=sizeof-pointer-memaccess]
>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> ---
> app/test/test_cmdline_string.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/app/test/test_cmdline_string.c b/app/test/test_cmdline_string.c
> index 7b358cf..84a82ce 100644
> --- a/app/test/test_cmdline_string.c
> +++ b/app/test/test_cmdline_string.c
> @@ -383,7 +383,7 @@ test_parse_string_valid(void)
> return -1;
> }
> if (strncmp(buf, string_elt_strs[i].result,
> - sizeof(string_elt_strs[i].result)) != 0) {
> + sizeof(buf)) != 0) {
In fact, it seems you can use strcmp() instead of strncmp(). Or, if the
intention was really to check the length, use strlen(), but this one will not
include the last '\0'.
^ permalink raw reply [flat|nested] 19+ messages in thread
* [dpdk-dev] [PATCH v2 0/4] build fixes for recent distros
2013-07-29 12:44 [dpdk-dev] [PATCH 0/4] build fixes for recent distros Thomas Monjalon
` (3 preceding siblings ...)
2013-07-29 12:44 ` [dpdk-dev] [PATCH 4/4] app: fix build with gcc 4.8 Thomas Monjalon
@ 2013-09-13 14:14 ` Thomas Monjalon
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 1/4] kni: fix build with kernel 3.8 Thomas Monjalon
` (3 more replies)
4 siblings, 4 replies; 19+ messages in thread
From: Thomas Monjalon @ 2013-09-13 14:14 UTC (permalink / raw)
To: dev
KNI is an out-of-tree kernel driver, so it needs some updates
to follow recent API changes in Linux.
There is also a patch to build with latest GCC.
v2 changes:
* for kernel 3.8
- undef HAVE_HW_TIME_STAMP instead of removing code
* for gcc 4.8
- use strncmp instead of strncmp
---
Thomas Monjalon (4):
kni: fix build with kernel 3.8
kni: fix build with kernel 3.9
kni: fix build with kernel 3.10
app: fix build with gcc 4.8
app/test/test_cmdline_string.c | 3 +-
lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h | 5 +-
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 47 ++++++++++++------
lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 49 ++++++++++++++++++-
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h | 6 +--
.../linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c | 14 +++---
.../linuxapp/kni/ethtool/ixgbe/ixgbe_main.c | 16 +++---
.../linuxapp/kni/ethtool/ixgbe/kcompat.h | 51 ++++++++++++++------
8 files changed, 137 insertions(+), 54 deletions(-)
^ permalink raw reply [flat|nested] 19+ messages in thread
* [dpdk-dev] [PATCH v2 1/4] kni: fix build with kernel 3.8
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 0/4] build fixes for recent distros Thomas Monjalon
@ 2013-09-13 14:14 ` Thomas Monjalon
2013-09-16 11:21 ` Nicolas Dichtel
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 2/4] kni: fix build with kernel 3.9 Thomas Monjalon
` (2 subsequent siblings)
3 siblings, 1 reply; 19+ messages in thread
From: Thomas Monjalon @ 2013-09-13 14:14 UTC (permalink / raw)
To: dev
- timecompare (used for hardware timestamping) has been removed.
(see Linux commit 65f8f9a1c1db831e5159e3e3e50912d1f214cd0c)
Simply disable HW_TIME_STAMP feature because it is not used by KNI.
For this purpose, kcompat.h must be included before testing for
HAVE_HW_TIME_STAMP.
- annotations __devinit and __devexit have been removed.
(see Linux commit 54b956b903607f8f8878754dd4352da6a54a1da2)
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Tested-by: David Nyström <david.c.nystrom@gmail.com>
---
lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h | 5 ++---
lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 23 +++++++++++++++++++++
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h
index 3cebff5..5567a6c 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h
@@ -30,6 +30,8 @@
#ifndef _IGB_H_
#define _IGB_H_
+#include "kcompat.h"
+
#include <linux/kobject.h>
#ifndef IGB_NO_LRO
@@ -63,9 +65,6 @@ struct igb_adapter;
#undef IGB_PER_PKT_TIMESTAMP
#endif
-
-#include "kcompat.h"
-
#ifdef HAVE_SCTP
#include <linux/sctp.h>
#endif
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
index a2aa361..f6e82c1 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
@@ -3040,4 +3040,27 @@ typedef netdev_features_t kni_netdev_features_t;
#else
#define HAVE_FDB_OPS
#endif /* < 3.5.0 */
+
+/*****************************************************************************/
+/* 3.8 */
+
+/* timecompare has been removed and HW_TIME_STAMP is not used by KNI ethtool */
+#undef HAVE_HW_TIME_STAMP
+
+#ifndef __devinit
+#define __devinit
+#endif
+
+#ifndef __devinitdata
+#define __devinitdata
+#endif
+
+#ifndef __devexit
+#define __devexit
+#endif
+
+#ifndef __devexit_p
+#define __devexit_p
+#endif
+
#endif /* _KCOMPAT_H_ */
--
1.7.10.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/4] kni: fix build with kernel 3.8
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 1/4] kni: fix build with kernel 3.8 Thomas Monjalon
@ 2013-09-16 11:21 ` Nicolas Dichtel
0 siblings, 0 replies; 19+ messages in thread
From: Nicolas Dichtel @ 2013-09-16 11:21 UTC (permalink / raw)
To: dev
Le 13/09/2013 16:14, Thomas Monjalon a écrit :
> - timecompare (used for hardware timestamping) has been removed.
> (see Linux commit 65f8f9a1c1db831e5159e3e3e50912d1f214cd0c)
> Simply disable HW_TIME_STAMP feature because it is not used by KNI.
> For this purpose, kcompat.h must be included before testing for
> HAVE_HW_TIME_STAMP.
>
> - annotations __devinit and __devexit have been removed.
> (see Linux commit 54b956b903607f8f8878754dd4352da6a54a1da2)
>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> Tested-by: David Nyström <david.c.nystrom@gmail.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [dpdk-dev] [PATCH v2 2/4] kni: fix build with kernel 3.9
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 0/4] build fixes for recent distros Thomas Monjalon
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 1/4] kni: fix build with kernel 3.8 Thomas Monjalon
@ 2013-09-13 14:14 ` Thomas Monjalon
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 3/4] kni: fix build with kernel 3.10 Thomas Monjalon
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 4/4] app: fix build with gcc 4.8 Thomas Monjalon
3 siblings, 0 replies; 19+ messages in thread
From: Thomas Monjalon @ 2013-09-13 14:14 UTC (permalink / raw)
To: dev
hlist API has changes.
See Linux commit b67bfe0d42cac56c512dd5da4b1b347a23f4b70a.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Tested-by: David Nyström <david.c.nystrom@gmail.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
.../linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c | 12 +++---
.../linuxapp/kni/ethtool/ixgbe/kcompat.h | 39 +++++++++++++-------
2 files changed, 32 insertions(+), 19 deletions(-)
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 11472bd..fcff294 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c
@@ -2294,13 +2294,13 @@ static int ixgbe_get_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
union ixgbe_atr_input *mask = &adapter->fdir_mask;
struct ethtool_rx_flow_spec *fsp =
(struct ethtool_rx_flow_spec *)&cmd->fs;
- struct hlist_node *node, *node2;
+ struct hlist_node *node;
struct ixgbe_fdir_filter *rule = NULL;
/* report total rule count */
cmd->data = (1024 << adapter->fdir_pballoc) - 2;
- hlist_for_each_entry_safe(rule, node, node2,
+ hlist_for_each_entry_safe(rule, node,
&adapter->fdir_filter_list, fdir_node) {
if (fsp->location <= rule->sw_idx)
break;
@@ -2361,14 +2361,14 @@ static int ixgbe_get_ethtool_fdir_all(struct ixgbe_adapter *adapter,
struct ethtool_rxnfc *cmd,
u32 *rule_locs)
{
- struct hlist_node *node, *node2;
+ struct hlist_node *node;
struct ixgbe_fdir_filter *rule;
int cnt = 0;
/* report total rule count */
cmd->data = (1024 << adapter->fdir_pballoc) - 2;
- hlist_for_each_entry_safe(rule, node, node2,
+ hlist_for_each_entry_safe(rule, node,
&adapter->fdir_filter_list, fdir_node) {
if (cnt == cmd->rule_cnt)
return -EMSGSIZE;
@@ -2464,14 +2464,14 @@ static int ixgbe_update_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
u16 sw_idx)
{
struct ixgbe_hw *hw = &adapter->hw;
- struct hlist_node *node, *node2, *parent;
+ struct hlist_node *node, *parent;
struct ixgbe_fdir_filter *rule;
int err = -EINVAL;
parent = NULL;
rule = NULL;
- hlist_for_each_entry_safe(rule, node, node2,
+ hlist_for_each_entry_safe(rule, node,
&adapter->fdir_filter_list, fdir_node) {
/* hash found, or no matching entry */
if (rule->sw_idx >= sw_idx)
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
index 6ac890a..925beeb 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
@@ -1213,19 +1213,6 @@ static inline void INIT_HLIST_NODE(struct hlist_node *h)
h->next = NULL;
h->pprev = NULL;
}
-#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
-
-#define hlist_for_each_entry(tpos, pos, head, member) \
- for (pos = (head)->first; \
- pos && ({ prefetch(pos->next); 1;}) && \
- ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
- pos = pos->next)
-
-#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \
- for (pos = (head)->first; \
- pos && ({ n = pos->next; 1; }) && \
- ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
- pos = n)
#ifndef might_sleep
#define might_sleep()
@@ -3106,4 +3093,30 @@ typedef netdev_features_t kni_netdev_features_t;
#else
#define HAVE_FDB_OPS
#endif /* < 3.5.0 */
+
+/*****************************************************************************/
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) )
+
+#undef hlist_entry
+#define hlist_entry(ptr, type, member) \
+ container_of(ptr,type,member)
+
+#undef hlist_entry_safe
+#define hlist_entry_safe(ptr, type, member) \
+ (ptr) ? hlist_entry(ptr, type, member) : NULL
+
+#undef hlist_for_each_entry
+#define hlist_for_each_entry(pos, head, member) \
+ for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member); \
+ pos; \
+ pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
+
+#undef hlist_for_each_entry_safe
+#define hlist_for_each_entry_safe(pos, n, head, member) \
+ for (pos = hlist_entry_safe((head)->first, typeof(*pos), member); \
+ pos && ({ n = pos->member.next; 1; }); \
+ pos = hlist_entry_safe(n, typeof(*pos), member))
+
+#endif /* < 3.9.0 */
+
#endif /* _KCOMPAT_H_ */
--
1.7.10.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* [dpdk-dev] [PATCH v2 3/4] kni: fix build with kernel 3.10
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 0/4] build fixes for recent distros Thomas Monjalon
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 1/4] kni: fix build with kernel 3.8 Thomas Monjalon
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 2/4] kni: fix build with kernel 3.9 Thomas Monjalon
@ 2013-09-13 14:14 ` Thomas Monjalon
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 4/4] app: fix build with gcc 4.8 Thomas Monjalon
3 siblings, 0 replies; 19+ messages in thread
From: Thomas Monjalon @ 2013-09-13 14:14 UTC (permalink / raw)
To: dev
- The flags NETIF_F_HW_VLAN_* have been renamed to NETIF_F_HW_VLAN_CTAG_*.
See Linux commit f646968f8f7c624587de729115d802372b9063dd.
- The VLAN protocol must be specified.
See Linux commits 86a9bad3ab6b6f858fd4443b48738cabbb6d094c
and 80d5c3689b886308247da295a228a54df49a44f6.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Tested-by: David Nyström <david.c.nystrom@gmail.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 47 +++++++++++++-------
lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 26 ++++++++++-
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h | 6 +--
.../linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c | 2 +-
.../linuxapp/kni/ethtool/ixgbe/ixgbe_main.c | 16 +++----
.../linuxapp/kni/ethtool/ixgbe/kcompat.h | 12 ++++-
6 files changed, 79 insertions(+), 30 deletions(-)
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
index 9d772fa..cf1af86 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
@@ -151,7 +151,10 @@ static void igb_reset_task(struct work_struct *);
#ifdef HAVE_VLAN_RX_REGISTER
static void igb_vlan_mode(struct net_device *, struct vlan_group *);
#endif
-#ifdef HAVE_INT_NDO_VLAN_RX_ADD_VID
+#ifdef HAVE_VLAN_PROTO
+static int igb_vlan_rx_add_vid(struct net_device *, __be16, u16);
+static int igb_vlan_rx_kill_vid(struct net_device *, __be16, u16);
+#elif defined HAVE_INT_NDO_VLAN_RX_ADD_VID
static int igb_vlan_rx_add_vid(struct net_device *, u16);
static int igb_vlan_rx_kill_vid(struct net_device *, u16);
#else
@@ -1838,8 +1841,8 @@ static kni_netdev_features_t igb_fix_features(struct net_device *netdev,
* Since there is no support for separate tx vlan accel
* enabled make sure tx flag is cleared if rx is.
*/
- if (!(features & NETIF_F_HW_VLAN_RX))
- features &= ~NETIF_F_HW_VLAN_TX;
+ if (!(features & NETIF_F_HW_VLAN_CTAG_RX))
+ features &= ~NETIF_F_HW_VLAN_CTAG_TX;
/* If Rx checksum is disabled, then LRO should also be disabled */
if (!(features & NETIF_F_RXCSUM))
@@ -1853,7 +1856,7 @@ static int igb_set_features(struct net_device *netdev,
{
u32 changed = netdev->features ^ features;
- if (changed & NETIF_F_HW_VLAN_RX)
+ if (changed & NETIF_F_HW_VLAN_CTAG_RX)
igb_vlan_mode(netdev, features);
return 0;
@@ -1929,7 +1932,7 @@ void igb_assign_vmdq_netdev_ops(struct net_device *vnetdev)
#ifdef HAVE_TX_TIMEOUT
dev->tx_timeout = &igb_vmdq_tx_timeout;
#endif
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
dev->vlan_rx_register = &igb_vmdq_vlan_rx_register;
dev->vlan_rx_add_vid = &igb_vmdq_vlan_rx_add_vid;
dev->vlan_rx_kill_vid = &igb_vmdq_vlan_rx_kill_vid;
@@ -2169,8 +2172,8 @@ static int __devinit igb_probe(struct pci_dev *pdev,
#ifdef HAVE_NDO_SET_FEATURES
NETIF_F_RXCSUM |
#endif
- NETIF_F_HW_VLAN_RX |
- NETIF_F_HW_VLAN_TX;
+ NETIF_F_HW_VLAN_CTAG_RX |
+ NETIF_F_HW_VLAN_CTAG_TX;
#ifdef HAVE_NDO_SET_FEATURES
/* copy netdev features into list of user selectable features */
@@ -2189,7 +2192,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
#endif
/* set this bit last since it cannot be part of hw_features */
- netdev->features |= NETIF_F_HW_VLAN_FILTER;
+ netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
#ifdef HAVE_NETDEV_VLAN_FEATURES
netdev->vlan_features |= NETIF_F_TSO |
@@ -6678,7 +6681,7 @@ static void igb_rx_vlan(struct igb_ring *ring,
} else {
IGB_CB(skb)->vid = 0;
#else
- __vlan_hwaccel_put_tag(skb, vid);
+ __kc__vlan_hwaccel_put_tag(skb, vid);
#endif
}
}
@@ -7726,7 +7729,7 @@ void igb_vlan_mode(struct net_device *netdev, u32 features)
if (!test_bit(__IGB_DOWN, &adapter->state))
igb_irq_enable(adapter);
#else
- bool enable = !!(features & NETIF_F_HW_VLAN_RX);
+ bool enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX);
#endif
if (enable) {
@@ -7766,7 +7769,7 @@ void igb_vlan_mode(struct net_device *netdev, u32 features)
#else
struct net_device *vnetdev;
vnetdev = adapter->vmdq_netdev[i-1];
- enable = !!(vnetdev->features & NETIF_F_HW_VLAN_RX);
+ enable = !!(vnetdev->features & NETIF_F_HW_VLAN_CTAG_RX);
#endif
igb_set_vf_vlan_strip(adapter,
adapter->vfs_allocated_count + i,
@@ -7777,7 +7780,9 @@ void igb_vlan_mode(struct net_device *netdev, u32 features)
igb_rlpml_set(adapter);
}
-#ifdef HAVE_INT_NDO_VLAN_RX_ADD_VID
+#ifdef HAVE_VLAN_PROTO
+static int igb_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
+#elif defined HAVE_INT_NDO_VLAN_RX_ADD_VID
static int igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
#else
static void igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
@@ -7816,7 +7821,9 @@ static void igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
#endif
}
-#ifdef HAVE_INT_NDO_VLAN_RX_ADD_VID
+#ifdef HAVE_VLAN_PROTO
+static int igb_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid)
+#elif defined HAVE_INT_NDO_VLAN_RX_ADD_VID
static int igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
#else
static void igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
@@ -7860,7 +7867,11 @@ static void igb_restore_vlan(struct igb_adapter *adapter)
for (vid = 0; vid < VLAN_N_VID; vid++) {
if (!vlan_group_get_device(adapter->vlgrp, vid))
continue;
+#ifdef HAVE_VLAN_PROTO
+ igb_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
+#else
igb_vlan_rx_add_vid(adapter->netdev, vid);
+#endif
}
}
#else
@@ -7869,8 +7880,12 @@ static void igb_restore_vlan(struct igb_adapter *adapter)
igb_vlan_mode(adapter->netdev, adapter->netdev->features);
for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
+#ifdef HAVE_VLAN_PROTO
+ igb_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
+#else
igb_vlan_rx_add_vid(adapter->netdev, vid);
#endif
+#endif
}
int igb_set_spd_dplx(struct igb_adapter *adapter, u16 spddplx)
@@ -8859,8 +8874,8 @@ int igb_kni_probe(struct pci_dev *pdev,
#ifdef HAVE_NDO_SET_FEATURES
NETIF_F_RXCSUM |
#endif
- NETIF_F_HW_VLAN_RX |
- NETIF_F_HW_VLAN_TX;
+ NETIF_F_HW_VLAN_CTAG_RX |
+ NETIF_F_HW_VLAN_CTAG_TX;
#ifdef HAVE_NDO_SET_FEATURES
/* copy netdev features into list of user selectable features */
@@ -8879,7 +8894,7 @@ int igb_kni_probe(struct pci_dev *pdev,
#endif
/* set this bit last since it cannot be part of hw_features */
- netdev->features |= NETIF_F_HW_VLAN_FILTER;
+ netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
#ifdef HAVE_NETDEV_VLAN_FEATURES
netdev->vlan_features |= NETIF_F_TSO |
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
index f6e82c1..0e6157e 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
@@ -287,7 +287,17 @@ struct msix_entry {
#define IS_ALIGNED(x,a) (((x) % ((typeof(x))(a))) == 0)
#endif
-#ifndef NETIF_F_HW_VLAN_TX
+#if !defined NETIF_F_HW_VLAN_CTAG_TX && defined NETIF_F_HW_VLAN_TX
+#define NETIF_F_HW_VLAN_CTAG_TX NETIF_F_HW_VLAN_TX
+#endif
+#if !defined NETIF_F_HW_VLAN_CTAG_RX && defined NETIF_F_HW_VLAN_RX
+#define NETIF_F_HW_VLAN_CTAG_RX NETIF_F_HW_VLAN_RX
+#endif
+#if !defined NETIF_F_HW_VLAN_CTAG_FILTER && defined NETIF_F_HW_VLAN_FILTER
+#define NETIF_F_HW_VLAN_CTAG_FILTER NETIF_F_HW_VLAN_FILTER
+#endif
+
+#ifndef NETIF_F_HW_VLAN_CTAG_TX
struct _kc_vlan_ethhdr {
unsigned char h_dest[ETH_ALEN];
unsigned char h_source[ETH_ALEN];
@@ -3063,4 +3073,18 @@ typedef netdev_features_t kni_netdev_features_t;
#define __devexit_p
#endif
+/*****************************************************************************/
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) )
+
+#define __kc__vlan_hwaccel_put_tag(skb, vlan_tci) \
+ __vlan_hwaccel_put_tag(skb, vlan_tci)
+
+#else
+
+#define HAVE_VLAN_PROTO
+#define __kc__vlan_hwaccel_put_tag(skb, vlan_tci) \
+ __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci)
+
+#endif /* < 3.10.0 */
+
#endif /* _KCOMPAT_H_ */
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h
index 222c2c7..eb15858 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h
@@ -42,7 +42,7 @@
#ifdef SIOCETHTOOL
#include <linux/ethtool.h>
#endif
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
#include <linux/if_vlan.h>
#endif
#if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE)
@@ -549,13 +549,13 @@ struct ixgbe_therm_proc_data {
/* board specific private data structure */
struct ixgbe_adapter {
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
#ifdef HAVE_VLAN_RX_REGISTER
struct vlan_group *vlgrp; /* must be first, see ixgbe_receive_skb */
#else
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
#endif
-#endif /* NETIF_F_HW_VLAN_TX */
+#endif /* NETIF_F_HW_VLAN_CTAG_TX */
/* OS defined structs */
struct net_device *netdev;
struct pci_dev *pdev;
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 fcff294..4bda1fb 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c
@@ -2162,7 +2162,7 @@ static int ixgbe_set_tso(struct net_device *netdev, u32 data)
#endif
} else {
#ifndef HAVE_NETDEV_VLAN_FEATURES
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
struct ixgbe_adapter *adapter = netdev_priv(netdev);
/* disable TSO on all VLANs if they're present */
if (adapter->vlgrp) {
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
index 947be44..1f7c9f2 100755
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
@@ -331,7 +331,7 @@ void ixgbe_vlan_mode(struct net_device *netdev, u32 features)
#ifdef HAVE_VLAN_RX_REGISTER
enable = (grp || (adapter->flags & IXGBE_FLAG_DCB_ENABLED));
#else
- enable = !!(features & NETIF_F_HW_VLAN_RX);
+ enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX);
#endif
if (enable)
/* enable VLAN tag insert/strip */
@@ -629,7 +629,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
vmolr |= IXGBE_VMOLR_ROMPE;
}
}
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
/* enable hardware vlan filtering */
vlnctrl |= IXGBE_VLNCTRL_VFE;
#endif
@@ -812,7 +812,7 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter)
ixgbe_configure_dcb(adapter);
ixgbe_set_rx_mode(adapter->netdev);
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
ixgbe_restore_vlan(adapter);
#endif
@@ -2514,9 +2514,9 @@ int ixgbe_kni_probe(struct pci_dev *pdev,
netdev->features |= NETIF_F_IPV6_CSUM;
#endif
-#ifdef NETIF_F_HW_VLAN_TX
- netdev->features |= NETIF_F_HW_VLAN_TX |
- NETIF_F_HW_VLAN_RX;
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
+ netdev->features |= NETIF_F_HW_VLAN_CTAG_TX |
+ NETIF_F_HW_VLAN_CTAG_RX;
#endif
#ifdef NETIF_F_TSO
netdev->features |= NETIF_F_TSO;
@@ -2548,9 +2548,9 @@ int ixgbe_kni_probe(struct pci_dev *pdev,
#endif /* NETIF_F_GRO */
#endif
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
/* set this bit last since it cannot be part of hw_features */
- netdev->features |= NETIF_F_HW_VLAN_FILTER;
+ netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
#endif
switch (adapter->hw.mac.type) {
case ixgbe_mac_82599EB:
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
index 925beeb..740579e 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
@@ -304,7 +304,17 @@ struct msix_entry {
#define IS_ALIGNED(x,a) (((x) % ((typeof(x))(a))) == 0)
#endif
-#ifndef NETIF_F_HW_VLAN_TX
+#if !defined NETIF_F_HW_VLAN_CTAG_TX && defined NETIF_F_HW_VLAN_TX
+#define NETIF_F_HW_VLAN_CTAG_TX NETIF_F_HW_VLAN_TX
+#endif
+#if !defined NETIF_F_HW_VLAN_CTAG_RX && defined NETIF_F_HW_VLAN_RX
+#define NETIF_F_HW_VLAN_CTAG_RX NETIF_F_HW_VLAN_RX
+#endif
+#if !defined NETIF_F_HW_VLAN_CTAG_FILTER && defined NETIF_F_HW_VLAN_FILTER
+#define NETIF_F_HW_VLAN_CTAG_FILTER NETIF_F_HW_VLAN_FILTER
+#endif
+
+#ifndef NETIF_F_HW_VLAN_CTAG_TX
struct _kc_vlan_ethhdr {
unsigned char h_dest[ETH_ALEN];
unsigned char h_source[ETH_ALEN];
--
1.7.10.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* [dpdk-dev] [PATCH v2 4/4] app: fix build with gcc 4.8
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 0/4] build fixes for recent distros Thomas Monjalon
` (2 preceding siblings ...)
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 3/4] kni: fix build with kernel 3.10 Thomas Monjalon
@ 2013-09-13 14:14 ` Thomas Monjalon
2013-09-16 11:22 ` Nicolas Dichtel
3 siblings, 1 reply; 19+ messages in thread
From: Thomas Monjalon @ 2013-09-13 14:14 UTC (permalink / raw)
To: dev
GCC 4.8 was producing this error:
argument to ‘sizeof’ in ‘strncmp’ call is the same expression as the
second source; did you mean to provide an explicit length?
[-Werror=sizeof-pointer-memaccess]
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
app/test/test_cmdline_string.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/app/test/test_cmdline_string.c b/app/test/test_cmdline_string.c
index 7b358cf..4b7e066 100644
--- a/app/test/test_cmdline_string.c
+++ b/app/test/test_cmdline_string.c
@@ -382,8 +382,7 @@ test_parse_string_valid(void)
printf("Error: getting string element failed!\n");
return -1;
}
- if (strncmp(buf, string_elt_strs[i].result,
- sizeof(string_elt_strs[i].result)) != 0) {
+ if (strcmp(buf, string_elt_strs[i].result) != 0) {
printf("Error: result mismatch!\n");
return -1;
}
--
1.7.10.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH v2 4/4] app: fix build with gcc 4.8
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 4/4] app: fix build with gcc 4.8 Thomas Monjalon
@ 2013-09-16 11:22 ` Nicolas Dichtel
2013-09-16 13:10 ` Thomas Monjalon
0 siblings, 1 reply; 19+ messages in thread
From: Nicolas Dichtel @ 2013-09-16 11:22 UTC (permalink / raw)
To: dev
Le 13/09/2013 16:14, Thomas Monjalon a écrit :
> GCC 4.8 was producing this error:
> argument to ‘sizeof’ in ‘strncmp’ call is the same expression as the
> second source; did you mean to provide an explicit length?
> [-Werror=sizeof-pointer-memaccess]
>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH v2 4/4] app: fix build with gcc 4.8
2013-09-16 11:22 ` Nicolas Dichtel
@ 2013-09-16 13:10 ` Thomas Monjalon
0 siblings, 0 replies; 19+ messages in thread
From: Thomas Monjalon @ 2013-09-16 13:10 UTC (permalink / raw)
To: nicolas.dichtel; +Cc: dev
16/09/2013 13:22, Nicolas Dichtel :
> Le 13/09/2013 16:14, Thomas Monjalon a écrit :
> > GCC 4.8 was producing this error:
> > argument to ‘sizeof’ in ‘strncmp’ call is the same expression as the
> > second source; did you mean to provide an explicit length?
> > [-Werror=sizeof-pointer-memaccess]
> >
> > Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
>
> Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
pushed
--
Thomas
^ permalink raw reply [flat|nested] 19+ messages in thread