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