[v2] kni: fix the type for MAC address

Message ID 1554877255-5937-1-git-send-email-panjie5@jd.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] kni: fix the type for MAC address |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Jie Pan April 10, 2019, 6:20 a.m. UTC
  The type for MAC address should be unsigned.

Fixes: 1cfe212ed17a ("kni: support MAC address change")
Cc: stable@dpdk.org

Signed-off-by: Jie Pan <panjie5@jd.com>
---
 kernel/linux/kni/kni_misc.c                       | 2 +-
 lib/librte_eal/linux/eal/include/rte_kni_common.h | 2 +-
 lib/librte_kni/rte_kni.h                          | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
  

Comments

Ferruh Yigit April 19, 2019, 12:15 p.m. UTC | #1
On 4/10/2019 7:20 AM, Jie Pan wrote:
> The type for MAC address should be unsigned.
> 
> Fixes: 1cfe212ed17a ("kni: support MAC address change")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Jie Pan <panjie5@jd.com>

Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
  
Rami Rosen April 19, 2019, 3:29 p.m. UTC | #2
On 4/10/2019 7:20 AM, Jie Pan wrote:
> The type for MAC address should be unsigned.
>
> Fixes: 1cfe212ed17a ("kni: support MAC address change")
> Cc: stable@dpdk.org
>
> Signed-off-by: Jie Pan <panjie5@jd.com>

Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>

Reviewed-by: Rami Rosen <ramirose@gmail.com>
  
Thomas Monjalon April 19, 2019, 8:58 p.m. UTC | #3
19/04/2019 17:29, Rami Rosen:
> On 4/10/2019 7:20 AM, Jie Pan wrote:
> > The type for MAC address should be unsigned.
> >
> > Fixes: 1cfe212ed17a ("kni: support MAC address change")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Jie Pan <panjie5@jd.com>
> 
> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
> 
> Reviewed-by: Rami Rosen <ramirose@gmail.com>

Applied, thanks
  

Patch

diff --git a/kernel/linux/kni/kni_misc.c b/kernel/linux/kni/kni_misc.c
index 31845e1..b6f474d 100644
--- a/kernel/linux/kni/kni_misc.c
+++ b/kernel/linux/kni/kni_misc.c
@@ -447,7 +447,7 @@  struct kni_net {
 		ether_addr_copy(net_dev->dev_addr, kni->lad_dev->dev_addr);
 	else {
 		/* if user has provided a valid mac address */
-		if (is_valid_ether_addr((unsigned char *)(dev_info.mac_addr)))
+		if (is_valid_ether_addr(dev_info.mac_addr))
 			memcpy(net_dev->dev_addr, dev_info.mac_addr, ETH_ALEN);
 		else
 			/*
diff --git a/lib/librte_eal/linux/eal/include/rte_kni_common.h b/lib/librte_eal/linux/eal/include/rte_kni_common.h
index 5afa087..5db5a13 100644
--- a/lib/librte_eal/linux/eal/include/rte_kni_common.h
+++ b/lib/librte_eal/linux/eal/include/rte_kni_common.h
@@ -127,7 +127,7 @@  struct rte_kni_device_info {
 	/* mbuf size */
 	unsigned mbuf_size;
 	unsigned int mtu;
-	char mac_addr[6];
+	uint8_t mac_addr[6];
 };
 
 #define KNI_DEVICE "kni"
diff --git a/lib/librte_kni/rte_kni.h b/lib/librte_kni/rte_kni.h
index 9a9a7d7..c93d3a9 100644
--- a/lib/librte_kni/rte_kni.h
+++ b/lib/librte_kni/rte_kni.h
@@ -68,7 +68,7 @@  struct rte_kni_conf {
 
 	__extension__
 	uint8_t force_bind : 1; /* Flag to bind kernel thread */
-	char mac_addr[ETHER_ADDR_LEN]; /* MAC address assigned to KNI */
+	uint8_t mac_addr[ETHER_ADDR_LEN]; /* MAC address assigned to KNI */
 	uint16_t mtu;
 };