From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F621C4CECE for ; Mon, 14 Oct 2019 16:36:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 25D07217D9 for ; Mon, 14 Oct 2019 16:36:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="ig97LvZX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388127AbfJNQgU (ORCPT ); Mon, 14 Oct 2019 12:36:20 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:45028 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731506AbfJNQgU (ORCPT ); Mon, 14 Oct 2019 12:36:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=4C4AHoecHaRVs6owdq4L/8qk8V8sJuk7zI1TUgCxcq4=; b=ig97LvZXfW21DgDM43kUkVOIrz 4ZH+JgQkPgpKXgRnRGI9Sv7HEOA3XQ93BnCcCuDoDojsXmKcn0YefmcluxRPRgaopfE+GANShEsMr z3obX+c0pn5hzj+9ze92NY1NvmeO65ZcuczeKUqurVKVOs9+LjUKx3NIyWir+iwr615U=; Received: from andrew by vps0.lunn.ch with local (Exim 4.92.2) (envelope-from ) id 1iK3KO-0006KZ-G4; Mon, 14 Oct 2019 18:36:12 +0200 Date: Mon, 14 Oct 2019 18:36:12 +0200 From: Andrew Lunn To: Igor Russkikh Cc: "netdev@vger.kernel.org" , "davem@davemloft.net" , "richardcochran@gmail.com" , Egor Pomozov , Dmitry Bezrukov , Simon Edelhaus , Sergey Samoilenko Subject: Re: [PATCH v2 net-next 06/12] net: aquantia: implement data PTP datapath Message-ID: <20191014163612.GP21165@lunn.ch> References: <093d91dcc66abeb4d3ef83eef829badd7389d792.1570531332.git.igor.russkikh@aquantia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <093d91dcc66abeb4d3ef83eef829badd7389d792.1570531332.git.igor.russkikh@aquantia.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > --- a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c > +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c > @@ -8,12 +8,24 @@ > */ > > +static inline int aq_ptp_tm_offset_egress_get(struct aq_ptp_s *aq_ptp) > +{ > + return atomic_read(&aq_ptp->offset_egress); > +} > + > +static inline int aq_ptp_tm_offset_ingress_get(struct aq_ptp_s *aq_ptp) > +{ > + return atomic_read(&aq_ptp->offset_ingress); > +} inline should not be used in C files. Let the compiler decide. > + > +void aq_ptp_tm_offset_set(struct aq_nic_s *aq_nic, unsigned int mbps) > +{ > + struct aq_ptp_s *aq_ptp = aq_nic->aq_ptp; > + int i, egress, ingress; > + > + if (!aq_ptp) > + return; > + > + egress = 0; > + ingress = 0; > + > + for (i = 0; i < ARRAY_SIZE(ptp_offset); i++) { > + if (mbps == ptp_offset[i].mbps) { > + egress = ptp_offset[i].egress; > + ingress = ptp_offset[i].ingress; > + break; > + } > + } > + > + atomic_set(&aq_ptp->offset_egress, egress); > + atomic_set(&aq_ptp->offset_ingress, ingress); It seems odd you have wrappers for atomic_read, but not atomic_set. Do the wrappers actually add anything? > +} > + > +static int __aq_ptp_skb_put(struct ptp_skb_ring *ring, struct sk_buff *skb) > +{ > + unsigned int next_head = (ring->head + 1) % ring->size; > + > + if (next_head == ring->tail) > + return -1; ENOMEM? > + > + ring->buff[ring->head] = skb_get(skb); > + ring->head = next_head; > + > + return 0; > +} > + Andrew