Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Add network functions on the DPU side #54

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

bn222
Copy link
Contributor

@bn222 bn222 commented Apr 22, 2024

No description provided.

Copy link

openshift-ci bot commented Apr 22, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bn222

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 22, 2024
@bn222 bn222 changed the title Add network functions on the DPU side [DRAFT] Add network functions on the DPU side Apr 22, 2024
Containers: []corev1.Container{
{
Name: name,
Image: image,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to have a PullPolicy = Always for debugging here.

daemon/dpudaemon.go Show resolved Hide resolved
api/v1/classifierconfig_types.go Show resolved Hide resolved
return err
}
return d.Serve(lis)
go func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation does not work:


import (
	"errors"
	"fmt"
	"time"
)

func something(c chan error) {
	fmt.Println("HELLO1")
	c <- nil
}

func something3(c chan error) {
	fmt.Println("HELLO1")
	time.Sleep(5 * time.Second)
	c <- errors.New("an error")
}

func something2() error {
	c := make(chan error, 1)
	go something(c)
	go something3(c)
	return <-c
}
func main() {
	err := something2()
	fmt.Println(err)
}

It does not wait for all the go routines to finish, you need a wait group.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this works:

package main

import (
	"errors"
	"fmt"
	"sync"
	"time"
)

func test1(wg *sync.WaitGroup, c chan error) {
	defer wg.Done()
	fmt.Println("HELLO1")
	c <- nil
}

func test2(wg *sync.WaitGroup, c chan error) {
	defer wg.Done()
	fmt.Println("HELLO1")
	time.Sleep(5 * time.Second)
	c <- errors.New("an error")
}

func testing() chan error {
	c := make(chan error, 2)
	var wga sync.WaitGroup
	wga.Add(1)
	go test1(&wga, c)
	wga.Add(1)
	go test2(&wga, c)
	wga.Wait()
	close(c)
	return c
}
func main() {
	errors := testing()
	for err := range errors {
		fmt.Println(err)
	}
}

listener, err := d.Listen()

if err != nil {
d.log.Error(err, "Failed to listen")
return err
}
return d.Serve(listener)
go func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 25, 2024
Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
@openshift-merge-robot openshift-merge-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 26, 2024
@openshift-merge-robot
Copy link

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

openshift-ci bot commented May 16, 2024

@bn222: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/unit 2d6dc9d link true /test unit
ci/prow/e2e-dpu-operator-tests 2d6dc9d link true /test e2e-dpu-operator-tests
ci/prow/make-test 2d6dc9d link true /test make-test
ci/prow/make-fmt-check 2d6dc9d link true /test make-fmt-check

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants