DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] kni: fix compilation issue on kernel 3.19
@ 2015-05-04 21:46 Pablo de Lara
  2015-05-05 11:28 ` De Lara Guarch, Pablo
       [not found] ` <1430829319-22242-1-git-send-email-pablo.de.lara.guarch@intel.com>
  0 siblings, 2 replies; 11+ messages in thread
From: Pablo de Lara @ 2015-05-04 21:46 UTC (permalink / raw)
  To: dev

Due to commit c0371da6 in kernel 3.19, which removed msg_iov
and msg_iovlen from struct msghdr, DPDK would not build.

This patch makes use of struct iov_iter, which has references
to those two variables.

Reported-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 lib/librte_eal/linuxapp/kni/compat.h    |    4 ++++
 lib/librte_eal/linuxapp/kni/kni_vhost.c |   13 ++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h
index 1313523..1ad22ba 100644
--- a/lib/librte_eal/linuxapp/kni/compat.h
+++ b/lib/librte_eal/linuxapp/kni/compat.h
@@ -19,3 +19,7 @@
 #define sk_sleep(s) (s)->sk_sleep
 
 #endif /* < 2.6.35 */
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
+#define HAVE_IOV_ITER_MSGHDR
+#endif
diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c
index 7141f83..a2fd97f 100644
--- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
+++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
@@ -76,7 +76,7 @@ static struct proto kni_raw_proto = {
 };
 
 static inline int
-kni_vhost_net_tx(struct kni_dev *kni, struct iovec *iov,
+kni_vhost_net_tx(struct kni_dev *kni, const struct iovec *iov,
 		 unsigned offset, unsigned len)
 {
 	struct rte_kni_mbuf *pkt_kva = NULL;
@@ -143,7 +143,7 @@ drop:
 }
 
 static inline int
-kni_vhost_net_rx(struct kni_dev *kni, struct iovec *iov,
+kni_vhost_net_rx(struct kni_dev *kni, const struct iovec *iov,
 		 unsigned offset, unsigned len)
 {
 	uint32_t pkt_len;
@@ -361,8 +361,11 @@ kni_sock_sndmsg(struct kiocb *iocb, struct socket *sock,
 
 	if (unlikely(len < ETH_HLEN + q->vnet_hdr_sz))
 		return -EINVAL;
-
+#ifdef HAVE_IOV_ITER_MSGHDR
+	return kni_vhost_net_tx(q->kni, m->msg_iter.iov, vnet_hdr_len, len);
+#else
 	return kni_vhost_net_tx(q->kni, m->msg_iov, vnet_hdr_len, len);
+#endif
 }
 
 static int
@@ -391,7 +394,11 @@ kni_sock_rcvmsg(struct kiocb *iocb, struct socket *sock,
 #endif
 
 	if (unlikely(0 == (pkt_len = kni_vhost_net_rx(q->kni,
+#ifdef HAVE_IOV_ITER_MSGHDR
+		m->msg_iter.iov, vnet_hdr_len, len))))
+#else
 		m->msg_iov, vnet_hdr_len, len))))
+#endif
 		return 0;
 
 #ifdef RTE_KNI_VHOST_VNET_HDR_EN
-- 
1.7.4.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: fix compilation issue on kernel 3.19
  2015-05-04 21:46 [dpdk-dev] [PATCH] kni: fix compilation issue on kernel 3.19 Pablo de Lara
@ 2015-05-05 11:28 ` De Lara Guarch, Pablo
       [not found] ` <1430829319-22242-1-git-send-email-pablo.de.lara.guarch@intel.com>
  1 sibling, 0 replies; 11+ messages in thread
From: De Lara Guarch, Pablo @ 2015-05-05 11:28 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pablo de Lara
> Sent: Monday, May 04, 2015 10:46 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] kni: fix compilation issue on kernel 3.19
> 
> Due to commit c0371da6 in kernel 3.19, which removed msg_iov
> and msg_iovlen from struct msghdr, DPDK would not build.
> 
> This patch makes use of struct iov_iter, which has references
> to those two variables.
> 
> Reported-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Self-NACK. Kernel 4.0 has other changes that require other fixes, incompatible with this patch.
Will send a v2 compatible with both kernels 3.19 and 4.0

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v2] kni: fix compilation issue in KNI vhost on kernel 3.19/4.0
       [not found] ` <1430829319-22242-1-git-send-email-pablo.de.lara.guarch@intel.com>
@ 2015-05-05 14:07   ` De Lara Guarch, Pablo
  2015-05-05 14:08   ` [dpdk-dev] [PATCH v3] " Pablo de Lara
  1 sibling, 0 replies; 11+ messages in thread
From: De Lara Guarch, Pablo @ 2015-05-05 14:07 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pablo de Lara
> Sent: Tuesday, May 05, 2015 1:35 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v2] kni: fix compilation issue in KNI vhost on
> kernel 3.19/4.0
> 
> Due to commit c0371da6 in kernel 3.19, which removed msg_iov
> and msg_iovlen from struct msghdr, DPDK would not build.
> Also, functions memcpy_toiovecend and memcpy_fromiovecend
> were removed in commits ba7438ae and 57dd8a07, being substituted by
> copy_from_iter and copy_to_iter.
> 
> This patch makes use of struct iov_iter, which has references
> to msg_iov and msg_iovln, and makes use of copy_from_iter
> and copy_to_iter.
> 
> Reported-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Self-NACK again. Missing checks and wrong variable names.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v3] kni: fix compilation issue in KNI vhost on kernel 3.19/4.0
       [not found] ` <1430829319-22242-1-git-send-email-pablo.de.lara.guarch@intel.com>
  2015-05-05 14:07   ` [dpdk-dev] [PATCH v2] kni: fix compilation issue in KNI vhost on kernel 3.19/4.0 De Lara Guarch, Pablo
@ 2015-05-05 14:08   ` Pablo de Lara
  2015-05-10 21:25     ` Thomas Monjalon
  2015-05-11  9:06     ` Thomas Monjalon
  1 sibling, 2 replies; 11+ messages in thread
From: Pablo de Lara @ 2015-05-05 14:08 UTC (permalink / raw)
  To: dev

Due to commit c0371da6 in kernel 3.19, which removed msg_iov
and msg_iovlen from struct msghdr, DPDK would not build.
Also, functions memcpy_toiovecend and memcpy_fromiovecend
were removed in commits ba7438ae and 57dd8a07, being substituted by
copy_from_iter and copy_to_iter.

This patch makes use of struct iov_iter, which has references
to msg_iov and msg_iovln, and makes use of copy_from_iter
and copy_to_iter.

Changes in v2:
- Replaced functions memcpy_toiovecend and memcpy_fromiovecend
  with copy_from_iter and copy_to_iter

Changes in v3:
- Fixed variable names
- Add missing checks

Reported-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 lib/librte_eal/linuxapp/kni/compat.h    |    4 +++
 lib/librte_eal/linuxapp/kni/kni_vhost.c |   37 ++++++++++++++++++++++++------
 2 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h
index 1313523..1ad22ba 100644
--- a/lib/librte_eal/linuxapp/kni/compat.h
+++ b/lib/librte_eal/linuxapp/kni/compat.h
@@ -19,3 +19,7 @@
 #define sk_sleep(s) (s)->sk_sleep
 
 #endif /* < 2.6.35 */
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
+#define HAVE_IOV_ITER_MSGHDR
+#endif
diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c
index 7141f83..83d3351 100644
--- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
+++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
@@ -76,7 +76,7 @@ static struct proto kni_raw_proto = {
 };
 
 static inline int
