From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f45.google.com (mail-pg0-f45.google.com [74.125.83.45]) by dpdk.org (Postfix) with ESMTP id 7E995532C for ; Fri, 30 Jun 2017 19:29:56 +0200 (CEST) Received: by mail-pg0-f45.google.com with SMTP id u62so66666650pgb.3 for ; Fri, 30 Jun 2017 10:29:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RKaLKABMh7c6g4O4gjB2zdmspyLnyqoZOHr6lDDhXmA=; b=w/BrhFAp4vvPVxZZyp5RMFLHp90IiF9ZBMt6RJwYQRsSjkyUEIXzLXWyDwQsWHc8+r wAfJCmdoKH1VPHByf3sgjEbS5hia+VinMrE2QK7CtCHVOx1nSOtylMLKYSBWHb79BB3m CXY1Q3SHQaSdmTwtEW0xYzIpMlivZXpq9G/yK4TBFvKjCVPzQhelBINcUb/06Ah6pJOs zdncDDIBY6D+XRHDWdpWG+B0TDRD2f5ifYL7JD3sNpICdSO5Ff6+ugj8Wrcv9/NQPB1H BotdGayxouBgj8YpA/49ijis+wKjpZDzVmNZinF32z/R9OIJ45VBvitq6b39/NXBVfNC OHlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RKaLKABMh7c6g4O4gjB2zdmspyLnyqoZOHr6lDDhXmA=; b=BdENPEp/wQfPk55ATFERveW81tZk9+nZwhegir0aEzFoIh6DASZy1C3npsEg2NA9Pn dYJnKHej4htkkI8/okWT9rWOZrUc1U/YZFx4rzTjdUyxPU4SDNZsrNJVvvW9J9HKhFqe IGwub2EuIOR7irDZvFRWVsg3sa3MyK02J+rhQltModdWCKuBnYT9Ay9YBr/Xvlq8rd2Z 9BMKPV+C+Xdq0bfnmOXB2QP+MgJxIXOl4bu37J6LDb0SyOWpY2GuUu4BIMhisH7ef8NJ dB27HmFVD0DOnR3srlTjs2eUugbf0uOL0XmlRWDCqJvRE7v35pXkOYV1Vkj5o8uYfQIO W/gg== X-Gm-Message-State: AKS2vOznkuFRfD0AAfwtaWrhLy4Geg05yk1/J1D/UZyWfW5bYHkDAue1 WKcWQluXFj88IzZc X-Received: by 10.84.143.36 with SMTP id 33mr25639782ply.171.1498843794329; Fri, 30 Jun 2017 10:29:54 -0700 (PDT) Received: from xeon-e3 (76-14-207-240.or.wavecable.com. [76.14.207.240]) by smtp.gmail.com with ESMTPSA id s88sm17097113pfk.16.2017.06.30.10.29.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Jun 2017 10:29:54 -0700 (PDT) Date: Fri, 30 Jun 2017 10:29:52 -0700 From: Stephen Hemminger To: Ferruh Yigit Cc: dev@dpdk.org, Bruce Richardson , Anatoly Burakov Message-ID: <20170630102952.43764cbb@xeon-e3> In-Reply-To: <20170630165140.59594-11-ferruh.yigit@intel.com> References: <20170621110651.75299-1-ferruh.yigit@intel.com> <20170630165140.59594-1-ferruh.yigit@intel.com> <20170630165140.59594-11-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v9 10/20] unci: init netlink X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jun 2017 17:29:56 -0000 On Fri, 30 Jun 2017 17:51:30 +0100 Ferruh Yigit wrote: > +static struct mutex sync_lock; > + > +static void nl_recv(struct sk_buff *skb) > +{ > + struct nlmsghdr *nlh; > + struct unci_nl_msg nl_msg; > + > + nlh = (struct nlmsghdr *)skb->data; > + > + memcpy(&nl_msg, NLMSG_DATA(nlh), sizeof(struct unci_nl_msg)); > + pr_debug("CMD: %u\n", nl_msg.cmd_id); > +} > + > +static struct netlink_kernel_cfg cfg = { > + .input = nl_recv, > +}; > + > +void unci_nl_init(void) > +{ > + nl_sock = netlink_kernel_create(&init_net, UNCI_NL_GRP, &cfg); > + mutex_init(&sync_lock); > +} What if netlink socket create fails? Also, don't need to call mutex_init if you use simpler initailizer. static DEFINE_MUTEX(sync_lock);