Commit graph

24 commits

Author SHA1 Message Date
Dan Carpenter 7d8697afae hinic: skb_pad() frees on error
The skb_pad() function frees the skb on error, so this code has a double
free.

Fixes: 00e57a6d4a ("net-next/hinic: Add Tx operation")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-25 17:13:04 -07:00
Dan Carpenter 256fbe1112 hinic: uninitialized variable in hinic_api_cmd_init()
We never set the error code in this function.

Fixes: eabf0fad81 ("net-next/hinic: Initialize api cmd resources")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-24 21:47:11 -07:00
Colin Ian King 5719e5eb31 net: hinic: make functions set_ctrl0 and set_ctrl1 static
The functions set_ctrl0 and set_ctrl1 are local to the source and do
not need to be in global scope, so make them static.

Cleans up sparse warnings:
symbol 'set_ctrl0' was not declared. Should it be static?
symbol 'set_ctrl1' was not declared. Should it be static?

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-23 22:20:28 -07:00
Aviad Krawczyk b553400bb4 net-next/hinic: Add netpoll
Add more netdev operation - netpoll.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:54 -07:00
Aviad Krawczyk edd384f682 net-next/hinic: Add ethtool and stats
Add ethtool operations and statistics operations.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:54 -07:00
Aviad Krawczyk 00e57a6d4a net-next/hinic: Add Tx operation
Add transmit operation for sending data by qp operations.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:54 -07:00
Aviad Krawczyk e2585ea775 net-next/hinic: Add Rx handler
Set the io resources in the nic and handle rx events by qp operations.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:54 -07:00
Aviad Krawczyk 7ef37fe4c1 net-next/hinic: Add cmdq completion handler
Add cmdq completion handler for getting a notification about the
completion of cmdq commands.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:54 -07:00
Aviad Krawczyk 76baca2e92 net-next/hinic: Add cmdq commands
Add cmdq commands for setting queue pair contexts in the nic.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:53 -07:00
Aviad Krawczyk fc9319e402 net-next/hinic: Add ceqs
Initialize the completion event queues and handle ceq events by calling
the registered handlers. Used for cmdq command completion.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:53 -07:00
Aviad Krawczyk d0b9805e82 net-next/hinic: Initialize cmdq
Create the work queues for cmdq and update the nic about the work queue
contexts. cmdq commands are used for updating the nic about the qp
contexts.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:53 -07:00
Aviad Krawczyk 53e7d6feb9 net-next/hinic: Set qp context
Update the nic about the resources of the queue pairs.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:53 -07:00
Aviad Krawczyk f91090f7da net-next/hinic: Add qp resources
Create the resources for queue pair operations: doorbell area,
consumer index address and producer index address.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:53 -07:00
Aviad Krawczyk b15a9f37be net-next/hinic: Add wq
Create work queues for being used by the queue pairs.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:53 -07:00
Aviad Krawczyk c3e79baf1b net-next/hinic: Add logical Txq and Rxq
Create the logical queues of the nic.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:53 -07:00
Aviad Krawczyk c4d06d2d20 net-next/hinic: Add Rx mode and link event handler
Add port management message for setting Rx mode in the card,
used for rx_mode netdev operation.
The link event handler is used for getting a notification about the
link state.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:53 -07:00
Aviad Krawczyk 25a3ba6106 net-next/hinic: Add port management commands
Add the port management commands that are sent as management messages.
The port management commands are used for netdev operations.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:53 -07:00
Aviad Krawczyk f00fe738b5 net-next/hinic: Add aeqs
Handle aeq elements that are accumulated on the aeq by calling the
registered handler for the specific event.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:53 -07:00
Aviad Krawczyk 0ac599c790 net-next/hinic: Add api cmd commands
Add the api cmd commands for sending management messages to the nic.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:53 -07:00
Aviad Krawczyk 6dd8b68214 net-next/hinic: Add management messages
Add the management messages for sending to api cmd and the asynchronous
event handler for the completion of the messages.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:53 -07:00
Aviad Krawczyk 3dcea32193 net-next/hinic: Initialize api cmd hw
Update the hardware about api cmd resources and initialize it.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:52 -07:00
Aviad Krawczyk eabf0fad81 net-next/hinic: Initialize api cmd resources
Initialize api cmd resources as part of management initialization.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:52 -07:00
Aviad Krawczyk a5564e7e44 net-next/hinic: Initialize hw device components
Initialize hw device by calling the initialization functions of aeqs and
management channel.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:52 -07:00
Aviad Krawczyk 51ba902a16 net-next/hinic: Initialize hw interface
Initialize hw interface as part of the nic initialization for accessing hw.

Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-22 10:48:52 -07:00