-kni_vhost_net_tx(struct kni_dev *kni, struct iovec *iov,
+kni_vhost_net_tx(struct kni_dev *kni, struct msghdr *m,
 		 unsigned offset, unsigned len)
 {
 	struct rte_kni_mbuf *pkt_kva = NULL;
@@ -84,7 +84,11 @@ kni_vhost_net_tx(struct kni_dev *kni, struct iovec *iov,
 	int ret;
 
 	KNI_DBG_TX("tx offset=%d, len=%d, iovlen=%d\n",
-		   offset, len, (int)iov->iov_len);
+#ifdef HAVE_IOV_ITER_MSGHDR
+		   offset, len, (int)m->msg_iter.iov->iov_len);
+#else
+		   offset, len, (int)m->msg_iov->iov_len);
+#endif
 
 	/**
 	 * Check if it has at least one free entry in tx_q and
@@ -108,7 +112,12 @@ kni_vhost_net_tx(struct kni_dev *kni, struct iovec *iov,
 		data_kva = pkt_kva->buf_addr + pkt_kva->data_off
 		           - kni->mbuf_va + kni->mbuf_kva;
 
-		memcpy_fromiovecend(data_kva, iov, offset, len);
+#ifdef HAVE_IOV_ITER_MSGHDR
+		copy_from_iter(data_kva, len, &m->msg_iter);
+#else
+		memcpy_fromiovecend(data_kva, m->msg_iov, offset, len);
+#endif
+
 		if (unlikely(len < ETH_ZLEN)) {
 			memset(data_kva + len, 0, ETH_ZLEN - len);
 			len = ETH_ZLEN;
@@ -143,7 +152,7 @@ drop:
 }
 
 static inline int
-kni_vhost_net_rx(struct kni_dev *kni, struct iovec *iov,
+kni_vhost_net_rx(struct kni_dev *kni, struct msghdr *m,
 		 unsigned offset, unsigned len)
 {
 	uint32_t pkt_len;
@@ -177,10 +186,18 @@ kni_vhost_net_rx(struct kni_dev *kni, struct iovec *iov,
 		goto drop;
 
 	KNI_DBG_RX("rx offset=%d, len=%d, pkt_len=%d, iovlen=%d\n",
-		   offset, len, pkt_len, (int)iov->iov_len);
+#ifdef HAVE_IOV_ITER_MSGHDR
+		   offset, len, pkt_len, (int)m->msg_iter.iov->iov_len);
+#else
+		   offset, len, pkt_len, (int)m->msg_iov->iov_len);
+#endif
 
 	data_kva = kva->buf_addr + kva->data_off - kni->mbuf_va + kni->mbuf_kva;
-	if (unlikely(memcpy_toiovecend(iov, data_kva, offset, pkt_len)))
+#ifdef HAVE_IOV_ITER_MSGHDR
+	if (unlikely(copy_to_iter(data_kva, pkt_len, &m->msg_iter)))
+#else
+	if (unlikely(memcpy_toiovecend(m->msg_iov, data_kva, offset, pkt_len)))
+#endif
 		goto drop;
 
 	/* Update statistics */
@@ -348,7 +365,11 @@ kni_sock_sndmsg(struct kiocb *iocb, struct socket *sock,
 		return 0;
 
 	KNI_DBG_TX("kni_sndmsg len %ld, flags 0x%08x, nb_iov %d\n",
+#ifdef HAVE_IOV_ITER_MSGHDR
+		   len, q->flags, (int)m->msg_iter.iov->iov_len);
+#else
 		   len, q->flags, (int)m->msg_iovlen);
+#endif
 
 #ifdef RTE_KNI_VHOST_VNET_HDR_EN
 	if (likely(q->flags & IFF_VNET_HDR)) {
@@ -362,7 +383,7 @@ kni_sock_sndmsg(struct kiocb *iocb, struct socket *sock,
 	if (unlikely(len < ETH_HLEN + q->vnet_hdr_sz))
 		return -EINVAL;
 
-	return kni_vhost_net_tx(q->kni, m->msg_iov, vnet_hdr_len, len);
+	return kni_vhost_net_tx(q->kni, m, vnet_hdr_len, len);
 }
 
 static int
@@ -391,7 +412,7 @@ kni_sock_rcvmsg(struct kiocb *iocb, struct socket *sock,
 #endif
 
 	if (unlikely(0 == (pkt_len = kni_vhost_net_rx(q->kni,
-		m->msg_iov, vnet_hdr_len, len))))
+		m, vnet_hdr_len, len))))
 		return 0;
 
 #ifdef RTE_KNI_VHOST_VNET_HDR_EN
