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