Whamcloud - gitweb
LU-9966 test: add a skip test to test_411
[fs/lustre-release.git] / lustre / contrib / wireshark / lustre_dlm_flags_wshark.c
1 /**
2  * \file lustre_dlm_flags_wshark.c
3  *
4  * wireshark definitions.  This file contains the ldlm lock flag bits
5  * that can be transmitted over the wire.  There are many other bits,
6  * but they are not transmitted and not handled here.
7  */
8 #ifdef WSHARK_HEAD
9
10 static int hf_lustre_ldlm_fl_lock_changed        = -1;
11 static int hf_lustre_ldlm_fl_block_granted       = -1;
12 static int hf_lustre_ldlm_fl_block_conv          = -1;
13 static int hf_lustre_ldlm_fl_block_wait          = -1;
14 static int hf_lustre_ldlm_fl_ast_sent            = -1;
15 static int hf_lustre_ldlm_fl_replay              = -1;
16 static int hf_lustre_ldlm_fl_intent_only         = -1;
17 static int hf_lustre_ldlm_fl_has_intent          = -1;
18 static int hf_lustre_ldlm_fl_flock_deadlock      = -1;
19 static int hf_lustre_ldlm_fl_discard_data        = -1;
20 static int hf_lustre_ldlm_fl_no_timeout          = -1;
21 static int hf_lustre_ldlm_fl_block_nowait        = -1;
22 static int hf_lustre_ldlm_fl_test_lock           = -1;
23 static int hf_lustre_ldlm_fl_cancel_on_block     = -1;
24 static int hf_lustre_ldlm_fl_cos_incompat        = -1;
25 static int hf_lustre_ldlm_fl_deny_on_contention  = -1;
26 static int hf_lustre_ldlm_fl_ast_discard_data    = -1;
27
28 const value_string lustre_ldlm_flags_vals[] = {
29   {LDLM_FL_LOCK_CHANGED,        "LDLM_FL_LOCK_CHANGED"},
30   {LDLM_FL_BLOCK_GRANTED,       "LDLM_FL_BLOCK_GRANTED"},
31   {LDLM_FL_BLOCK_CONV,          "LDLM_FL_BLOCK_CONV"},
32   {LDLM_FL_BLOCK_WAIT,          "LDLM_FL_BLOCK_WAIT"},
33   {LDLM_FL_AST_SENT,            "LDLM_FL_AST_SENT"},
34   {LDLM_FL_REPLAY,              "LDLM_FL_REPLAY"},
35   {LDLM_FL_INTENT_ONLY,         "LDLM_FL_INTENT_ONLY"},
36   {LDLM_FL_HAS_INTENT,          "LDLM_FL_HAS_INTENT"},
37   {LDLM_FL_FLOCK_DEADLOCK,      "LDLM_FL_FLOCK_DEADLOCK"},
38   {LDLM_FL_DISCARD_DATA,        "LDLM_FL_DISCARD_DATA"},
39   {LDLM_FL_NO_TIMEOUT,          "LDLM_FL_NO_TIMEOUT"},
40   {LDLM_FL_BLOCK_NOWAIT,        "LDLM_FL_BLOCK_NOWAIT"},
41   {LDLM_FL_TEST_LOCK,           "LDLM_FL_TEST_LOCK"},
42   {LDLM_FL_CANCEL_ON_BLOCK,     "LDLM_FL_CANCEL_ON_BLOCK"},
43   {LDLM_FL_COS_INCOMPAT,        "LDLM_FL_COS_INCOMPAT"},
44   {LDLM_FL_DENY_ON_CONTENTION,  "LDLM_FL_DENY_ON_CONTENTION"},
45   {LDLM_FL_AST_DISCARD_DATA,    "LDLM_FL_AST_DISCARD_DATA"},
46   { 0, NULL }
47 };
48
49 /* IDL: struct ldlm_reply { */
50 /* IDL:         uint32 lock_flags; */
51 /* IDL:         uint32 lock_padding; */
52 /* IDL:         struct ldlm_lock_desc { */
53 /* IDL: } lock_desc; */
54 /* IDL:         struct lustre_handle { */
55 /* IDL: } lock_handle; */
56 /* IDL:         uint64 lock_policy_res1; */
57 /* IDL:         uint64 lock_policy_res2; */
58 /* IDL: } */
59
60 static int
61 lustre_dissect_element_ldlm_lock_flags(
62         tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_,
63         proto_tree *parent_tree _U_, int hf_index _U_)
64 {
65   proto_item *item = NULL;
66   proto_tree *tree = NULL;
67
68   if (parent_tree) {
69     item = proto_tree_add_item(parent_tree,hf_index, tvb, offset, 4, TRUE);
70     tree = proto_item_add_subtree(item, ett_lustre_ldlm_lock_flags);
71   }
72   dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_fl_lock_changed);
73   dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_fl_block_granted);
74   dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_fl_block_conv);
75   dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_fl_block_wait);
76   dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_fl_ast_sent);
77   dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_fl_replay);
78   dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_fl_intent_only);
79   dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_fl_has_intent);
80   dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_fl_flock_deadlock);
81   dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_fl_discard_data);
82   dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_fl_no_timeout);
83   dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_fl_block_nowait);
84   dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_fl_test_lock);
85   dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_fl_cancel_on_block);
86   dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_fl_cos_incompat);
87   dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_fl_deny_on_contention);
88   return
89     dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_fl_ast_discard_data);
90 }
91 #endif /* WSHARK_HEAD */
92
93 #ifdef WSHARK_INIT_DATA
94   {
95     /* p_id    */ &hf_lustre_ldlm_fl_lock_changed,
96     /* hfinfo  */ {
97       /* name    */ "LDLM_FL_LOCK_CHANGED",
98       /* abbrev  */ "lustre.ldlm_fl_lock_changed",
99       /* type    */ FT_BOOLEAN,
100       /* display */ 32,
101       /* strings */ TFS(&lnet_flags_set_truth),
102       /* bitmask */ LDLM_FL_LOCK_CHANGED,
103       /* blurb   */ "extent, mode, or resource changed",
104       /* id      */ HFILL
105     }
106   },
107   {
108     /* p_id    */ &hf_lustre_ldlm_fl_block_granted,
109     /* hfinfo  */ {
110       /* name    */ "LDLM_FL_BLOCK_GRANTED",
111       /* abbrev  */ "lustre.ldlm_fl_block_granted",
112       /* type    */ FT_BOOLEAN,
113       /* display */ 32,
114       /* strings */ TFS(&lnet_flags_set_truth),
115       /* bitmask */ LDLM_FL_BLOCK_GRANTED,
116       /* blurb   */ "Server placed lock on granted list, or a recovering client wants\n"
117        "the lock added to the granted list, no questions asked.",
118       /* id      */ HFILL
119     }
120   },
121   {
122     /* p_id    */ &hf_lustre_ldlm_fl_block_conv,
123     /* hfinfo  */ {
124       /* name    */ "LDLM_FL_BLOCK_CONV",
125       /* abbrev  */ "lustre.ldlm_fl_block_conv",
126       /* type    */ FT_BOOLEAN,
127       /* display */ 32,
128       /* strings */ TFS(&lnet_flags_set_truth),
129       /* bitmask */ LDLM_FL_BLOCK_CONV,
130       /* blurb   */ "Server placed lock on conv list, or a recovering client wants the lock\n"
131        "added to the conv list, no questions asked.",
132       /* id      */ HFILL
133     }
134   },
135   {
136     /* p_id    */ &hf_lustre_ldlm_fl_block_wait,
137     /* hfinfo  */ {
138       /* name    */ "LDLM_FL_BLOCK_WAIT",
139       /* abbrev  */ "lustre.ldlm_fl_block_wait",
140       /* type    */ FT_BOOLEAN,
141       /* display */ 32,
142       /* strings */ TFS(&lnet_flags_set_truth),
143       /* bitmask */ LDLM_FL_BLOCK_WAIT,
144       /* blurb   */ "Server placed lock on wait list, or a recovering client wants\n"
145        "the lock added to the wait list, no questions asked.",
146       /* id      */ HFILL
147     }
148   },
149   {
150     /* p_id    */ &hf_lustre_ldlm_fl_ast_sent,
151     /* hfinfo  */ {
152       /* name    */ "LDLM_FL_AST_SENT",
153       /* abbrev  */ "lustre.ldlm_fl_ast_sent",
154       /* type    */ FT_BOOLEAN,
155       /* display */ 32,
156       /* strings */ TFS(&lnet_flags_set_truth),
157       /* bitmask */ LDLM_FL_AST_SENT,
158       /* blurb   */ "blocking or cancel packet was queued for sending.",
159       /* id      */ HFILL
160     }
161   },
162   {
163     /* p_id    */ &hf_lustre_ldlm_fl_replay,
164     /* hfinfo  */ {
165       /* name    */ "LDLM_FL_REPLAY",
166       /* abbrev  */ "lustre.ldlm_fl_replay",
167       /* type    */ FT_BOOLEAN,
168       /* display */ 32,
169       /* strings */ TFS(&lnet_flags_set_truth),
170       /* bitmask */ LDLM_FL_REPLAY,
171       /* blurb   */ "Lock is being replayed.  This could probably be implied by the fact that\n"
172        "one of BLOCK_{GRANTED,CONV,WAIT} is set, but that is pretty dangerous.",
173       /* id      */ HFILL
174     }
175   },
176   {
177     /* p_id    */ &hf_lustre_ldlm_fl_intent_only,
178     /* hfinfo  */ {
179       /* name    */ "LDLM_FL_INTENT_ONLY",
180       /* abbrev  */ "lustre.ldlm_fl_intent_only",
181       /* type    */ FT_BOOLEAN,
182       /* display */ 32,
183       /* strings */ TFS(&lnet_flags_set_truth),
184       /* bitmask */ LDLM_FL_INTENT_ONLY,
185       /* blurb   */ "Don't grant lock, just do intent.",
186       /* id      */ HFILL
187     }
188   },
189   {
190     /* p_id    */ &hf_lustre_ldlm_fl_has_intent,
191     /* hfinfo  */ {
192       /* name    */ "LDLM_FL_HAS_INTENT",
193       /* abbrev  */ "lustre.ldlm_fl_has_intent",
194       /* type    */ FT_BOOLEAN,
195       /* display */ 32,
196       /* strings */ TFS(&lnet_flags_set_truth),
197       /* bitmask */ LDLM_FL_HAS_INTENT,
198       /* blurb   */ "lock request has intent",
199       /* id      */ HFILL
200     }
201   },
202   {
203     /* p_id    */ &hf_lustre_ldlm_fl_flock_deadlock,
204     /* hfinfo  */ {
205       /* name    */ "LDLM_FL_FLOCK_DEADLOCK",
206       /* abbrev  */ "lustre.ldlm_fl_flock_deadlock",
207       /* type    */ FT_BOOLEAN,
208       /* display */ 32,
209       /* strings */ TFS(&lnet_flags_set_truth),
210       /* bitmask */ LDLM_FL_FLOCK_DEADLOCK,
211       /* blurb   */ "flock deadlock detected",
212       /* id      */ HFILL
213     }
214   },
215   {
216     /* p_id    */ &hf_lustre_ldlm_fl_discard_data,
217     /* hfinfo  */ {
218       /* name    */ "LDLM_FL_DISCARD_DATA",
219       /* abbrev  */ "lustre.ldlm_fl_discard_data",
220       /* type    */ FT_BOOLEAN,
221       /* display */ 32,
222       /* strings */ TFS(&lnet_flags_set_truth),
223       /* bitmask */ LDLM_FL_DISCARD_DATA,
224       /* blurb   */ "discard (no writeback) on cancel",
225       /* id      */ HFILL
226     }
227   },
228   {
229     /* p_id    */ &hf_lustre_ldlm_fl_no_timeout,
230     /* hfinfo  */ {
231       /* name    */ "LDLM_FL_NO_TIMEOUT",
232       /* abbrev  */ "lustre.ldlm_fl_no_timeout",
233       /* type    */ FT_BOOLEAN,
234       /* display */ 32,
235       /* strings */ TFS(&lnet_flags_set_truth),
236       /* bitmask */ LDLM_FL_NO_TIMEOUT,
237       /* blurb   */ "Blocked by group lock - wait indefinitely",
238       /* id      */ HFILL
239     }
240   },
241   {
242     /* p_id    */ &hf_lustre_ldlm_fl_block_nowait,
243     /* hfinfo  */ {
244       /* name    */ "LDLM_FL_BLOCK_NOWAIT",
245       /* abbrev  */ "lustre.ldlm_fl_block_nowait",
246       /* type    */ FT_BOOLEAN,
247       /* display */ 32,
248       /* strings */ TFS(&lnet_flags_set_truth),
249       /* bitmask */ LDLM_FL_BLOCK_NOWAIT,
250       /* blurb   */ "Server told not to wait if blocked. For AGL, OST will not send\n"
251        "glimpse callback.",
252       /* id      */ HFILL
253     }
254   },
255   {
256     /* p_id    */ &hf_lustre_ldlm_fl_test_lock,
257     /* hfinfo  */ {
258       /* name    */ "LDLM_FL_TEST_LOCK",
259       /* abbrev  */ "lustre.ldlm_fl_test_lock",
260       /* type    */ FT_BOOLEAN,
261       /* display */ 32,
262       /* strings */ TFS(&lnet_flags_set_truth),
263       /* bitmask */ LDLM_FL_TEST_LOCK,
264       /* blurb   */ "return blocking lock",
265       /* id      */ HFILL
266     }
267   },
268   {
269     /* p_id    */ &hf_lustre_ldlm_fl_cancel_on_block,
270     /* hfinfo  */ {
271       /* name    */ "LDLM_FL_CANCEL_ON_BLOCK",
272       /* abbrev  */ "lustre.ldlm_fl_cancel_on_block",
273       /* type    */ FT_BOOLEAN,
274       /* display */ 32,
275       /* strings */ TFS(&lnet_flags_set_truth),
276       /* bitmask */ LDLM_FL_CANCEL_ON_BLOCK,
277       /* blurb   */ "Immediatelly cancel such locks when they block some other locks. Send\n"
278        "cancel notification to original lock holder, but expect no reply. This is\n"
279        "for clients (like liblustre) that cannot be expected to reliably response\n"
280        "to blocking AST.",
281       /* id      */ HFILL
282     }
283   },
284   {
285     /* p_id    */ &hf_lustre_ldlm_fl_cos_incompat,
286     /* hfinfo  */ {
287       /* name    */ "LDLM_FL_COS_INCOMPAT",
288       /* abbrev  */ "lustre.ldlm_fl_cos_incompat",
289       /* type    */ FT_BOOLEAN,
290       /* display */ 32,
291       /* strings */ TFS(&lnet_flags_set_truth),
292       /* bitmask */ LDLM_FL_COS_INCOMPAT,
293       /* blurb   */ "Flag whether a lock is enqueued from a distributed transaction, and the\n"
294         "requesting lock mode is PW/EX, if so, it will check compatibility with COS\n"
295         "locks, and different from original COS semantic, transactions from the same\n"
296         "client is also treated as lock conflict.",
297       /* id      */ HFILL
298     }
299   },
300   {
301     /* p_id    */ &hf_lustre_ldlm_fl_deny_on_contention,
302     /* hfinfo  */ {
303       /* name    */ "LDLM_FL_DENY_ON_CONTENTION",
304       /* abbrev  */ "lustre.ldlm_fl_deny_on_contention",
305       /* type    */ FT_BOOLEAN,
306       /* display */ 32,
307       /* strings */ TFS(&lnet_flags_set_truth),
308       /* bitmask */ LDLM_FL_DENY_ON_CONTENTION,
309       /* blurb   */ "measure lock contention and return -EUSERS if locking contention is high",
310       /* id      */ HFILL
311     }
312   },
313   {
314     /* p_id    */ &hf_lustre_ldlm_fl_ast_discard_data,
315     /* hfinfo  */ {
316       /* name    */ "LDLM_FL_AST_DISCARD_DATA",
317       /* abbrev  */ "lustre.ldlm_fl_ast_discard_data",
318       /* type    */ FT_BOOLEAN,
319       /* display */ 32,
320       /* strings */ TFS(&lnet_flags_set_truth),
321       /* bitmask */ LDLM_FL_AST_DISCARD_DATA,
322       /* blurb   */ "These are flags that are mapped into the flags and ASTs of blocking locks\n"
323        "Add FL_DISCARD to blocking ASTs",
324       /* id      */ HFILL
325     }
326   },
327
328 #endif /* WSHARK_INIT_DATA */