From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 65637A0C4B; Wed, 14 Jul 2021 11:28:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1641E4014E; Wed, 14 Jul 2021 11:28:44 +0200 (CEST) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by mails.dpdk.org (Postfix) with ESMTP id E531740140 for ; Wed, 14 Jul 2021 11:28:42 +0200 (CEST) Received: by mail-wm1-f66.google.com with SMTP id y21-20020a7bc1950000b02902161fccabf1so3469443wmi.2 for ; Wed, 14 Jul 2021 02:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=o8hKOx1KoGfgIkOnBGGOJ5dMpj3dTDWqbwTuyDHEIcU=; b=KrcBcasiwkmb1UKRHNU2WCD2harolci+4L28I0Q8Wc7ooc219dZWRQ3BsjFvpAC4nf BBZZu4CRYZOH7AkR8x1vjGrVEkROEBrFuJomvnP1/BRHMpDG0wZCNyEtoj3QGutgwMC7 HZulyzAE3AphTX00ogFO3tz4ycX3GzgWBIfV4FDW9G24TNDrToEV0MrtjstDpAS1OI86 dSCs2vf5OXwZQrLQJAxDnQQ9SGcaqP6CA9CgW9qGh/TPFCGKJFdkn/Dl9zKZ3Q6F4JSx Nzh6qV7aBBeRT66SCoH0GFNlHmBsbidcPzeBTIwCJ/0SS1/9vQc8aUXVFhSQWoKuNzYg I1tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=o8hKOx1KoGfgIkOnBGGOJ5dMpj3dTDWqbwTuyDHEIcU=; b=Y4Fec3BCT9GDYdxEXYI40ZtRNQlNI5rsZljlSQUXCr2RPP6DfgYL6exZotHTxBgURN G14Wk7fp1IteUh3F6c1FYaU8N9PIE+8HigAaa3wZCsvTB2XImxCs0KGWcVzi2qkSb9kD MWUhtx6RqDq4j7Lz+RY+bkrcTTPLOfwVCzaC4Lr43XTWoLazKLsVvU0HvAPgvBNsyICt iHVgz55iZ39huhEW8896hfdfNbHzvdI2yfISgSUB27ZL/3t6b3okC9BezpOEe/DbHHhl Zj64Ge9bgDRUysNQxJUz0RVgUwRmJjIlfaI6YXZIHcNddZpcCxtLFWC6rG5zDZ6b7TKf GFUg== X-Gm-Message-State: AOAM5323M4rSxMrQhegxlOyosI7vM56mWDN+DND3vL9os7QXilhsus8C 4WEhKJMQ3ab9xKPLGKbOvss= X-Google-Smtp-Source: ABdhPJwktprMR5LuufeqlFdKRafErQUJNurT4j4Nx55VjjTbvNfiWAf8fy2Ym7C3/tAgh7c0AAlF3Q== X-Received: by 2002:a1c:790a:: with SMTP id l10mr10163969wme.8.1626254922749; Wed, 14 Jul 2021 02:28:42 -0700 (PDT) Received: from tucornea-dev-machine.localdomain ([193.226.172.42]) by smtp.gmail.com with ESMTPSA id r4sm1904824wre.84.2021.07.14.02.28.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jul 2021 02:28:42 -0700 (PDT) From: Tudor Cornea X-Google-Original-From: Tudor Cornea To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Tudor Cornea Date: Wed, 14 Jul 2021 12:28:11 +0300 Message-Id: <1626254891-65085-1-git-send-email-tudor.cornea@keysight.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] net/af_packet: run on kernels without qdisc bypass support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Some older kernels do not support the PACKET_QDISC_BYPASS socket option. Such an example is the CentOS 7 kernel (3.10). If we only check for the definition of PACKET_QDISC_BYPASS, it might mean that we will not be able to compile the PMD driver on a newer platform, and run in on a machine with an older kernel. Setting the socket option only if it is specifically requested from the EAL arguments, allows us to have a way to run the PMD compiled against newer kernel headers, on platforms having older kernels. Signed-off-by: Tudor Cornea --- drivers/net/af_packet/rte_eth_af_packet.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index 2e90e29..60b485a 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -749,13 +749,15 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, } #if defined(PACKET_QDISC_BYPASS) - rc = setsockopt(qsockfd, SOL_PACKET, PACKET_QDISC_BYPASS, - &qdisc_bypass, sizeof(qdisc_bypass)); - if (rc == -1) { - PMD_LOG_ERRNO(ERR, - "%s: could not set PACKET_QDISC_BYPASS on AF_PACKET socket for %s", - name, pair->value); - goto error; + if (qdisc_bypass) { + rc = setsockopt(qsockfd, SOL_PACKET, PACKET_QDISC_BYPASS, + &qdisc_bypass, sizeof(qdisc_bypass)); + if (rc == -1) { + PMD_LOG_ERRNO(ERR, + "%s: could not set PACKET_QDISC_BYPASS on AF_PACKET socket for %s", + name, pair->value); + goto error; + } } #else RTE_SET_USED(qdisc_bypass); -- 2.7.4