From patchwork Mon Aug 25 20:48:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 35946 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CF8DF203C0 for ; Mon, 25 Aug 2014 20:49:18 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id eb12sf83575971oac.1 for ; Mon, 25 Aug 2014 13:49:18 -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:in-reply-to :references: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=cd1WphHji++6KM7TBpgWrtONvJhUriLNU3XQgduL6h4=; b=I03YHB4q4tkvcSE85ik6P5wLWImYq/QP0xEXGzZNqI0agrrZZos8svWXMQ/FOMPq4y y8Vm5GToHtkok5aQBlTZ5MrJfgZyo3WbINjsnhI4UnsUZrTSRI42aZ5fQAonidmd8+G3 ytN6pI+2N28cO0D0iis23u6Fx18Dm088efF2c20nv56D3jam+QG7QsUx4v+YsubXS+gT FUuiCzIMYeS2RAM25amri8eoQvtND8tZ8YxFBtsBRveZlbJVgGsjL3wRppmuUFxgtSyE +RZelcJgTRhAt7VLR5FTa+4SHGPY/7SSFnvlFEUKEv/1qmn2dMVsbctPOdapjXmlH62O d0qA== X-Gm-Message-State: ALoCoQktXEgs9TCDYwxqlkfMXS6UE9h64hm+35GoIT6K9/2P7HlhtalHEuS1pgO7QNE+CMLu7iv2 X-Received: by 10.42.212.207 with SMTP id gt15mr5864900icb.31.1408999758437; Mon, 25 Aug 2014 13:49:18 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.31.161 with SMTP id f30ls370371qgf.39.gmail; Mon, 25 Aug 2014 13:49:18 -0700 (PDT) X-Received: by 10.52.36.131 with SMTP id q3mr19173vdj.90.1408999758298; Mon, 25 Aug 2014 13:49:18 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id h8si552037vdu.73.2014.08.25.13.49.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Aug 2014 13:49:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ij19so15786005vcb.39 for ; Mon, 25 Aug 2014 13:49:18 -0700 (PDT) X-Received: by 10.52.179.161 with SMTP id dh1mr500699vdc.78.1408999757942; Mon, 25 Aug 2014 13:49:17 -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.45.67 with SMTP id uj3csp146297vcb; Mon, 25 Aug 2014 13:49:17 -0700 (PDT) X-Received: by 10.224.44.14 with SMTP id y14mr37611352qae.34.1408999757213; Mon, 25 Aug 2014 13:49:17 -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 d5si1392485qaf.22.2014.08.25.13.49.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 25 Aug 2014 13:49:17 -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 1XM1CV-0001nE-D1; Mon, 25 Aug 2014 20:49:15 +0000 Received: from mail-qg0-f53.google.com ([209.85.192.53]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XM1CL-0001mQ-GU for lng-odp@lists.linaro.org; Mon, 25 Aug 2014 20:49:05 +0000 Received: by mail-qg0-f53.google.com with SMTP id z60so10194503qgd.40 for ; Mon, 25 Aug 2014 13:49:00 -0700 (PDT) X-Received: by 10.140.50.133 with SMTP id s5mr36848947qga.33.1408999740226; Mon, 25 Aug 2014 13:49:00 -0700 (PDT) Received: from fedora1.holmesfamily.ws (c-98-221-136-245.hsd1.nj.comcast.net. [98.221.136.245]) by mx.google.com with ESMTPSA id k10sm2726974qaj.7.2014.08.25.13.48.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Aug 2014 13:48:59 -0700 (PDT) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Mon, 25 Aug 2014 16:48:51 -0400 Message-Id: <1408999731-35261-2-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1408999731-35261-1-git-send-email-mike.holmes@linaro.org> References: <1408999731-35261-1-git-send-email-mike.holmes@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 2/2] generic/odp_packet_socket.c: Fix indentation 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: mike.holmes@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.180 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 Signed-off-by: Mike Holmes Acked-by: Anders Roxell --- platform/linux-generic/odp_packet_socket.c | 70 +++++++++++++++--------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/platform/linux-generic/odp_packet_socket.c b/platform/linux-generic/odp_packet_socket.c index e7e82c1..8ec9108 100644 --- a/platform/linux-generic/odp_packet_socket.c +++ b/platform/linux-generic/odp_packet_socket.c @@ -81,8 +81,8 @@ static inline int ethaddrs_equal(unsigned char mac_a[], unsigned char mac_b[]) return !memcmp(mac_a, mac_b, ETH_ALEN); } -static int set_pkt_sock_fanout_mmap(pkt_sock_mmap_t * const pkt_sock, - int sock_group_idx) +static int set_pkt_sock_fanout_mmap(pkt_sock_mmap_t *const pkt_sock, + int sock_group_idx) { int sockfd = pkt_sock->sockfd; int val; @@ -138,7 +138,7 @@ static int find_raw_fd(const char *netdev) * ODP_PACKET_SOCKET_BASIC: * ODP_PACKET_SOCKET_MMSG: */ -int setup_pkt_sock(pkt_sock_t * const pkt_sock, const char *netdev, +int setup_pkt_sock(pkt_sock_t *const pkt_sock, const char *netdev, odp_buffer_pool_t pool) { int sockfd; @@ -229,7 +229,7 @@ error: * ODP_PACKET_SOCKET_BASIC: * ODP_PACKET_SOCKET_MMSG: */ -int close_pkt_sock(pkt_sock_t * const pkt_sock) +int close_pkt_sock(pkt_sock_t *const pkt_sock) { if (close(pkt_sock->sockfd) != 0) { perror("close_pkt_sock() - close(sockfd)"); @@ -243,7 +243,7 @@ int close_pkt_sock(pkt_sock_t * const pkt_sock) * ODP_PACKET_SOCKET_BASIC: */ int recv_pkt_sock_basic(pkt_sock_t *const pkt_sock, - odp_packet_t pkt_table[], unsigned len) + odp_packet_t pkt_table[], unsigned len) { ssize_t recv_bytes; unsigned i; @@ -300,8 +300,8 @@ int recv_pkt_sock_basic(pkt_sock_t *const pkt_sock, /* * ODP_PACKET_SOCKET_BASIC: */ -int send_pkt_sock_basic(pkt_sock_t * const pkt_sock, - odp_packet_t pkt_table[], unsigned len) +int send_pkt_sock_basic(pkt_sock_t *const pkt_sock, + odp_packet_t pkt_table[], unsigned len) { odp_packet_t pkt; uint8_t *frame; @@ -344,8 +344,8 @@ int send_pkt_sock_basic(pkt_sock_t * const pkt_sock, /* * ODP_PACKET_SOCKET_MMSG: */ -int recv_pkt_sock_mmsg(pkt_sock_t * const pkt_sock, - odp_packet_t pkt_table[], unsigned len) +int recv_pkt_sock_mmsg(pkt_sock_t *const pkt_sock, + odp_packet_t pkt_table[], unsigned len) { const int sockfd = pkt_sock->sockfd; int msgvec_len; @@ -407,8 +407,8 @@ int recv_pkt_sock_mmsg(pkt_sock_t * const pkt_sock, /* * ODP_PACKET_SOCKET_MMSG: */ -int send_pkt_sock_mmsg(pkt_sock_t * const pkt_sock, - odp_packet_t pkt_table[], unsigned len) +int send_pkt_sock_mmsg(pkt_sock_t *const pkt_sock, + odp_packet_t pkt_table[], unsigned len) { struct mmsghdr msgvec[ODP_PACKET_SOCKET_MAX_BURST_TX]; struct iovec iovecs[ODP_PACKET_SOCKET_MAX_BURST_TX]; @@ -454,7 +454,7 @@ union frame_map { struct { struct tpacket2_hdr tp_h ODP_ALIGNED(TPACKET_ALIGNMENT); struct sockaddr_ll s_ll - ODP_ALIGNED(TPACKET_ALIGN(sizeof(struct tpacket2_hdr))); + ODP_ALIGNED(TPACKET_ALIGN(sizeof(struct tpacket2_hdr))); } *v2; void *raw; @@ -619,7 +619,7 @@ static void mmap_fill_ring(struct ring *ring, unsigned blocks) ring->req.tp_block_nr = blocks; ring->req.tp_frame_nr = ring->req.tp_block_size / - ring->req.tp_frame_size * ring->req.tp_block_nr; + ring->req.tp_frame_size * ring->req.tp_block_nr; ring->mm_len = ring->req.tp_block_size * ring->req.tp_block_nr; ring->rd_num = ring->req.tp_frame_nr; @@ -680,14 +680,14 @@ static int mmap_sock(pkt_sock_mmap_t *pkt_sock) /* map rx + tx buffer to userspace : they are in this order */ pkt_sock->mmap_len = - pkt_sock->rx_ring.req.tp_block_size * - pkt_sock->rx_ring.req.tp_block_nr + - pkt_sock->tx_ring.req.tp_block_size * - pkt_sock->tx_ring.req.tp_block_nr; + pkt_sock->rx_ring.req.tp_block_size * + pkt_sock->rx_ring.req.tp_block_nr + + pkt_sock->tx_ring.req.tp_block_size * + pkt_sock->tx_ring.req.tp_block_nr; pkt_sock->mmap_base = - mmap(NULL, pkt_sock->mmap_len, PROT_READ | PROT_WRITE, - MAP_SHARED | MAP_LOCKED | MAP_POPULATE, sock, 0); + mmap(NULL, pkt_sock->mmap_len, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_LOCKED | MAP_POPULATE, sock, 0); if (pkt_sock->mmap_base == MAP_FAILED) { perror("mmap_sock() - mmap rx&tx buffer failed"); @@ -698,16 +698,18 @@ static int mmap_sock(pkt_sock_mmap_t *pkt_sock) memset(pkt_sock->rx_ring.rd, 0, pkt_sock->rx_ring.rd_len); for (i = 0; i < pkt_sock->rx_ring.rd_num; ++i) { pkt_sock->rx_ring.rd[i].iov_base = - pkt_sock->rx_ring.mm_space + (i * pkt_sock->rx_ring.flen); + pkt_sock->rx_ring.mm_space + + (i * pkt_sock->rx_ring.flen); pkt_sock->rx_ring.rd[i].iov_len = pkt_sock->rx_ring.flen; } pkt_sock->tx_ring.mm_space = - pkt_sock->mmap_base + pkt_sock->rx_ring.mm_len; + pkt_sock->mmap_base + pkt_sock->rx_ring.mm_len; memset(pkt_sock->tx_ring.rd, 0, pkt_sock->tx_ring.rd_len); for (i = 0; i < pkt_sock->tx_ring.rd_num; ++i) { pkt_sock->tx_ring.rd[i].iov_base = - pkt_sock->tx_ring.mm_space + (i * pkt_sock->tx_ring.flen); + pkt_sock->tx_ring.mm_space + + (i * pkt_sock->tx_ring.flen); pkt_sock->tx_ring.rd[i].iov_len = pkt_sock->tx_ring.flen; } @@ -733,8 +735,8 @@ static int mmap_bind_sock(pkt_sock_mmap_t *pkt_sock, const char *netdev) pkt_sock->ll.sll_halen = 0; ret = - bind(pkt_sock->sockfd, (struct sockaddr *)&pkt_sock->ll, - sizeof(pkt_sock->ll)); + bind(pkt_sock->sockfd, (struct sockaddr *)&pkt_sock->ll, + sizeof(pkt_sock->ll)); if (ret == -1) { perror("bind_sock() - bind(to IF)"); return -1; @@ -743,7 +745,7 @@ static int mmap_bind_sock(pkt_sock_mmap_t *pkt_sock, const char *netdev) return 0; } -static int mmap_store_hw_addr(pkt_sock_mmap_t * const pkt_sock, +static int mmap_store_hw_addr(pkt_sock_mmap_t *const pkt_sock, const char *netdev) { struct ifreq ethreq; @@ -767,8 +769,8 @@ static int mmap_store_hw_addr(pkt_sock_mmap_t * const pkt_sock, /* * ODP_PACKET_SOCKET_MMAP: */ -int setup_pkt_sock_mmap(pkt_sock_mmap_t * const pkt_sock, const char *netdev, - odp_buffer_pool_t pool, int fanout) +int setup_pkt_sock_mmap(pkt_sock_mmap_t *const pkt_sock, const char *netdev, + odp_buffer_pool_t pool, int fanout) { odp_packet_t pkt; uint8_t *pkt_buf; @@ -800,12 +802,12 @@ int setup_pkt_sock_mmap(pkt_sock_mmap_t * const pkt_sock, const char *netdev, return -1; ret = mmap_setup_ring(pkt_sock->sockfd, &pkt_sock->tx_ring, - PACKET_TX_RING); + PACKET_TX_RING); if (ret != 0) return -1; ret = mmap_setup_ring(pkt_sock->sockfd, &pkt_sock->rx_ring, - PACKET_RX_RING); + PACKET_RX_RING); if (ret != 0) return -1; @@ -835,7 +837,7 @@ int setup_pkt_sock_mmap(pkt_sock_mmap_t * const pkt_sock, const char *netdev, /* * ODP_PACKET_SOCKET_MMAP: */ -int close_pkt_sock_mmap(pkt_sock_mmap_t * const pkt_sock) +int close_pkt_sock_mmap(pkt_sock_mmap_t *const pkt_sock) { mmap_unmap_sock(pkt_sock); if (close(pkt_sock->sockfd) != 0) { @@ -849,8 +851,8 @@ int close_pkt_sock_mmap(pkt_sock_mmap_t * const pkt_sock) /* * ODP_PACKET_SOCKET_MMAP: */ -int recv_pkt_sock_mmap(pkt_sock_mmap_t * const pkt_sock, - odp_packet_t pkt_table[], unsigned len) +int recv_pkt_sock_mmap(pkt_sock_mmap_t *const pkt_sock, + odp_packet_t pkt_table[], unsigned len) { return pkt_mmap_v2_rx(pkt_sock->rx_ring.sock, &pkt_sock->rx_ring, pkt_table, len, pkt_sock->pool, @@ -860,8 +862,8 @@ int recv_pkt_sock_mmap(pkt_sock_mmap_t * const pkt_sock, /* * ODP_PACKET_SOCKET_MMAP: */ -int send_pkt_sock_mmap(pkt_sock_mmap_t * const pkt_sock, - odp_packet_t pkt_table[], unsigned len) +int send_pkt_sock_mmap(pkt_sock_mmap_t *const pkt_sock, + odp_packet_t pkt_table[], unsigned len) { return pkt_mmap_v2_tx(pkt_sock->tx_ring.sock, &pkt_sock->tx_ring, pkt_table, len);