-- 
1.7.4.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v3] kni: fix compilation issue in KNI vhost on kernel 3.19/4.0
  2015-05-05 14:08   ` [dpdk-dev] [PATCH v3] " Pablo de Lara
@ 2015-05-10 21:25     ` Thomas Monjalon
  2015-05-10 23:01       ` De Lara Guarch, Pablo
  2015-05-11  9:06     ` Thomas Monjalon
  1 sibling, 1 reply; 11+ messages in thread
From: Thomas Monjalon @ 2015-05-10 21:25 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: dev

Hi Pablo,

2015-05-05 15:08, Pablo de Lara:
> Due to commit c0371da6 in kernel 3.19, which removed msg_iov
> and msg_iovlen from struct msghdr, DPDK would not build.
> Also, functions memcpy_toiovecend and memcpy_fromiovecend
> were removed in commits ba7438ae and 57dd8a07, being substituted by
> copy_from_iter and copy_to_iter.
> 
> This patch makes use of struct iov_iter, which has references
> to msg_iov and msg_iovln, and makes use of copy_from_iter
> and copy_to_iter.
> 
> Changes in v2:
> - Replaced functions memcpy_toiovecend and memcpy_fromiovecend
>   with copy_from_iter and copy_to_iter
> 
> Changes in v3:
> - Fixed variable names
> - Add missing checks
> 
> Reported-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

I have the following errors with Linux 4.0.1:

lib/librte_eal/linuxapp/kni/igb_main.c:2321:2: error: initialization from incompatible pointer type
  .ndo_bridge_setlink = igb_ndo_bridge_setlink,
  ^
lib/librte_eal/linuxapp/kni/igb_main.c:2321:2: error: (near initialization for ‘igb_netdev_ops.ndo_bridge_setlink’)
lib/librte_eal/linuxapp/kni/igb_main.c: In function ‘igb_xmit_frame_ring’:
lib/librte_eal/linuxapp/kni/igb_main.c:5482:2: error: implicit declaration of function ‘vlan_tx_tag_present’
  if (vlan_tx_tag_present(skb)) {
  ^
lib/librte_eal/linuxapp/kni/igb_main.c:5484:3: error: implicit declaration of function ‘vlan_tx_tag_get’
   tx_flags |= (vlan_tx_tag_get(skb) << IGB_TX_FLAGS_VLAN_SHIFT);
   ^

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v3] kni: fix compilation issue in KNI vhost on kernel 3.19/4.0
  2015-05-10 21:25     ` Thomas Monjalon
@ 2015-05-10 23:01       ` De Lara Guarch, Pablo
  2015-05-11  8:27         ` Thomas Monjalon
  0 siblings, 1 reply; 11+ messages in thread
From: De Lara Guarch, Pablo @ 2015-05-10 23:01 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

Hi Thomas,

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Sunday, May 10, 2015 10:26 PM
> To: De Lara Guarch, Pablo
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3] kni: fix compilation issue in KNI vhost on
> kernel 3.19/4.0
> 
> Hi Pablo,
> 
> 2015-05-05 15:08, Pablo de Lara:
> > Due to commit c0371da6 in kernel 3.19, which removed msg_iov
> > and msg_iovlen from struct msghdr, DPDK would not build.
> > Also, functions memcpy_toiovecend and memcpy_fromiovecend
> > were removed in commits ba7438ae and 57dd8a07, being substituted by
> > copy_from_iter and copy_to_iter.
> >
> > This patch makes use of struct iov_iter, which has references
> > to msg_iov and msg_iovln, and makes use of copy_from_iter
> > and copy_to_iter.
> >
> > Changes in v2:
> > - Replaced functions memcpy_toiovecend and memcpy_fromiovecend
> >   with copy_from_iter and copy_to_iter
> >
> > Changes in v3:
> > - Fixed variable names
> > - Add missing checks
> >
> > Reported-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> 
> I have the following errors with Linux 4.0.1:
> 
> lib/librte_eal/linuxapp/kni/igb_main.c:2321:2: error: initialization from
> incompatible pointer type
>   .ndo_bridge_setlink = igb_ndo_bridge_setlink,
>   ^
> lib/librte_eal/linuxapp/kni/igb_main.c:2321:2: error: (near initialization for
> ‘igb_netdev_ops.ndo_bridge_setlink’)
> lib/librte_eal/linuxapp/kni/igb_main.c: In function ‘igb_xmit_frame_ring’:
> lib/librte_eal/linuxapp/kni/igb_main.c:5482:2: error: implicit declaration of
> function ‘vlan_tx_tag_present’
>   if (vlan_tx_tag_present(skb)) {
>   ^
> lib/librte_eal/linuxapp/kni/igb_main.c:5484:3: error: implicit declaration of
> function ‘vlan_tx_tag_get’
>    tx_flags |= (vlan_tx_tag_get(skb) << IGB_TX_FLAGS_VLAN_SHIFT);
>    ^

I sent a patch for that (kni: fix compilation issue on kernel 4.0.0), by the end of last month.
Is it OK to merge it or do you want me to send a v4 of this one, including that fix?

Thanks,
Pablo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v3] kni: fix compilation issue in KNI vhost on kernel 3.19/4.0
  2015-05-10 23:01       ` De Lara Guarch, Pablo
@ 2015-05-11  8:27         ` Thomas Monjalon
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Monjalon @ 2015-05-11  8:27 UTC (permalink / raw)
  To: De Lara Guarch, Pablo; +Cc: dev

2015-05-10 23:01, De Lara Guarch, Pablo:
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > I have the following errors with Linux 4.0.1:
> > 
> > lib/librte_eal/linuxapp/kni/igb_main.c:2321:2: error: initialization from
> > incompatible pointer type
> >   .ndo_bridge_setlink = igb_ndo_bridge_setlink,
> >   ^
> > lib/librte_eal/linuxapp/kni/igb_main.c:2321:2: error: (near initialization for
> > ‘igb_netdev_ops.ndo_bridge_setlink’)
> > lib/librte_eal/linuxapp/kni/igb_main.c: In function ‘igb_xmit_frame_ring’:
> > lib/librte_eal/linuxapp/kni/igb_main.c:5482:2: error: implicit declaration of
> > function ‘vlan_tx_tag_present’
> >   if (vlan_tx_tag_present(skb)) {
> >   ^
> > lib/librte_eal/linuxapp/kni/igb_main.c:5484:3: error: implicit declaration of
> > function ‘vlan_tx_tag_get’
> >    tx_flags |= (vlan_tx_tag_get(skb) << IGB_TX_FLAGS_VLAN_SHIFT);
> >    ^
> 
> I sent a patch for that (kni: fix compilation issue on kernel 4.0.0), by the end of last month.

Oh yes, you're right, sorry.

> Is it OK to merge it or do you want me to send a v4 of this one, including that fix?

Separate patches are OK, thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v3] kni: fix compilation issue in KNI vhost on kernel 3.19/4.0
  2015-05-05 14:08   ` [dpdk-dev] [PATCH v3] " Pablo de Lara
  2015-05-10 21:25     ` Thomas Monjalon
@ 2015-05-11  9:06     ` Thomas Monjalon
  1 sibling, 0 replies; 11+ messages in thread
From: Thomas Monjalon @ 2015-05-11  9:06 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: dev

