aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2020-10-27 15:40:07 +0200
committerMatias Elo <matias.elo@nokia.com>2020-11-02 17:32:42 +0200
commite2ad129761240b88a8dd0d77be2a60f8d590307f (patch)
treea2b274326132d788913b2a1b8ae3b9efdcef25cd
parentddfb9a95e21b8ea39f155ad0c5abdf737ef3f76b (diff)
linux-gen: pktio: pack pktio_entry_t enable flags into a bit field
Save memory by using a common bit field for pktio_entry_t flags. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
-rw-r--r--platform/linux-generic/include/odp_packet_io_internal.h12
-rw-r--r--platform/linux-generic/pktio/dpdk.c6
2 files changed, 11 insertions, 7 deletions
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h
index 6d3454df4..8475042e9 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -68,9 +68,13 @@ struct pktio_entry {
/* These two locks together lock the whole pktio device */
odp_ticketlock_t rxl; /**< RX ticketlock */
odp_ticketlock_t txl; /**< TX ticketlock */
- uint8_t cls_enabled; /**< classifier enabled */
- uint8_t chksum_insert_ena; /**< pktout checksum offload enabled */
uint16_t pktin_frame_offset;
+ struct {
+ /* Pktout checksum offload */
+ uint8_t chksum_insert : 1;
+ /* Classifier */
+ uint8_t cls : 1;
+ } enabled;
odp_pktio_t handle; /**< pktio handle */
unsigned char ODP_ALIGNED_CACHE pkt_priv[PKTIO_PRIVATE_SIZE];
enum {
@@ -219,12 +223,12 @@ static inline pktio_entry_t *get_pktio_entry(odp_pktio_t pktio)
static inline int pktio_cls_enabled(pktio_entry_t *entry)
{
- return entry->s.cls_enabled;
+ return entry->s.enabled.cls;
}
static inline void pktio_cls_enabled_set(pktio_entry_t *entry, int ena)
{
- entry->s.cls_enabled = ena;
+ entry->s.enabled.cls = !!ena;
}
extern const pktio_if_ops_t netmap_pktio_ops;
diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c
index 8e07c3c69..c68108e0b 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -801,7 +801,7 @@ static inline int pkt_to_mbuf(pktio_entry_t *pktio_entry,
odp_packet_copy_to_mem(pkt_table[i], 0, pkt_len, data);
- if (odp_unlikely(pktio_entry->s.chksum_insert_ena)) {
+ if (odp_unlikely(pktio_entry->s.enabled.chksum_insert)) {
odp_pktout_config_opt_t *pktout_capa =
&pktio_entry->s.capa.config.pktout;
@@ -956,7 +956,7 @@ static inline int pkt_to_mbuf_zero(pktio_entry_t *pktio_entry,
if (odp_likely(pkt_hdr->seg_count == 1)) {
mbuf_update(mbuf, pkt_hdr, pkt_len);
- if (odp_unlikely(pktio_entry->s.chksum_insert_ena))
+ if (odp_unlikely(pktio_entry->s.enabled.chksum_insert))
pkt_set_ol_tx(pktout_cfg, pktout_capa, pkt_hdr,
mbuf, odp_packet_data(pkt));
} else {
@@ -1164,7 +1164,7 @@ static int dpdk_setup_eth_dev(pktio_entry_t *pktio_entry,
eth_conf.txmode.offloads = tx_offloads;
if (tx_offloads)
- pktio_entry->s.chksum_insert_ena = 1;
+ pktio_entry->s.enabled.chksum_insert = 1;
ret = rte_eth_dev_configure(pkt_dpdk->port_id,
pktio_entry->s.num_in_queue,