From patchwork Thu Jun 12 21:31:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve McIntyre X-Patchwork-Id: 31863 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 919222054B for ; Thu, 12 Jun 2014 21:32:21 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id m20sf6608617qcx.1 for ; Thu, 12 Jun 2014 14:32:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=zAs/TDJPmJ8HP1YYEc3t9QW0gFLzCvHkGuS8Cr8ElhY=; b=iohf9vjO51EoouultkkNUkAkCCAvGebC6jsOZL3bCBoC60CUVMtlRl7o/RiC3ljDwF uDxO4HQy0EeAhuxrb9dUymRkv5bUaW+3ghIXSrLqjyi2QQhykvqYwh3PNZDbDypJw+Wg r0hvQfxI7H27jMQBp2TPbclpnU0WH71qjyBcn739gIAXndVw6fPM8uSRMw5xyClwQruQ tzdYEznq1wXGP/dfEpKqonddJysIrqZMY7VBezy5FfN11vhz9+22HltGXbvxRrf0fJJt onFh1GHmvtRtOwOUr4wYRszK+3GjCT7cCGDSODaGMv58lskFHWeb0METa3vI23ooWLaL uHGA== X-Gm-Message-State: ALoCoQlTkl7am/FzG1fp3Pyx4MXFM7nKAD5/tA1424LkI9uPetcppOKCTpGxoRSbrIdSAOjKjf8q X-Received: by 10.236.2.162 with SMTP id 22mr1077159yhf.26.1402608741458; Thu, 12 Jun 2014 14:32:21 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.115 with SMTP id c106ls3191947qge.55.gmail; Thu, 12 Jun 2014 14:32:21 -0700 (PDT) X-Received: by 10.58.68.129 with SMTP id w1mr2080101vet.49.1402608741327; Thu, 12 Jun 2014 14:32:21 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id ul5si740669veb.7.2014.06.12.14.32.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Jun 2014 14:32:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id lf12so1450181vcb.32 for ; Thu, 12 Jun 2014 14:32:21 -0700 (PDT) X-Received: by 10.52.14.9 with SMTP id l9mr2173126vdc.41.1402608741243; Thu, 12 Jun 2014 14:32:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp434210vcb; Thu, 12 Jun 2014 14:32:20 -0700 (PDT) X-Received: by 10.140.19.133 with SMTP id 5mr61706664qgh.46.1402608739897; Thu, 12 Jun 2014 14:32:19 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id k5si2580309qao.13.2014.06.12.14.32.18 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 12 Jun 2014 14:32:19 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1WvCa3-00072g-4H; Thu, 12 Jun 2014 21:30:43 +0000 Received: from cheddar.halon.org.uk ([217.10.144.130]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1WvCZy-00072b-DS for lng-odp@lists.linaro.org; Thu, 12 Jun 2014 21:30:38 +0000 Received: from bsmtp by cheddar.halon.org.uk with local-bsmtp (Exim 4.80) (envelope-from ) id 1WvCbV-0007nT-1k; Thu, 12 Jun 2014 22:32:13 +0100 Received: from steve by tack.local with local (Exim 4.80) (envelope-from ) id 1WvCb0-0005SG-5B; Thu, 12 Jun 2014 22:31:42 +0100 From: steve.mcintyre@linaro.org To: lng-odp@lists.linaro.org Date: Thu, 12 Jun 2014 22:31:42 +0100 Message-Id: <1402608702-20910-1-git-send-email-steve.mcintyre@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Topics: patch Subject: [lng-odp] [PATCH] Support older versions of glibc X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: steve.mcintyre@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Steve McIntyre sendmmsg() was new in glibc version 2.14. Some platforms may still be using older versions of glibc; for those platforms, fall back to multiple sendmsg() calls instead. It may be slightly slower, but will at least work. Signed-off-by: Steve McIntyre --- platform/linux-generic/source/odp_packet_socket.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/platform/linux-generic/source/odp_packet_socket.c b/platform/linux-generic/source/odp_packet_socket.c index 8809abc..e1db61f 100644 --- a/platform/linux-generic/source/odp_packet_socket.c +++ b/platform/linux-generic/source/odp_packet_socket.c @@ -361,11 +361,19 @@ int send_pkt_sock_mmsg(pkt_sock_t * const pkt_sock, } flags = MSG_DONTWAIT; +#if __GLIBC_PREREQ (2,14) for (i = 0; i < len; i += sent_msgs) { ret = sendmmsg(sockfd, &msgvec[i], len - i, flags); sent_msgs = ret > 0 ? (unsigned)ret : 0; flags = 0; /* blocking for next rounds */ } +#else + for (i = 0; i < len; i += sent_msgs) { + ret = sendmsg(sockfd, (const struct msghdr *)&msgvec[i], flags); + sent_msgs = ret > 0 ? 1 : 0; + flags = 0; /* blocking for next rounds */ + } +#endif for (i = 0; i < len; i++) odp_packet_free(pkt_table[i]);