> Due to commit c0371da6 in kernel 3.19, which removed msg_iov
> and msg_iovlen from struct msghdr, DPDK would not build.
> Also, functions memcpy_toiovecend and memcpy_fromiovecend
> were removed in commits ba7438ae and 57dd8a07, being substituted by
> copy_from_iter and copy_to_iter.
> 
> This patch makes use of struct iov_iter, which has references
> to msg_iov and msg_iovln, and makes use of copy_from_iter
> and copy_to_iter.
> 
> Changes in v2:
> - Replaced functions memcpy_toiovecend and memcpy_fromiovecend
>   with copy_from_iter and copy_to_iter
> 
> Changes in v3:
> - Fixed variable names
> - Add missing checks
> 
> Reported-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: fix compilation issue on kernel 3.19
  2015-03-20 21:23 ` Thomas Monjalon
@ 2015-03-22 18:03   ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 11+ messages in thread
From: De Lara Guarch, Pablo @ 2015-03-22 18:03 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

Hi Thomas,

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Friday, March 20, 2015 9:23 PM
> To: De Lara Guarch, Pablo
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] kni: fix compilation issue on kernel 3.19
> 
> Hi Pablo,
> 
> 2015-03-12 17:24, Pablo de Lara:
> > Due to API changes in functions ndo_dflt_bridge_getlink
> > and igb_ndo_fdb_add in kernel 3.19, DPDK would not build.
> 
> Please provide the Linux commit id for this change.
> 
> > This patch solves the problem, by checking the kernel version
> > and adding the necessary new parameters
> >
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > ---
> >  lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c |    7 +++++++
> >  lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |    3 +++
> >  2 files changed, 10 insertions(+), 0 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 a802a02..24b147d 100644
> > --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
> > +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
> > @@ -2103,6 +2103,9 @@ static int igb_set_features(struct net_device
> *netdev,
> >  static int igb_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
> >  			   struct net_device *dev,
> >  			   const unsigned char *addr,
> > +#ifdef HAVE_NDO_FDB_ADD_VID
> > +			   u16 vid,
> > +#endif
> >  			   u16 flags)
> >  #else
> 
> You should explain in commit message why the change is not needed in
> #else
> (!USE_CONST_DEV_UC_CHAR for version < 3.7).
> 
> >  static int igb_ndo_fdb_add(struct ndmsg *ndm,
> > @@ -2259,7 +2262,11 @@ static int igb_ndo_bridge_getlink(struct sk_buff
> *skb, u32 pid, u32 seq,
> >  	else
> >  		mode = BRIDGE_MODE_VEPA;
> >
> > +#ifdef HAVE_NDO_FDB_ADD_VID
> > +	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0);
> > +#else
> >  	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode);
> > +#endif /* HAVE_NDO_FDB_ADD_VID */
> >  }
> >  #endif /* HAVE_BRIDGE_ATTRIBS */
> >  #endif /* NTF_SELF */
> > diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
> b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
> > index 1213cc6..5c799e9 100644
> > --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
> > +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
> > @@ -3881,4 +3881,7 @@ skb_set_hash(struct sk_buff *skb, __u32 hash,
> __always_unused int type)
> >  #define HAVE_VF_MIN_MAX_TXRATE 1
> >  #endif /* >= 3.16.0 */
> >
> > +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) )
> > +#define HAVE_NDO_FDB_ADD_VID
> > +#endif /* >= 3.19.0 */
> >  #endif /* _KCOMPAT_H_ */
> 
> A blank line is missing here.
> Are you sure there is no macro defined in the Linux changes which could be
> checked instead of version number? I dislike version checks because of
> backport problems.

I am not aware of such macro in the kernel, unfortunately.
I just sent a v2.

Thanks,
Pablo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: fix compilation issue on kernel 3.19
  2015-03-12 17:24 [dpdk-dev] [PATCH] kni: fix compilation issue on kernel 3.19 Pablo de Lara
@ 2015-03-20 21:23 ` Thomas Monjalon
  2015-03-22 18:03   ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Monjalon @ 2015-03-20 21:23 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: dev

Hi Pablo,

2015-03-12 17:24, Pablo de Lara:
> Due to API changes in functions ndo_dflt_bridge_getlink
> and igb_ndo_fdb_add in kernel 3.19, DPDK would not build.

Please provide the Linux commit id for this change.

> This patch solves the problem, by checking the kernel version
> and adding the necessary new parameters
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
>  lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c |    7 +++++++
>  lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |    3 +++
>  2 files changed, 10 insertions(+), 0 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 a802a02..24b147d 100644
> --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
> +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
> @@ -2103,6 +2103,9 @@ static int igb_set_features(struct net_device *netdev,
>  static int igb_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
>  			   struct net_device *dev,
>  			   const unsigned char *addr,
> +#ifdef HAVE_NDO_FDB_ADD_VID
> +			   u16 vid,
> +#endif
>  			   u16 flags)
>  #else

You should explain in commit message why the change is not needed in #else
(!USE_CONST_DEV_UC_CHAR for version < 3.7).

