@@ -995,6 +995,49 @@ struct lnet_msg_container {
void **msc_resenders;
};
+/* This UDSP structures need to match the user space liblnetconfig structures
+ * in order for the marshall and unmarshall functions to be common.
+ */
+
+/* Net is described as a
+ * 1. net type
+ * 2. num range
+ */
+struct lnet_ud_net_descr {
+ u32 udn_net_type;
+ struct list_head udn_net_num_range;
+};
+
+/* each NID range is defined as
+ * 1. net descriptor
+ * 2. address range descriptor
+ */
+struct lnet_ud_nid_descr {
+ struct lnet_ud_net_descr ud_net_id;
+ struct list_head ud_addr_range;
+ u32 ud_mem_size;
+};
+
+/* a UDSP rule can have up to three user defined NID descriptors
+ * - src: defines the local NID range for the rule
+ * - dst: defines the peer NID range for the rule
+ * - rte: defines the router NID range for the rule
+ *
+ * An action union defines the action to take when the rule
+ * is matched
+ */
+struct lnet_udsp {
+ struct list_head udsp_on_list;
+ u32 udsp_idx;
+ struct lnet_ud_nid_descr udsp_src;
+ struct lnet_ud_nid_descr udsp_dst;
+ struct lnet_ud_nid_descr udsp_rte;
+ enum lnet_udsp_action_type udsp_action_type;
+ union {
+ u32 udsp_priority;
+ } udsp_action;
+};
+
/* Peer Discovery states */
#define LNET_DC_STATE_SHUTDOWN 0 /* not started */
#define LNET_DC_STATE_RUNNING 1 /* started up OK */
@@ -1176,6 +1219,8 @@ struct lnet {
* work loops
*/
struct completion ln_started;
+ /* UDSP list */
+ struct list_head ln_udsp_list;
};
#endif
@@ -26,8 +26,8 @@
* Author: Amir Shehata <amir.shehata@intel.com>
*/
-#ifndef LNET_DLC_H
-#define LNET_DLC_H
+#ifndef _LNET_DLC_H_
+#define _LNET_DLC_H_
#include <linux/lnet/libcfs_ioctl.h>
#include <linux/lnet/lnet-types.h>
@@ -292,4 +292,88 @@ struct lnet_ioctl_lnet_stats {
struct lnet_counters st_cntrs;
};
-#endif /* LNET_DLC_H */
+/* An IP, numeric NID or a Net number is composed of 1 or more of these
+ * descriptor structures.
+ */
+struct lnet_range_expr {
+ __u32 re_lo;
+ __u32 re_hi;
+ __u32 re_stride;
+};
+
+/* le_count identifies the number of lnet_range_expr in the bulk
+ * which follows
+ */
+struct lnet_expressions {
+ __u32 le_count;
+};
+
+/* A net descriptor has the net type, IE: O2IBLND, SOCKLND, etc and an
+ * expression describing a net number range.
+ */
+struct lnet_ioctl_udsp_net_descr {
+ __u32 ud_net_type;
+ struct lnet_expressions ud_net_num_expr;
+};
+
+/* The UDSP descriptor header contains the type of matching criteria, SRC,
+ * DST, RTE, etc and how many lnet_expressions compose the LNet portion of
+ * the LNet NID. For example an IP can be
+ * composed of 4 lnet_expressions , a gni can be composed of 1
+ */
+struct lnet_ioctl_udsp_descr_hdr {
+ /* The literals SRC, DST and RTE are encoded
+ * here.
+ */
+ __u32 ud_descr_type;
+ __u32 ud_descr_count;
+};
+
+/* each matching expression in the UDSP is described with this.
+ * The bulk format is as follows:
+ * 1. 1x struct lnet_ioctl_udsp_net_descr
+ * -> the net part of the NID
+ * 2. >=0 struct lnet_expressions
+ * -> the address part of the NID
+ */
+struct lnet_ioctl_udsp_descr {
+ struct lnet_ioctl_udsp_descr_hdr iud_src_hdr;
+ struct lnet_ioctl_udsp_net_descr iud_net;
+};
+
+/* The cumulative UDSP descriptor
+ * The bulk format is as follows:
+ * 1. >=1 struct lnet_ioctl_udsp_descr
+ *
+ * The size indicated in iou_hdr is the total size of the UDSP.
+ *
+ */
+struct lnet_ioctl_udsp {
+ struct libcfs_ioctl_hdr iou_hdr;
+ __s32 iou_idx;
+ __u32 iou_action_type;
+ __u32 iou_bulk_size;
+ union {
+ __u32 priority;
+ } iou_action;
+ void __user *iou_bulk;
+};
+
+/* structure used to request udsp instantiation information on the
+ * specified construct.
+ * cud_nid: the NID of the local or remote NI to pull info on.
+ * cud_nid_priority: NID prio of the requested NID.
+ * cud_net_priority: net prio of network of the requested NID.
+ * cud_pref_nid: array of preferred NIDs if it exists.
+ */
+struct lnet_ioctl_construct_udsp_info {
+ struct libcfs_ioctl_hdr cud_hdr;
+ __u32 cud_peer:1;
+ lnet_nid_t cud_nid;
+ __u32 cud_nid_priority;
+ __u32 cud_net_priority;
+ lnet_nid_t cud_pref_nid[LNET_MAX_SHOW_NUM_NID];
+ lnet_nid_t cud_pref_rtr_nid[LNET_MAX_SHOW_NUM_NID];
+};
+
+#endif /* _LNET_DLC_H_ */
@@ -709,6 +709,20 @@ enum lnet_ack_req {
/** Request that no acknowledgment should be generated. */
LNET_NOACK_REQ
};
+
+/**
+ * UDSP action types. There are two available actions:
+ * 1. PRIORITY - set priority of matching LNet constructs
+ * 2. PREFERRED LIST - set preferred list of matching LNet constructs
+ */
+enum lnet_udsp_action_type {
+ EN_LNET_UDSP_ACTION_NONE = 0,
+ /** assign a priority to matching constructs */
+ EN_LNET_UDSP_ACTION_PRIORITY = 1,
+ /** assign a preferred list of NIDs to matching constructs */
+ EN_LNET_UDSP_ACTION_PREFERRED_LIST = 2,
+};
+
/** @} lnet_data */
/** @} lnet */
@@ -1154,6 +1154,7 @@ struct list_head **
INIT_LIST_HEAD(&the_lnet.ln_dc_expired);
INIT_LIST_HEAD(&the_lnet.ln_mt_localNIRecovq);
INIT_LIST_HEAD(&the_lnet.ln_mt_peerNIRecovq);
+ INIT_LIST_HEAD(&the_lnet.ln_udsp_list);
init_waitqueue_head(&the_lnet.ln_dc_waitq);
the_lnet.ln_mt_handler = NULL;
init_completion(&the_lnet.ln_started);