Re: [PATCH bpf-next] selftests/bpf: use ifname instead of ifindex in XDP compliance test tool

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/3/23 6:21 PM, Lorenzo Bianconi wrote:
Rely on interface name instead of interface index in error messages or logs
from XDP compliance test tool.
Improve XDP compliance test tool error messages.

Signed-off-by: Lorenzo Bianconi <lorenzo@xxxxxxxxxx>
---
  tools/testing/selftests/bpf/xdp_features.c | 92 ++++++++++++++--------
  1 file changed, 57 insertions(+), 35 deletions(-)

diff --git a/tools/testing/selftests/bpf/xdp_features.c b/tools/testing/selftests/bpf/xdp_features.c
index fce12165213b..7414801cd7ec 100644
--- a/tools/testing/selftests/bpf/xdp_features.c
+++ b/tools/testing/selftests/bpf/xdp_features.c
@@ -25,6 +25,7 @@
static struct env {
  	bool verbosity;
+	char ifname[IF_NAMESIZE];
  	int ifindex;
  	bool is_tester;
  	struct {
@@ -109,25 +110,25 @@ static int get_xdp_feature(const char *arg)
  	return 0;
  }
-static char *get_xdp_feature_str(void)
+static char *get_xdp_feature_str(bool color)
  {
  	switch (env.feature.action) {
  	case XDP_PASS:
-		return YELLOW("XDP_PASS");
+		return color ? YELLOW("XDP_PASS") : "XDP_PASS";
  	case XDP_DROP:
-		return YELLOW("XDP_DROP");
+		return color ? YELLOW("XDP_DROP") : "XDP_DROP";
  	case XDP_ABORTED:
-		return YELLOW("XDP_ABORTED");
+		return color ? YELLOW("XDP_ABORTED") : "XDP_ABORTED";
  	case XDP_TX:
-		return YELLOW("XDP_TX");
+		return color ? YELLOW("XDP_TX") : "XDP_TX";
  	case XDP_REDIRECT:
-		return YELLOW("XDP_REDIRECT");
+		return color ? YELLOW("XDP_REDIRECT") : "XDP_REDIRECT";
  	default:
  		break;
  	}
if (env.feature.drv_feature == NETDEV_XDP_ACT_NDO_XMIT)
-		return YELLOW("XDP_NDO_XMIT");
+		return color ? YELLOW("XDP_NDO_XMIT") : "XDP_NDO_XMIT";
return "";
  }

Please split this into multiple patches, logically separated. This one is changing
multiple things at once and above has not much relation to relying on interface names.

Thanks,
Daniel



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux