nm_rs/auto/
setting_ovs_dpdk.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir
3// from gtk-girs (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5
6use crate::{ffi,Setting};
7#[cfg(feature = "v1_54")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_54")))]
9use crate::{SettingOvsDpdkLscInterrupt};
10use glib::{prelude::*};
11#[cfg(feature = "v1_20")]
12#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
13use glib::{signal::{connect_raw, SignalHandlerId},translate::*};
14#[cfg(feature = "v1_20")]
15#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
16use std::{boxed::Box as Box_};
17
18glib::wrapper! {
19    /// OvsDpdk Link Settings
20    ///
21    /// ## Properties
22    ///
23    ///
24    /// #### `devargs`
25    ///  Open vSwitch DPDK device arguments.
26    ///
27    /// Readable | Writeable
28    ///
29    ///
30    /// #### `lsc-interrupt`
31    ///  Configures the Link State Change (LSC) detection mode for the OVS DPDK interface.
32    /// When set to [`SettingOvsDpdkLscInterrupt::Ignore`][crate::SettingOvsDpdkLscInterrupt::Ignore], NetworkManager doesn't
33    /// change the default value configured by Open vSwitch.
34    /// [`SettingOvsDpdkLscInterrupt::Enabled`][crate::SettingOvsDpdkLscInterrupt::Enabled] enables interrupts.
35    /// [`SettingOvsDpdkLscInterrupt::Disabled`][crate::SettingOvsDpdkLscInterrupt::Disabled] disables interrupts, thus setting the
36    /// interface in poll mode.
37    ///
38    /// Readable | Writeable
39    ///
40    ///
41    /// #### `n-rxq`
42    ///  Open vSwitch DPDK number of rx queues.
43    /// Defaults to zero which means to leave the parameter in OVS unspecified
44    /// and effectively configures one queue.
45    ///
46    /// Readable | Writeable
47    ///
48    ///
49    /// #### `n-rxq-desc`
50    ///  The rx queue size (number of rx descriptors) for DPDK ports.
51    /// Must be zero or a power of 2 between 1 and 4096, and supported
52    /// by the hardware. Defaults to zero which means to leave the
53    /// parameter in OVS unspecified and effectively configures 2048
54    /// descriptors.
55    ///
56    /// Readable | Writeable
57    ///
58    ///
59    /// #### `n-txq-desc`
60    ///  The tx queue size (number of tx descriptors) for DPDK ports.
61    /// Must be zero or a power of 2 between 1 and 4096, and supported
62    /// by the hardware. Defaults to zero which means to leave the
63    /// parameter in OVS unspecified and effectively configures 2048
64    /// descriptors.
65    ///
66    /// Readable | Writeable
67    /// <details><summary><h4>Setting</h4></summary>
68    ///
69    ///
70    /// #### `name`
71    ///  The setting's name, which uniquely identifies the setting within the
72    /// connection.  Each setting type has a name unique to that type, for
73    /// example "ppp" or "802-11-wireless" or "802-3-ethernet".
74    ///
75    /// Readable
76    /// </details>
77    ///
78    /// # Implements
79    ///
80    /// [`SettingExt`][trait@crate::prelude::SettingExt]
81    #[doc(alias = "NMSettingOvsDpdk")]
82    pub struct SettingOvsDpdk(Object<ffi::NMSettingOvsDpdk, ffi::NMSettingOvsDpdkClass>) @extends Setting;
83
84    match fn {
85        type_ => || ffi::nm_setting_ovs_dpdk_get_type(),
86    }
87}
88
89impl SettingOvsDpdk {
90    /// Creates a new #NMSettingOvsDpdk object with default values.
91    ///
92    /// # Returns
93    ///
94    /// the new empty #NMSettingOvsDpdk object
95    #[cfg(feature = "v1_20")]
96    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
97    #[doc(alias = "nm_setting_ovs_dpdk_new")]
98    pub fn new() -> SettingOvsDpdk {
99        assert_initialized_main_thread!();
100        unsafe {
101            Setting::from_glib_full(ffi::nm_setting_ovs_dpdk_new()).unsafe_cast()
102        }
103    }
104
105            // rustdoc-stripper-ignore-next
106            /// Creates a new builder-pattern struct instance to construct [`SettingOvsDpdk`] objects.
107            ///
108            /// This method returns an instance of [`SettingOvsDpdkBuilder`](crate::builders::SettingOvsDpdkBuilder) which can be used to create [`SettingOvsDpdk`] objects.
109            pub fn builder() -> SettingOvsDpdkBuilder {
110                SettingOvsDpdkBuilder::new()
111            }
112        
113
114    ///
115    /// # Returns
116    ///
117    /// the #NMSettingOvsDpdk:devargs property of the setting
118    #[cfg(feature = "v1_20")]
119    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
120    #[doc(alias = "nm_setting_ovs_dpdk_get_devargs")]
121    #[doc(alias = "get_devargs")]
122    pub fn devargs(&self) -> glib::GString {
123        unsafe {
124            from_glib_none(ffi::nm_setting_ovs_dpdk_get_devargs(self.to_glib_none().0))
125        }
126    }
127
128    ///
129    /// # Returns
130    ///
131    /// the #NMSettingOvsDpdk:lsc-interrupt property of the setting
132    #[cfg(feature = "v1_54")]
133    #[cfg_attr(docsrs, doc(cfg(feature = "v1_54")))]
134    #[doc(alias = "nm_setting_ovs_dpdk_get_lsc_interrupt")]
135    #[doc(alias = "get_lsc_interrupt")]
136    #[doc(alias = "lsc-interrupt")]
137    pub fn lsc_interrupt(&self) -> SettingOvsDpdkLscInterrupt {
138        unsafe {
139            from_glib(ffi::nm_setting_ovs_dpdk_get_lsc_interrupt(self.to_glib_none().0))
140        }
141    }
142
143    ///
144    /// # Returns
145    ///
146    /// the #NMSettingOvsDpdk:n-rxq property of the setting
147    #[cfg(feature = "v1_36")]
148    #[cfg_attr(docsrs, doc(cfg(feature = "v1_36")))]
149    #[doc(alias = "nm_setting_ovs_dpdk_get_n_rxq")]
150    #[doc(alias = "get_n_rxq")]
151    #[doc(alias = "n-rxq")]
152    pub fn n_rxq(&self) -> u32 {
153        unsafe {
154            ffi::nm_setting_ovs_dpdk_get_n_rxq(self.to_glib_none().0)
155        }
156    }
157
158    ///
159    /// # Returns
160    ///
161    /// the #NMSettingOvsDpdk:n-rxq-desc property of the setting
162    #[cfg(feature = "v1_42")]
163    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
164    #[doc(alias = "nm_setting_ovs_dpdk_get_n_rxq_desc")]
165    #[doc(alias = "get_n_rxq_desc")]
166    #[doc(alias = "n-rxq-desc")]
167    pub fn n_rxq_desc(&self) -> u32 {
168        unsafe {
169            ffi::nm_setting_ovs_dpdk_get_n_rxq_desc(self.to_glib_none().0)
170        }
171    }
172
173    ///
174    /// # Returns
175    ///
176    /// the #NMSettingOvsDpdk:n-txq-desc property of the setting
177    #[cfg(feature = "v1_42")]
178    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
179    #[doc(alias = "nm_setting_ovs_dpdk_get_n_txq_desc")]
180    #[doc(alias = "get_n_txq_desc")]
181    #[doc(alias = "n-txq-desc")]
182    pub fn n_txq_desc(&self) -> u32 {
183        unsafe {
184            ffi::nm_setting_ovs_dpdk_get_n_txq_desc(self.to_glib_none().0)
185        }
186    }
187
188    /// Open vSwitch DPDK device arguments.
189    #[cfg(feature = "v1_20")]
190    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
191    pub fn set_devargs(&self, devargs: Option<&str>) {
192        ObjectExt::set_property(self,"devargs", devargs)
193    }
194
195    /// Configures the Link State Change (LSC) detection mode for the OVS DPDK interface.
196    /// When set to [`SettingOvsDpdkLscInterrupt::Ignore`][crate::SettingOvsDpdkLscInterrupt::Ignore], NetworkManager doesn't
197    /// change the default value configured by Open vSwitch.
198    /// [`SettingOvsDpdkLscInterrupt::Enabled`][crate::SettingOvsDpdkLscInterrupt::Enabled] enables interrupts.
199    /// [`SettingOvsDpdkLscInterrupt::Disabled`][crate::SettingOvsDpdkLscInterrupt::Disabled] disables interrupts, thus setting the
200    /// interface in poll mode.
201    #[cfg(feature = "v1_54")]
202    #[cfg_attr(docsrs, doc(cfg(feature = "v1_54")))]
203    #[doc(alias = "lsc-interrupt")]
204    pub fn set_lsc_interrupt(&self, lsc_interrupt: i32) {
205        ObjectExt::set_property(self,"lsc-interrupt", lsc_interrupt)
206    }
207
208    /// Open vSwitch DPDK number of rx queues.
209    /// Defaults to zero which means to leave the parameter in OVS unspecified
210    /// and effectively configures one queue.
211    #[cfg(feature = "v1_36")]
212    #[cfg_attr(docsrs, doc(cfg(feature = "v1_36")))]
213    #[doc(alias = "n-rxq")]
214    pub fn set_n_rxq(&self, n_rxq: u32) {
215        ObjectExt::set_property(self,"n-rxq", n_rxq)
216    }
217
218    /// The rx queue size (number of rx descriptors) for DPDK ports.
219    /// Must be zero or a power of 2 between 1 and 4096, and supported
220    /// by the hardware. Defaults to zero which means to leave the
221    /// parameter in OVS unspecified and effectively configures 2048
222    /// descriptors.
223    #[cfg(feature = "v1_42")]
224    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
225    #[doc(alias = "n-rxq-desc")]
226    pub fn set_n_rxq_desc(&self, n_rxq_desc: u32) {
227        ObjectExt::set_property(self,"n-rxq-desc", n_rxq_desc)
228    }
229
230    /// The tx queue size (number of tx descriptors) for DPDK ports.
231    /// Must be zero or a power of 2 between 1 and 4096, and supported
232    /// by the hardware. Defaults to zero which means to leave the
233    /// parameter in OVS unspecified and effectively configures 2048
234    /// descriptors.
235    #[cfg(feature = "v1_42")]
236    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
237    #[doc(alias = "n-txq-desc")]
238    pub fn set_n_txq_desc(&self, n_txq_desc: u32) {
239        ObjectExt::set_property(self,"n-txq-desc", n_txq_desc)
240    }
241
242    #[cfg(feature = "v1_20")]
243    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
244    #[doc(alias = "devargs")]
245    pub fn connect_devargs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
246        unsafe extern "C" fn notify_devargs_trampoline<F: Fn(&SettingOvsDpdk) + 'static>(this: *mut ffi::NMSettingOvsDpdk, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
247            let f: &F = &*(f as *const F);
248            f(&from_glib_borrow(this))
249        }
250        unsafe {
251            let f: Box_<F> = Box_::new(f);
252            connect_raw(self.as_ptr() as *mut _, c"notify::devargs".as_ptr() as *const _,
253                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_devargs_trampoline::<F> as *const ())), Box_::into_raw(f))
254        }
255    }
256
257    #[cfg(feature = "v1_54")]
258    #[cfg_attr(docsrs, doc(cfg(feature = "v1_54")))]
259    #[doc(alias = "lsc-interrupt")]
260    pub fn connect_lsc_interrupt_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
261        unsafe extern "C" fn notify_lsc_interrupt_trampoline<F: Fn(&SettingOvsDpdk) + 'static>(this: *mut ffi::NMSettingOvsDpdk, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
262            let f: &F = &*(f as *const F);
263            f(&from_glib_borrow(this))
264        }
265        unsafe {
266            let f: Box_<F> = Box_::new(f);
267            connect_raw(self.as_ptr() as *mut _, c"notify::lsc-interrupt".as_ptr() as *const _,
268                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_lsc_interrupt_trampoline::<F> as *const ())), Box_::into_raw(f))
269        }
270    }
271
272    #[cfg(feature = "v1_36")]
273    #[cfg_attr(docsrs, doc(cfg(feature = "v1_36")))]
274    #[doc(alias = "n-rxq")]
275    pub fn connect_n_rxq_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
276        unsafe extern "C" fn notify_n_rxq_trampoline<F: Fn(&SettingOvsDpdk) + 'static>(this: *mut ffi::NMSettingOvsDpdk, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
277            let f: &F = &*(f as *const F);
278            f(&from_glib_borrow(this))
279        }
280        unsafe {
281            let f: Box_<F> = Box_::new(f);
282            connect_raw(self.as_ptr() as *mut _, c"notify::n-rxq".as_ptr() as *const _,
283                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_n_rxq_trampoline::<F> as *const ())), Box_::into_raw(f))
284        }
285    }
286
287    #[cfg(feature = "v1_42")]
288    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
289    #[doc(alias = "n-rxq-desc")]
290    pub fn connect_n_rxq_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
291        unsafe extern "C" fn notify_n_rxq_desc_trampoline<F: Fn(&SettingOvsDpdk) + 'static>(this: *mut ffi::NMSettingOvsDpdk, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
292            let f: &F = &*(f as *const F);
293            f(&from_glib_borrow(this))
294        }
295        unsafe {
296            let f: Box_<F> = Box_::new(f);
297            connect_raw(self.as_ptr() as *mut _, c"notify::n-rxq-desc".as_ptr() as *const _,
298                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_n_rxq_desc_trampoline::<F> as *const ())), Box_::into_raw(f))
299        }
300    }
301
302    #[cfg(feature = "v1_42")]
303    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
304    #[doc(alias = "n-txq-desc")]
305    pub fn connect_n_txq_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
306        unsafe extern "C" fn notify_n_txq_desc_trampoline<F: Fn(&SettingOvsDpdk) + 'static>(this: *mut ffi::NMSettingOvsDpdk, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
307            let f: &F = &*(f as *const F);
308            f(&from_glib_borrow(this))
309        }
310        unsafe {
311            let f: Box_<F> = Box_::new(f);
312            connect_raw(self.as_ptr() as *mut _, c"notify::n-txq-desc".as_ptr() as *const _,
313                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_n_txq_desc_trampoline::<F> as *const ())), Box_::into_raw(f))
314        }
315    }
316}
317
318#[cfg(feature = "v1_20")]
319#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
320impl Default for SettingOvsDpdk {
321                     fn default() -> Self {
322                         Self::new()
323                     }
324                 }
325
326// rustdoc-stripper-ignore-next
327        /// A [builder-pattern] type to construct [`SettingOvsDpdk`] objects.
328        ///
329        /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
330#[must_use = "The builder must be built to be used"]
331pub struct SettingOvsDpdkBuilder {
332            builder: glib::object::ObjectBuilder<'static, SettingOvsDpdk>,
333        }
334
335        impl SettingOvsDpdkBuilder {
336        fn new() -> Self {
337            Self { builder: glib::object::Object::builder() }
338        }
339
340                            /// Open vSwitch DPDK device arguments.
341                            #[cfg(feature = "v1_20")]
342    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
343    pub fn devargs(self, devargs: impl Into<glib::GString>) -> Self {
344                            Self { builder: self.builder.property("devargs", devargs.into()), }
345                        }
346
347                            /// Configures the Link State Change (LSC) detection mode for the OVS DPDK interface.
348                            /// When set to [`SettingOvsDpdkLscInterrupt::Ignore`][crate::SettingOvsDpdkLscInterrupt::Ignore], NetworkManager doesn't
349                            /// change the default value configured by Open vSwitch.
350                            /// [`SettingOvsDpdkLscInterrupt::Enabled`][crate::SettingOvsDpdkLscInterrupt::Enabled] enables interrupts.
351                            /// [`SettingOvsDpdkLscInterrupt::Disabled`][crate::SettingOvsDpdkLscInterrupt::Disabled] disables interrupts, thus setting the
352                            /// interface in poll mode.
353                            #[cfg(feature = "v1_54")]
354    #[cfg_attr(docsrs, doc(cfg(feature = "v1_54")))]
355    pub fn lsc_interrupt(self, lsc_interrupt: i32) -> Self {
356                            Self { builder: self.builder.property("lsc-interrupt", lsc_interrupt), }
357                        }
358
359                            /// Open vSwitch DPDK number of rx queues.
360                            /// Defaults to zero which means to leave the parameter in OVS unspecified
361                            /// and effectively configures one queue.
362                            #[cfg(feature = "v1_36")]
363    #[cfg_attr(docsrs, doc(cfg(feature = "v1_36")))]
364    pub fn n_rxq(self, n_rxq: u32) -> Self {
365                            Self { builder: self.builder.property("n-rxq", n_rxq), }
366                        }
367
368                            /// The rx queue size (number of rx descriptors) for DPDK ports.
369                            /// Must be zero or a power of 2 between 1 and 4096, and supported
370                            /// by the hardware. Defaults to zero which means to leave the
371                            /// parameter in OVS unspecified and effectively configures 2048
372                            /// descriptors.
373                            #[cfg(feature = "v1_42")]
374    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
375    pub fn n_rxq_desc(self, n_rxq_desc: u32) -> Self {
376                            Self { builder: self.builder.property("n-rxq-desc", n_rxq_desc), }
377                        }
378
379                            /// The tx queue size (number of tx descriptors) for DPDK ports.
380                            /// Must be zero or a power of 2 between 1 and 4096, and supported
381                            /// by the hardware. Defaults to zero which means to leave the
382                            /// parameter in OVS unspecified and effectively configures 2048
383                            /// descriptors.
384                            #[cfg(feature = "v1_42")]
385    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
386    pub fn n_txq_desc(self, n_txq_desc: u32) -> Self {
387                            Self { builder: self.builder.property("n-txq-desc", n_txq_desc), }
388                        }
389
390    // rustdoc-stripper-ignore-next
391    /// Build the [`SettingOvsDpdk`].
392    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
393    pub fn build(self) -> SettingOvsDpdk {
394assert_initialized_main_thread!();
395    self.builder.build() }
396}