Represent fragment size as uint16_t
Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
7fbbc13e65
commit
82e6a7972c
6 changed files with 32 additions and 13 deletions
|
@ -223,7 +223,7 @@ CycloneDDS configuration""" ] ]
|
||||||
& [ a:documentation [ xml:lang="en" """
|
& [ a:documentation [ xml:lang="en" """
|
||||||
<p>This element specifies the size of DDSI sample fragments generated by Cyclone DDS. Samples larger than FragmentSize are fragmented into fragments of FragmentSize bytes each, except the last one, which may be smaller. The DDSI spec mandates a minimum fragment size of 1025 bytes, but Cyclone DDS will do whatever size is requested, accepting fragments of which the size is at least the minimum of 1025 and FragmentSize.</p>
|
<p>This element specifies the size of DDSI sample fragments generated by Cyclone DDS. Samples larger than FragmentSize are fragmented into fragments of FragmentSize bytes each, except the last one, which may be smaller. The DDSI spec mandates a minimum fragment size of 1025 bytes, but Cyclone DDS will do whatever size is requested, accepting fragments of which the size is at least the minimum of 1025 and FragmentSize.</p>
|
||||||
<p>The unit must be specified explicitly. Recognised units: B (bytes), kB & KiB (2<sup>10</sup> bytes), MB & MiB (2<sup>20</sup> bytes), GB & GiB (2<sup>30</sup> bytes).</p>
|
<p>The unit must be specified explicitly. Recognised units: B (bytes), kB & KiB (2<sup>10</sup> bytes), MB & MiB (2<sup>20</sup> bytes), GB & GiB (2<sup>30</sup> bytes).</p>
|
||||||
<p>The default value is: "1280 B".</p>""" ] ]
|
<p>The default value is: "1344 B".</p>""" ] ]
|
||||||
element FragmentSize {
|
element FragmentSize {
|
||||||
memsize
|
memsize
|
||||||
}?
|
}?
|
||||||
|
|
|
@ -375,7 +375,7 @@ CycloneDDS configuration</xs:documentation>
|
||||||
<xs:documentation>
|
<xs:documentation>
|
||||||
<p>This element specifies the size of DDSI sample fragments generated by Cyclone DDS. Samples larger than FragmentSize are fragmented into fragments of FragmentSize bytes each, except the last one, which may be smaller. The DDSI spec mandates a minimum fragment size of 1025 bytes, but Cyclone DDS will do whatever size is requested, accepting fragments of which the size is at least the minimum of 1025 and FragmentSize.</p>
|
<p>This element specifies the size of DDSI sample fragments generated by Cyclone DDS. Samples larger than FragmentSize are fragmented into fragments of FragmentSize bytes each, except the last one, which may be smaller. The DDSI spec mandates a minimum fragment size of 1025 bytes, but Cyclone DDS will do whatever size is requested, accepting fragments of which the size is at least the minimum of 1025 and FragmentSize.</p>
|
||||||
<p>The unit must be specified explicitly. Recognised units: B (bytes), kB & KiB (2<sup>10</sup> bytes), MB & MiB (2<sup>20</sup> bytes), GB & GiB (2<sup>30</sup> bytes).</p>
|
<p>The unit must be specified explicitly. Recognised units: B (bytes), kB & KiB (2<sup>10</sup> bytes), MB & MiB (2<sup>20</sup> bytes), GB & GiB (2<sup>30</sup> bytes).</p>
|
||||||
<p>The default value is: "1280 B".</p></xs:documentation>
|
<p>The default value is: "1344 B".</p></xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<xs:element name="MaxMessageSize" type="config:memsize">
|
<xs:element name="MaxMessageSize" type="config:memsize">
|
||||||
|
|
|
@ -167,9 +167,9 @@ static struct cfgelem general_cfgelems[] = {
|
||||||
"it is generally advisable to also consider reducing "
|
"it is generally advisable to also consider reducing "
|
||||||
"Internal/FragmentSize.</p>"),
|
"Internal/FragmentSize.</p>"),
|
||||||
UNIT("memsize")),
|
UNIT("memsize")),
|
||||||
STRING("FragmentSize", NULL, 1, "1280 B",
|
STRING("FragmentSize", NULL, 1, "1344 B",
|
||||||
MEMBER(fragment_size),
|
MEMBER(fragment_size),
|
||||||
FUNCTIONS(0, uf_memsize, 0, pf_memsize),
|
FUNCTIONS(0, uf_memsize16, 0, pf_memsize16),
|
||||||
DESCRIPTION(
|
DESCRIPTION(
|
||||||
"<p>This element specifies the size of DDSI sample fragments generated "
|
"<p>This element specifies the size of DDSI sample fragments generated "
|
||||||
"by Cyclone DDS. Samples larger than FragmentSize are fragmented into "
|
"by Cyclone DDS. Samples larger than FragmentSize are fragmented into "
|
||||||
|
|
|
@ -262,8 +262,8 @@ struct config
|
||||||
|
|
||||||
unsigned delivery_queue_maxsamples;
|
unsigned delivery_queue_maxsamples;
|
||||||
|
|
||||||
|
uint16_t fragment_size;
|
||||||
uint32_t max_msg_size;
|
uint32_t max_msg_size;
|
||||||
uint32_t fragment_size;
|
|
||||||
|
|
||||||
int publish_uc_locators; /* Publish discovery unicast locators */
|
int publish_uc_locators; /* Publish discovery unicast locators */
|
||||||
int enable_uc_locators; /* If false, don't even try to create a unicast socket */
|
int enable_uc_locators; /* If false, don't even try to create a unicast socket */
|
||||||
|
|
|
@ -164,6 +164,7 @@ DU(natint_255);
|
||||||
DUPF(participantIndex);
|
DUPF(participantIndex);
|
||||||
DU(dyn_port);
|
DU(dyn_port);
|
||||||
DUPF(memsize);
|
DUPF(memsize);
|
||||||
|
DUPF(memsize16);
|
||||||
DU(duration_inf);
|
DU(duration_inf);
|
||||||
DU(duration_ms_1hr);
|
DU(duration_ms_1hr);
|
||||||
DU(duration_ms_1s);
|
DU(duration_ms_1s);
|
||||||
|
@ -1092,8 +1093,26 @@ static enum update_result uf_memsize (struct cfgst *cfgst, void *parent, struct
|
||||||
|
|
||||||
static void pf_memsize (struct cfgst *cfgst, void *parent, struct cfgelem const * const cfgelem, uint32_t sources)
|
static void pf_memsize (struct cfgst *cfgst, void *parent, struct cfgelem const * const cfgelem, uint32_t sources)
|
||||||
{
|
{
|
||||||
int const * const elem = cfg_address (cfgst, parent, cfgelem);
|
uint32_t const * const elem = cfg_address (cfgst, parent, cfgelem);
|
||||||
pf_int64_unit (cfgst, *elem, sources, unittab_memsize, "B");
|
pf_int64_unit (cfgst, (int64_t) *elem, sources, unittab_memsize, "B");
|
||||||
|
}
|
||||||
|
|
||||||
|
static enum update_result uf_memsize16 (struct cfgst *cfgst, void *parent, struct cfgelem const * const cfgelem, UNUSED_ARG (int first), const char *value)
|
||||||
|
{
|
||||||
|
int64_t size = 0;
|
||||||
|
if (uf_natint64_unit (cfgst, &size, value, unittab_memsize, 1, 0, UINT16_MAX) != URES_SUCCESS)
|
||||||
|
return URES_ERROR;
|
||||||
|
else {
|
||||||
|
uint16_t * const elem = cfg_address (cfgst, parent, cfgelem);
|
||||||
|
*elem = (uint16_t) size;
|
||||||
|
return URES_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void pf_memsize16 (struct cfgst *cfgst, void *parent, struct cfgelem const * const cfgelem, uint32_t sources)
|
||||||
|
{
|
||||||
|
uint16_t const * const elem = cfg_address (cfgst, parent, cfgelem);
|
||||||
|
pf_int64_unit (cfgst, (int64_t) *elem, sources, unittab_memsize, "B");
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum update_result uf_tracingOutputFileName (struct cfgst *cfgst, UNUSED_ARG (void *parent), UNUSED_ARG (struct cfgelem const * const cfgelem), UNUSED_ARG (int first), const char *value)
|
static enum update_result uf_tracingOutputFileName (struct cfgst *cfgst, UNUSED_ARG (void *parent), UNUSED_ARG (struct cfgelem const * const cfgelem), UNUSED_ARG (int first), const char *value)
|
||||||
|
|
|
@ -541,7 +541,7 @@ dds_return_t create_fragment_message (struct writer *wr, seqno_t seq, const stru
|
||||||
|
|
||||||
ASSERT_MUTEX_HELD (&wr->e.lock);
|
ASSERT_MUTEX_HELD (&wr->e.lock);
|
||||||
|
|
||||||
if (fragnum * gv->config.fragment_size >= size && size > 0)
|
if (fragnum * (uint32_t) gv->config.fragment_size >= size && size > 0)
|
||||||
{
|
{
|
||||||
/* This is the first chance to detect an attempt at retransmitting
|
/* This is the first chance to detect an attempt at retransmitting
|
||||||
an non-existent fragment, which a malicious (or buggy) remote
|
an non-existent fragment, which a malicious (or buggy) remote
|
||||||
|
@ -617,18 +617,18 @@ dds_return_t create_fragment_message (struct writer *wr, seqno_t seq, const stru
|
||||||
|
|
||||||
frag->fragmentStartingNum = fragnum + 1;
|
frag->fragmentStartingNum = fragnum + 1;
|
||||||
frag->fragmentsInSubmessage = 1;
|
frag->fragmentsInSubmessage = 1;
|
||||||
frag->fragmentSize = (unsigned short) gv->config.fragment_size;
|
|
||||||
frag->sampleSize = (uint32_t)size;
|
|
||||||
|
|
||||||
fragstart = fragnum * gv->config.fragment_size;
|
|
||||||
#if MULTIPLE_FRAGS_IN_SUBMSG /* ugly hack for testing only */
|
#if MULTIPLE_FRAGS_IN_SUBMSG /* ugly hack for testing only */
|
||||||
if (fragstart + gv->config.fragment_size < ddsi_serdata_size (serdata) &&
|
if (fragstart + gv->config.fragment_size < ddsi_serdata_size (serdata) &&
|
||||||
fragstart + 2 * gv->config.fragment_size >= ddsi_serdata_size (serdata))
|
fragstart + 2 * gv->config.fragment_size >= ddsi_serdata_size (serdata))
|
||||||
frag->fragmentsInSubmessage++;
|
frag->fragmentsInSubmessage++;
|
||||||
ret = frag->fragmentsInSubmessage;
|
ret = frag->fragmentsInSubmessage;
|
||||||
#endif
|
#endif
|
||||||
|
frag->fragmentSize = gv->config.fragment_size;
|
||||||
|
frag->sampleSize = (uint32_t) size;
|
||||||
|
|
||||||
fraglen = gv->config.fragment_size * frag->fragmentsInSubmessage;
|
fragstart = fragnum * (uint32_t) gv->config.fragment_size;
|
||||||
|
fraglen = (uint32_t) gv->config.fragment_size * (uint32_t) frag->fragmentsInSubmessage;
|
||||||
if (fragstart + fraglen > size)
|
if (fragstart + fraglen > size)
|
||||||
fraglen = (uint32_t) (size - fragstart);
|
fraglen = (uint32_t) (size - fragstart);
|
||||||
ddcmn->octetsToInlineQos = (unsigned short) ((char*) (frag+1) - ((char*) &ddcmn->octetsToInlineQos + 2));
|
ddcmn->octetsToInlineQos = (unsigned short) ((char*) (frag+1) - ((char*) &ddcmn->octetsToInlineQos + 2));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue