From patchwork Thu Aug 3 19:31:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Herbert X-Patchwork-Id: 797427 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quantonium-net.20150623.gappssmtp.com header.i=@quantonium-net.20150623.gappssmtp.com header.b="SkTFKII0"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xNgDf6Z2mz9s72 for ; Fri, 4 Aug 2017 05:32:18 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751948AbdHCTcR (ORCPT ); Thu, 3 Aug 2017 15:32:17 -0400 Received: from mail-pg0-f52.google.com ([74.125.83.52]:37802 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751897AbdHCTcP (ORCPT ); Thu, 3 Aug 2017 15:32:15 -0400 Received: by mail-pg0-f52.google.com with SMTP id y129so9931265pgy.4 for ; Thu, 03 Aug 2017 12:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantonium-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GP2VKmdn1Q+BBS1eHZWUZwW37138Zw+cuuD8UNoo5TM=; b=SkTFKII06NL5WPP7dXZxqV1f89+5btoWLbk9FmV3YO7WccPH9gR+hQVxpsimXSEQx9 33GgekITn4lu/2zn9B0YXhccxTshlchL6nVEErP563XFZwgYtCSpRiZbLNyOobeAf0Si M+s0ew2Q78A0xqCI5M4+MrSvR8juOwE+Kj3WQyENyX//b2E+cyxrYX60K/Q4w1MPJYuD AKnXwOfHieccWMC5xPNSuzFii6CFhTtU24Yj14P9xiKEwscpVfGVxiwNINE3rMbbjrcq Rch8C1i5C9HjjJWkEgvA58kwdwMN1M2CsbVx5wZ2Yb6FnzZNpo0swouIci5AMQfV/qPu 8QTg== 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:in-reply-to :references; bh=GP2VKmdn1Q+BBS1eHZWUZwW37138Zw+cuuD8UNoo5TM=; b=jOIHoHd3QVqSNFKTx1jaZ7y2LwEUwTdO1Zi9yjm6JSlG5lgS2vSDSPX+3xBK7J56UL fN08FwC7sKjWntQlDZERrNWXc/QUdbt9ULix1BdaJKnSCDTdS5G5B6WGkE6l1vrOTAqZ q15NztTvtsEPA6aMgcUydD2wg4k2VSSzeraIFpiH2wLmMlGsldQIdrvsqa++yg0OrImS BB6NDefLypwH57TqblhWDD7u2OX2AHuGBkdyNloa9utOEtNiH8Vtd5BQa97LGEUXMUx2 jDgHiXacCOJl8tW84EwkA3Jwllw/mn0HW+ZCifGPatixDvErMgbxWFg4HEMyzyolQsMo X+sQ== X-Gm-Message-State: AIVw111FMRitkY6hKGKK/BllUg790h8OSobMI68qFPhpsjLpzbeWvJBw 1yeUrQ3Iu7rbiSCw08c= X-Received: by 10.99.4.19 with SMTP id 19mr1341597pge.111.1501788734311; Thu, 03 Aug 2017 12:32:14 -0700 (PDT) Received: from localhost.localdomain (67-207-98-108.static.wiline.com. [67.207.98.108]) by smtp.gmail.com with ESMTPSA id t199sm51274458pgb.30.2017.08.03.12.32.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Aug 2017 12:32:13 -0700 (PDT) From: Tom Herbert To: netdev@vger.kernel.org Cc: rohit@quantonium.net, davejwatson@fb.com, Tom Herbert Subject: [PATCH v3 net-next 4/4] ulp: Documention for ULP infrastructure Date: Thu, 3 Aug 2017 12:31:44 -0700 Message-Id: <20170803193144.24108-5-tom@quantonium.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170803193144.24108-1-tom@quantonium.net> References: <20170803193144.24108-1-tom@quantonium.net> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add a doc in Documentation/networking Signed-off-by: Tom Herbert --- Documentation/networking/ulp.txt | 82 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/networking/ulp.txt diff --git a/Documentation/networking/ulp.txt b/Documentation/networking/ulp.txt new file mode 100644 index 000000000000..4d830314b0ff --- /dev/null +++ b/Documentation/networking/ulp.txt @@ -0,0 +1,82 @@ +Upper Layer Protocol (ULP) Infrastructure +========================================= + +The ULP kernel infrastructure provides a means to hook upper layer +protocol support on a socket. A module may register a ULP hook +in the kernel. ULP processing is enabled by a setsockopt on a socket +that specifies the name of the registered ULP to invoked. An +initialization function is defined for each ULP that can change the +function entry points of the socket (sendmsg, rcvmsg, etc.) or change +the socket in other fundamental ways. + +Note, no synchronization is enforced between the setsockopt to enable +a ULP and ongoing asynchronous operations on the socket (such as a +blocked read). If synchronization is required this must be handled by +the ULP and caller. + +User interface +============== + +The structure for the socket SOL_ULP options is defined in socket.h. + +Example to enable "my_ulp" ULP on a socket: + +struct ulp_config ulpc = { + .ulp_name = "my_ulp", +}; + +setsockopt(sock, SOL_SOCKET, SO_ULP, &ulpc, sizeof(ulpc)) + +The ulp_config includes a "__u8 ulp_params[0]" filled that may be used +to refer ULP specific parameters being set. + +Kernel interface +================ + +The interface for ULP infrastructure is defined in net/ulp_sock.h. + +ULP registration functions +-------------------------- + +int ulp_register(struct ulp_ops *type) + + Called to register a ULP. The ulp_ops structure is described below. + +void ulp_unregister(struct ulp_ops *type); + + Called to unregister a ULP. + +ulp_ops structure +----------------- + +int (*init)(struct sock *sk, char __user *optval, int len) + + Initialization function for the ULP. This is called from setsockopt + when the ULP name in the ulp_config argument matches the registered + ULP. optval is a userspace pointer to the ULP specific parameters. + len is the length of the ULP specific parameters. + +void (*release)(struct sock *sk) + + Called when socket is being destroyed. The ULP implementation + should cancel any asynchronous operations (such as timers) and + release any acquired resources. + +int (*get_params)(struct sock *sk, char __user *optval, int *optlen) + + Get the ULP specific parameters previous set in the init function + for the ULP. Note that optlen is a pointer to kernel memory. + +char name[ULP_NAME_MAX] + + Name of the ULP. Must be NULL terminated. + +struct module *owner + + Corresponding owner for ref count. + +Author +====== + +Tom Herbert (tom@quantonium.net) +