>  static int igb_ndo_fdb_add(struct ndmsg *ndm,
> @@ -2259,7 +2262,11 @@ static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
>  	else
>  		mode = BRIDGE_MODE_VEPA;
>  
> +#ifdef HAVE_NDO_FDB_ADD_VID
> +	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0);
> +#else
>  	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode);
> +#endif /* HAVE_NDO_FDB_ADD_VID */
>  }
>  #endif /* HAVE_BRIDGE_ATTRIBS */
>  #endif /* NTF_SELF */
> diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
> index 1213cc6..5c799e9 100644
> --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
> +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
> @@ -3881,4 +3881,7 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)
>  #define HAVE_VF_MIN_MAX_TXRATE 1
>  #endif /* >= 3.16.0 */
>  
> +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) )
> +#define HAVE_NDO_FDB_ADD_VID
> +#endif /* >= 3.19.0 */
>  #endif /* _KCOMPAT_H_ */

A blank line is missing here.
Are you sure there is no macro defined in the Linux changes which could be
checked instead of version number? I dislike version checks because of
backport problems.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH] kni: fix compilation issue on kernel 3.19
@ 2015-03-12 17:24 Pablo de Lara
  2015-03-20 21:23 ` Thomas Monjalon
  0 siblings, 1 reply; 11+ messages in thread
From: Pablo de Lara @ 2015-03-12 17:24 UTC (permalink / raw)
  To: dev

Due to API changes in functions ndo_dflt_bridge_getlink
and igb_ndo_fdb_add in kernel 3.19, DPDK would not build.

This patch solves the problem, by checking the kernel version
and adding the necessary new parameters

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c |    7 +++++++
 lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |    3 +++
 2 files changed, 10 insertions(+), 0 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 a802a02..24b147d 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
@@ -2103,6 +2103,9 @@ static int igb_set_features(struct net_device *netdev,
 static int igb_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
 			   struct net_device *dev,
 			   const unsigned char *addr,
+#ifdef HAVE_NDO_FDB_ADD_VID
+			   u16 vid,
+#endif
 			   u16 flags)
 #else
 static int igb_ndo_fdb_add(struct ndmsg *ndm,
@@ -2259,7 +2262,11 @@ static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
 	else
 		mode = BRIDGE_MODE_VEPA;
 
+#ifdef HAVE_NDO_FDB_ADD_VID
+	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0);
+#else
 	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode);
+#endif /* HAVE_NDO_FDB_ADD_VID */
 }
 #endif /* HAVE_BRIDGE_ATTRIBS */
 #endif /* NTF_SELF */
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
index 1213cc6..5c799e9 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
@@ -3881,4 +3881,7 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)
 #define HAVE_VF_MIN_MAX_TXRATE 1
 #endif /* >= 3.16.0 */
 
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) )
+#define HAVE_NDO_FDB_ADD_VID
+#endif /* >= 3.19.0 */
 #endif /* _KCOMPAT_H_ */
-- 
1.7.4.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-05-11  9:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-04 21:46 [dpdk-dev] [PATCH] kni: fix compilation issue on kernel 3.19 Pablo de Lara
2015-05-05 11:28 ` De Lara Guarch, Pablo
     [not found] ` <1430829319-22242-1-git-send-email-pablo.de.lara.guarch@intel.com>
2015-05-05 14:07   ` [dpdk-dev] [PATCH v2] kni: fix compilation issue in KNI vhost on kernel 3.19/4.0 De Lara Guarch, Pablo
2015-05-05 14:08   ` [dpdk-dev] [PATCH v3] " Pablo de Lara
2015-05-10 21:25     ` Thomas Monjalon
2015-05-10 23:01       ` De Lara Guarch, Pablo
2015-05-11  8:27         ` Thomas Monjalon
2015-05-11  9:06     ` Thomas Monjalon
  -- strict thread matches above, loose matches on Subject: below --
2015-03-12 17:24 [dpdk-dev] [PATCH] kni: fix compilation issue on kernel 3.19 Pablo de Lara
2015-03-20 21:23 ` Thomas Monjalon
2015-03-22 18:03   ` De Lara Guarch, Pablo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).