All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qi Zhang <qi.z.zhang@intel.com>
To: wenzhuo.lu@intel.com, qiming.yang@intel.com
Cc: paul.m.stillwell.jr@intel.com, dev@dpdk.org,
	bruce.richardson@intel.com, ferruh.yigit@intel.com,
	Qi Zhang <qi.z.zhang@intel.com>
Subject: [PATCH 4/7] net/ice/base: add some help macros
Date: Tue, 15 Jan 2019 20:56:55 +0800	[thread overview]
Message-ID: <20190115125658.15421-5-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20190115125658.15421-1-qi.z.zhang@intel.com>

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
---
 drivers/net/ice/base/ice_common.h | 10 ++++++++++
 drivers/net/ice/base/ice_osdep.h  |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/drivers/net/ice/base/ice_common.h b/drivers/net/ice/base/ice_common.h
index 45d93eb64..67539ccb7 100644
--- a/drivers/net/ice/base/ice_common.h
+++ b/drivers/net/ice/base/ice_common.h
@@ -51,6 +51,16 @@ void ice_clear_pxe_mode(struct ice_hw *hw);
 
 enum ice_status ice_get_caps(struct ice_hw *hw);
 
+/* Define a macro that will align a pointer to point to the next memory address
+ * that falls on the given power of 2 (i.e., 2, 4, 8, 16, 32, 64...). For
+ * example, given the variable pointer = 0x1006, then after the following call:
+ *
+ *      pointer = ICE_ALIGN(pointer, 4)
+ *
+ * ... the value of pointer would equal 0x1008, since 0x1008 is the next
+ * address after 0x1006 which is divisible by 4.
+ */
+#define ICE_ALIGN(ptr, align)   (((ptr) + ((align) - 1)) & ~((align) - 1))
 
 
 enum ice_status
diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h
index a3351c034..252c8f4e7 100644
--- a/drivers/net/ice/base/ice_osdep.h
+++ b/drivers/net/ice/base/ice_osdep.h
@@ -457,6 +457,8 @@ LIST_HEAD(ice_list_head, ice_list_entry);
 
 /*Note parameters are swapped*/
 #define LIST_FIRST_ENTRY(head, type, field) (type *)((head)->lh_first)
+#define LIST_NEXT_ENTRY(entry, type, field) \
+	((type *)(entry)->field.next.le_next)
 #define LIST_ADD(entry, list_head)    LIST_INSERT_HEAD(list_head, entry, next)
 #define LIST_ADD_AFTER(entry, list_entry) \
 	LIST_INSERT_AFTER(list_entry, entry, next)
-- 
2.13.6

  parent reply	other threads:[~2019-01-15 12:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15 12:56 [PATCH 0/7] net/ice: update share code Qi Zhang
2019-01-15 12:56 ` [PATCH 1/7] net/ice/base: code clean Qi Zhang
2019-01-15 12:56 ` [PATCH 2/7] net/ice/base: add API to support resource allocate Qi Zhang
2019-01-15 12:56 ` [PATCH 3/7] net/ice/base: add package download related data structure Qi Zhang
2019-01-15 12:56 ` Qi Zhang [this message]
2019-01-15 12:56 ` [PATCH 5/7] net/ice/base: add flexible pipeline module Qi Zhang
2019-01-15 12:56 ` [PATCH 6/7] net/ice/base: add flow module Qi Zhang
2019-01-16 12:14   ` Ferruh Yigit
2019-01-15 12:56 ` [PATCH 7/7] net/ice/base: free flow profile entries Qi Zhang
2019-01-16 12:15   ` Ferruh Yigit
2019-01-16  5:05 ` [PATCH 0/7] net/ice: update share code Lu, Wenzhuo
2019-01-16 12:16 ` Ferruh Yigit
2019-01-16 14:13 ` [PATCH v2 " Qi Zhang
2019-01-16 14:13   ` [PATCH v2 1/7] net/ice/base: code clean Qi Zhang
2019-01-16 14:13   ` [PATCH v2 2/7] net/ice/base: add API to support resource allocate Qi Zhang
2019-01-16 14:13   ` [PATCH v2 3/7] net/ice/base: add package download related data structure Qi Zhang
2019-01-16 14:13   ` [PATCH v2 4/7] net/ice/base: add some help macros Qi Zhang
2019-01-16 14:13   ` [PATCH v2 5/7] net/ice/base: add flexible pipeline module Qi Zhang
2019-01-16 14:13   ` [PATCH v2 6/7] net/ice/base: add flow module Qi Zhang
2019-01-16 14:13   ` [PATCH v2 7/7] net/ice/base: free flow profile entries Qi Zhang
2019-01-17 13:31   ` [PATCH v2 0/7] net/ice: update share code Zhang, Qi Z

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190115125658.15421-5-qi.z.zhang@intel.com \
    --to=qi.z.zhang@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=paul.m.stillwell.jr@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.