]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
eth: fbnic: support allocating FW completions with extra space
authorJakub Kicinski <kuba@kernel.org>
Tue, 16 Sep 2025 23:14:16 +0000 (16:14 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 18 Sep 2025 09:37:23 +0000 (11:37 +0200)
Support allocating extra space after the FW completion.
This makes it easy to pass extra variable size buffer space
to FW response handlers without worrying about synchronization
(completion itself is already refcounted).

Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20250916231420.1693955-6-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/meta/fbnic/fbnic_fw.c
drivers/net/ethernet/meta/fbnic/fbnic_fw.h

index 9b39a73e4c3590f2693cb06f99785a77a3b2d75c..198922a942b21d81fe9e1f168d461a0e97fb81a4 100644 (file)
@@ -1544,11 +1544,12 @@ void fbnic_get_fw_ver_commit_str(struct fbnic_dev *fbd, char *fw_version,
                                 fw_version, str_sz);
 }
 
-struct fbnic_fw_completion *fbnic_fw_alloc_cmpl(u32 msg_type)
+struct fbnic_fw_completion *__fbnic_fw_alloc_cmpl(u32 msg_type,
+                                                 size_t priv_size)
 {
        struct fbnic_fw_completion *cmpl;
 
-       cmpl = kzalloc(sizeof(*cmpl), GFP_KERNEL);
+       cmpl = kzalloc(sizeof(*cmpl) + priv_size, GFP_KERNEL);
        if (!cmpl)
                return NULL;
 
@@ -1559,6 +1560,11 @@ struct fbnic_fw_completion *fbnic_fw_alloc_cmpl(u32 msg_type)
        return cmpl;
 }
 
+struct fbnic_fw_completion *fbnic_fw_alloc_cmpl(u32 msg_type)
+{
+       return __fbnic_fw_alloc_cmpl(msg_type, 0);
+}
+
 void fbnic_fw_put_cmpl(struct fbnic_fw_completion *fw_cmpl)
 {
        kref_put(&fw_cmpl->ref_count, fbnic_fw_release_cmpl_data);
index be7f2dc886981358a74d5a86e2169972ddc68209..d4c0fb4c94cc41e2196712cf5111aa38045c9d60 100644 (file)
@@ -100,6 +100,8 @@ int fbnic_fw_xmit_tsene_read_msg(struct fbnic_dev *fbd,
 int fbnic_fw_xmit_send_logs(struct fbnic_dev *fbd, bool enable,
                            bool send_log_history);
 int fbnic_fw_xmit_rpc_macda_sync(struct fbnic_dev *fbd);
+struct fbnic_fw_completion *__fbnic_fw_alloc_cmpl(u32 msg_type,
+                                                 size_t priv_size);
 struct fbnic_fw_completion *fbnic_fw_alloc_cmpl(u32 msg_type);
 void fbnic_fw_put_cmpl(struct fbnic_fw_completion *cmpl_data);